Version 3.2.5
Fixed build with Irregexp interpreter (issue 1266).
Added Crankshaft support for external arrays.
Fixed two potential crash bugs.
git-svn-id: http://v8.googlecode.com/svn/trunk@7385 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 3ca76f7..fed4b8b 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -29,7 +29,9 @@
#define V8_HYDROGEN_INSTRUCTIONS_H_
#include "v8.h"
+
#include "code-stubs.h"
+#include "small-pointer-list.h"
#include "string-stream.h"
#include "zone.h"
@@ -125,9 +127,10 @@
V(LoadGlobal) \
V(LoadKeyedFastElement) \
V(LoadKeyedGeneric) \
+ V(LoadKeyedSpecializedArrayElement) \
V(LoadNamedField) \
+ V(LoadNamedFieldPolymorphic) \
V(LoadNamedGeneric) \
- V(LoadPixelArrayElement) \
V(Mod) \
V(Mul) \
V(ObjectLiteral) \
@@ -146,7 +149,7 @@
V(StoreContextSlot) \
V(StoreGlobal) \
V(StoreKeyedFastElement) \
- V(StorePixelArrayElement) \
+ V(StoreKeyedSpecializedArrayElement) \
V(StoreKeyedGeneric) \
V(StoreNamedField) \
V(StoreNamedGeneric) \
@@ -168,7 +171,7 @@
V(InobjectFields) \
V(BackingStoreFields) \
V(ArrayElements) \
- V(PixelArrayElements) \
+ V(SpecializedArrayElements) \
V(GlobalVars) \
V(Maps) \
V(ArrayLengths) \
@@ -451,7 +454,6 @@
HValue() : block_(NULL),
id_(kNoNumber),
- uses_(2),
type_(HType::Tagged()),
range_(NULL),
flags_(0) {}
@@ -463,7 +465,7 @@
int id() const { return id_; }
void set_id(int id) { id_ = id; }
- ZoneList<HValue*>* uses() { return &uses_; }
+ SmallPointerList<HValue>* uses() { return &uses_; }
virtual bool EmitAtUses() { return false; }
Representation representation() const { return representation_; }
@@ -607,7 +609,7 @@
int id_;
Representation representation_;
- ZoneList<HValue*> uses_;
+ SmallPointerList<HValue> uses_;
HType type_;
Range* range_;
int flags_;
@@ -1246,7 +1248,7 @@
bool IsApplyFunction() const {
return function_->code() ==
- Isolate::Current()->builtins()->builtin(Builtins::FunctionApply);
+ Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply);
}
virtual void PrintDataTo(StringStream* stream);
@@ -1406,8 +1408,9 @@
// object. It is guaranteed to be 32 bit integer, but it can be
// represented as either a smi or heap number.
set_representation(Representation::Tagged());
- SetFlag(kDependsOnArrayLengths);
SetFlag(kUseGVN);
+ SetFlag(kDependsOnArrayLengths);
+ SetFlag(kDependsOnMaps);
}
virtual Representation RequiredInputRepresentation(int index) const {
@@ -1425,8 +1428,8 @@
public:
explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
set_representation(Representation::Tagged());
- SetFlag(kDependsOnArrayLengths);
SetFlag(kUseGVN);
+ SetFlag(kDependsOnArrayLengths);
}
virtual Representation RequiredInputRepresentation(int index) const {
@@ -1584,7 +1587,7 @@
: HUnaryOperation(value) {
set_representation(Representation::External());
// The result of this instruction is idempotent as long as its inputs don't
- // change. The external array of a pixel array elements object cannot
+ // change. The external array of a specialized array elements object cannot
// change once set, so it's no necessary to introduce any additional
// dependencies on top of the inputs.
SetFlag(kUseGVN);
@@ -2256,6 +2259,7 @@
: HBinaryOperation(left, right) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
+ SetFlag(kDependsOnMaps);
}
virtual bool EmitAtUses() {
@@ -2941,6 +2945,7 @@
offset_(offset) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
+ SetFlag(kDependsOnMaps);
if (is_in_object) {
SetFlag(kDependsOnInobjectFields);
} else {
@@ -2971,6 +2976,37 @@
};
+class HLoadNamedFieldPolymorphic: public HUnaryOperation {
+ public:
+ HLoadNamedFieldPolymorphic(HValue* object,
+ ZoneMapList* types,
+ Handle<String> name);
+
+ HValue* object() { return OperandAt(0); }
+ ZoneMapList* types() { return &types_; }
+ Handle<String> name() { return name_; }
+ bool need_generic() { return need_generic_; }
+
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
+ DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic,
+ "load_named_field_polymorphic")
+
+ static const int kMaxLoadPolymorphism = 4;
+
+ protected:
+ virtual bool DataEquals(HValue* value);
+
+ private:
+ ZoneMapList types_;
+ Handle<String> name_;
+ bool need_generic_;
+};
+
+
+
class HLoadNamedGeneric: public HBinaryOperation {
public:
HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
@@ -3043,13 +3079,20 @@
};
-class HLoadPixelArrayElement: public HBinaryOperation {
+class HLoadKeyedSpecializedArrayElement: public HBinaryOperation {
public:
- HLoadPixelArrayElement(HValue* external_elements, HValue* key)
- : HBinaryOperation(external_elements, key) {
- set_representation(Representation::Integer32());
- SetFlag(kDependsOnPixelArrayElements);
- // Native code could change the pixel array.
+ HLoadKeyedSpecializedArrayElement(HValue* external_elements,
+ HValue* key,
+ ExternalArrayType array_type)
+ : HBinaryOperation(external_elements, key),
+ array_type_(array_type) {
+ if (array_type == kExternalFloatArray) {
+ set_representation(Representation::Double());
+ } else {
+ set_representation(Representation::Integer32());
+ }
+ SetFlag(kDependsOnSpecializedArrayElements);
+ // Native code could change the specialized array.
SetFlag(kDependsOnCalls);
SetFlag(kUseGVN);
}
@@ -3065,12 +3108,21 @@
HValue* external_pointer() { return OperandAt(0); }
HValue* key() { return OperandAt(1); }
+ ExternalArrayType array_type() const { return array_type_; }
- DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement,
- "load_pixel_array_element")
+ DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
+ "load_keyed_specialized_array_element")
protected:
- virtual bool DataEquals(HValue* other) { return true; }
+ virtual bool DataEquals(HValue* other) {
+ if (!other->IsLoadKeyedSpecializedArrayElement()) return false;
+ HLoadKeyedSpecializedArrayElement* cast_other =
+ HLoadKeyedSpecializedArrayElement::cast(other);
+ return array_type_ == cast_other->array_type();
+ }
+
+ private:
+ ExternalArrayType array_type_;
};
@@ -3205,10 +3257,14 @@
};
-class HStorePixelArrayElement: public HTemplateInstruction<3> {
+class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> {
public:
- HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue* val) {
- SetFlag(kChangesPixelArrayElements);
+ HStoreKeyedSpecializedArrayElement(HValue* external_elements,
+ HValue* key,
+ HValue* val,
+ ExternalArrayType array_type)
+ : array_type_(array_type) {
+ SetFlag(kChangesSpecializedArrayElements);
SetOperandAt(0, external_elements);
SetOperandAt(1, key);
SetOperandAt(2, val);
@@ -3220,16 +3276,23 @@
if (index == 0) {
return Representation::External();
} else {
- return Representation::Integer32();
+ if (index == 2 && array_type() == kExternalFloatArray) {
+ return Representation::Double();
+ } else {
+ return Representation::Integer32();
+ }
}
}
HValue* external_pointer() { return OperandAt(0); }
HValue* key() { return OperandAt(1); }
HValue* value() { return OperandAt(2); }
+ ExternalArrayType array_type() const { return array_type_; }
- DECLARE_CONCRETE_INSTRUCTION(StorePixelArrayElement,
- "store_pixel_array_element")
+ DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
+ "store_keyed_specialized_array_element")
+ private:
+ ExternalArrayType array_type_;
};
@@ -3267,6 +3330,7 @@
: HBinaryOperation(string, index) {
set_representation(Representation::Integer32());
SetFlag(kUseGVN);
+ SetFlag(kDependsOnMaps);
}
virtual Representation RequiredInputRepresentation(int index) const {
@@ -3311,6 +3375,7 @@
explicit HStringLength(HValue* string) : HUnaryOperation(string) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
+ SetFlag(kDependsOnMaps);
}
virtual Representation RequiredInputRepresentation(int index) const {