diff options
Diffstat (limited to 'deps/v8/src/hydrogen-instructions.h')
-rw-r--r-- | deps/v8/src/hydrogen-instructions.h | 286 |
1 files changed, 226 insertions, 60 deletions
diff --git a/deps/v8/src/hydrogen-instructions.h b/deps/v8/src/hydrogen-instructions.h index 39e395025..4d7b7baa8 100644 --- a/deps/v8/src/hydrogen-instructions.h +++ b/deps/v8/src/hydrogen-instructions.h @@ -97,11 +97,13 @@ class LChunkBuilder; V(CompareConstantEqAndBranch) \ V(Constant) \ V(Context) \ + V(DeclareGlobals) \ V(DeleteProperty) \ V(Deoptimize) \ V(Div) \ V(ElementsKind) \ V(EnterInlined) \ + V(FastLiteral) \ V(FixedArrayBaseLength) \ V(ForceRepresentation) \ V(FunctionLiteral) \ @@ -139,8 +141,7 @@ class LChunkBuilder; V(LoadNamedGeneric) \ V(Mod) \ V(Mul) \ - V(ObjectLiteralFast) \ - V(ObjectLiteralGeneric) \ + V(ObjectLiteral) \ V(OsrEntry) \ V(OuterContext) \ V(Parameter) \ @@ -179,7 +180,11 @@ class LChunkBuilder; V(UnaryMathOperation) \ V(UnknownOSRValue) \ V(UseConst) \ - V(ValueOf) + V(ValueOf) \ + V(ForInPrepareMap) \ + V(ForInCacheArray) \ + V(CheckMapValue) \ + V(LoadFieldByIndex) #define GVN_FLAG_LIST(V) \ V(Calls) \ @@ -1486,6 +1491,33 @@ class HOuterContext: public HUnaryOperation { }; +class HDeclareGlobals: public HUnaryOperation { + public: + HDeclareGlobals(HValue* context, + Handle<FixedArray> pairs, + int flags) + : HUnaryOperation(context), + pairs_(pairs), + flags_(flags) { + set_representation(Representation::Tagged()); + SetAllSideEffects(); + } + + HValue* context() { return OperandAt(0); } + Handle<FixedArray> pairs() const { return pairs_; } + int flags() const { return flags_; } + + DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) + + virtual Representation RequiredInputRepresentation(int index) { + return Representation::Tagged(); + } + private: + Handle<FixedArray> pairs_; + int flags_; +}; + + class HGlobalObject: public HUnaryOperation { public: explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { @@ -1983,7 +2015,8 @@ class HLoadExternalArrayPointer: public HUnaryOperation { class HCheckMap: public HTemplateInstruction<2> { public: - HCheckMap(HValue* value, Handle<Map> map, + HCheckMap(HValue* value, + Handle<Map> map, HValue* typecheck = NULL, CompareMapMode mode = REQUIRE_EXACT_MAP) : map_(map), @@ -3786,7 +3819,12 @@ class HLoadFunctionPrototype: public HUnaryOperation { class HLoadKeyedFastElement: public HTemplateInstruction<2> { public: - HLoadKeyedFastElement(HValue* obj, HValue* key) { + enum HoleCheckMode { PERFORM_HOLE_CHECK, OMIT_HOLE_CHECK }; + + HLoadKeyedFastElement(HValue* obj, + HValue* key, + HoleCheckMode hole_check_mode = PERFORM_HOLE_CHECK) + : hole_check_mode_(hole_check_mode) { SetOperandAt(0, obj); SetOperandAt(1, key); set_representation(Representation::Tagged()); @@ -3811,7 +3849,14 @@ class HLoadKeyedFastElement: public HTemplateInstruction<2> { DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) protected: - virtual bool DataEquals(HValue* other) { return true; } + virtual bool DataEquals(HValue* other) { + if (!other->IsLoadKeyedFastElement()) return false; + HLoadKeyedFastElement* other_load = HLoadKeyedFastElement::cast(other); + return hole_check_mode_ == other_load->hole_check_mode_; + } + + private: + HoleCheckMode hole_check_mode_; }; @@ -3915,6 +3960,8 @@ class HLoadKeyedGeneric: public HTemplateInstruction<3> { return Representation::Tagged(); } + virtual HValue* Canonicalize(); + DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) }; @@ -4163,17 +4210,8 @@ class HTransitionElementsKind: public HTemplateInstruction<1> { transitioned_map_(transitioned_map) { SetOperandAt(0, object); SetFlag(kUseGVN); - SetGVNFlag(kDependsOnMaps); SetGVNFlag(kChangesElementsKind); - if (original_map->has_fast_double_elements()) { - SetGVNFlag(kChangesElementsPointer); - SetGVNFlag(kDependsOnElementsPointer); - SetGVNFlag(kDependsOnDoubleArrayElements); - } else if (transitioned_map->has_fast_double_elements()) { - SetGVNFlag(kChangesElementsPointer); - SetGVNFlag(kDependsOnElementsPointer); - SetGVNFlag(kDependsOnArrayElements); - } + SetGVNFlag(kChangesElementsPointer); set_representation(Representation::Tagged()); } @@ -4329,6 +4367,41 @@ class HMaterializedLiteral: public HTemplateInstruction<V> { }; +class HFastLiteral: public HMaterializedLiteral<1> { + public: + HFastLiteral(HValue* context, + Handle<JSObject> boilerplate, + int total_size, + int literal_index, + int depth) + : HMaterializedLiteral<1>(literal_index, depth), + boilerplate_(boilerplate), + total_size_(total_size) { + SetOperandAt(0, context); + } + + // Maximum depth and total number of elements and properties for literal + // graphs to be considered for fast deep-copying. + static const int kMaxLiteralDepth = 3; + static const int kMaxLiteralProperties = 8; + + HValue* context() { return OperandAt(0); } + Handle<JSObject> boilerplate() const { return boilerplate_; } + int total_size() const { return total_size_; } + + virtual Representation RequiredInputRepresentation(int index) { + return Representation::Tagged(); + } + virtual HType CalculateInferredType(); + + DECLARE_CONCRETE_INSTRUCTION(FastLiteral) + + private: + Handle<JSObject> boilerplate_; + int total_size_; +}; + + class HArrayLiteral: public HMaterializedLiteral<1> { public: HArrayLiteral(HValue* context, @@ -4367,49 +4440,14 @@ class HArrayLiteral: public HMaterializedLiteral<1> { }; -class HObjectLiteralFast: public HMaterializedLiteral<1> { - public: - HObjectLiteralFast(HValue* context, - Handle<JSObject> boilerplate, - int total_size, - int literal_index, - int depth) - : HMaterializedLiteral<1>(literal_index, depth), - boilerplate_(boilerplate), - total_size_(total_size) { - SetOperandAt(0, context); - } - - // Maximum depth and total number of properties for object literal - // graphs to be considered for fast deep-copying. - static const int kMaxObjectLiteralDepth = 3; - static const int kMaxObjectLiteralProperties = 8; - - HValue* context() { return OperandAt(0); } - Handle<JSObject> boilerplate() const { return boilerplate_; } - int total_size() const { return total_size_; } - - virtual Representation RequiredInputRepresentation(int index) { - return Representation::Tagged(); - } - virtual HType CalculateInferredType(); - - DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralFast) - - private: - Handle<JSObject> boilerplate_; - int total_size_; -}; - - -class HObjectLiteralGeneric: public HMaterializedLiteral<1> { +class HObjectLiteral: public HMaterializedLiteral<1> { public: - HObjectLiteralGeneric(HValue* context, - Handle<FixedArray> constant_properties, - bool fast_elements, - int literal_index, - int depth, - bool has_function) + HObjectLiteral(HValue* context, + Handle<FixedArray> constant_properties, + bool fast_elements, + int literal_index, + int depth, + bool has_function) : HMaterializedLiteral<1>(literal_index, depth), constant_properties_(constant_properties), fast_elements_(fast_elements), @@ -4429,7 +4467,7 @@ class HObjectLiteralGeneric: public HMaterializedLiteral<1> { } virtual HType CalculateInferredType(); - DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralGeneric) + DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) private: Handle<FixedArray> constant_properties_; @@ -4524,7 +4562,7 @@ class HToFastProperties: public HUnaryOperation { // This instruction is not marked as having side effects, but // changes the map of the input operand. Use it only when creating // object literals. - ASSERT(value->IsObjectLiteralGeneric() || value->IsObjectLiteralFast()); + ASSERT(value->IsObjectLiteral() || value->IsFastLiteral()); set_representation(Representation::Tagged()); } @@ -4598,6 +4636,134 @@ class HIn: public HTemplateInstruction<3> { DECLARE_CONCRETE_INSTRUCTION(In) }; + +class HCheckMapValue: public HTemplateInstruction<2> { + public: + HCheckMapValue(HValue* value, + HValue* map) { + SetOperandAt(0, value); + SetOperandAt(1, map); + set_representation(Representation::Tagged()); + SetFlag(kUseGVN); + SetGVNFlag(kDependsOnMaps); + SetGVNFlag(kDependsOnElementsKind); + } + + virtual Representation RequiredInputRepresentation(int index) { + return Representation::Tagged(); + } + + virtual void PrintDataTo(StringStream* stream); + + virtual HType CalculateInferredType() { + return HType::Tagged(); + } + + HValue* value() { return OperandAt(0); } + HValue* map() { return OperandAt(1); } + + DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) + + protected: + virtual bool DataEquals(HValue* other) { + return true; + } +}; + + +class HForInPrepareMap : public HTemplateInstruction<2> { + public: + HForInPrepareMap(HValue* context, + HValue* object) { + SetOperandAt(0, context); + SetOperandAt(1, object); + set_representation(Representation::Tagged()); + SetAllSideEffects(); + } + + virtual Representation RequiredInputRepresentation(int index) { + return Representation::Tagged(); + } + + HValue* context() { return OperandAt(0); } + HValue* enumerable() { return OperandAt(1); } + + virtual void PrintDataTo(StringStream* stream); + + virtual HType CalculateInferredType() { + return HType::Tagged(); + } + + DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); +}; + + +class HForInCacheArray : public HTemplateInstruction<2> { + public: + HForInCacheArray(HValue* enumerable, + HValue* keys, + int idx) : idx_(idx) { + SetOperandAt(0, enumerable); + SetOperandAt(1, keys); + set_representation(Representation::Tagged()); + } + + virtual Representation RequiredInputRepresentation(int index) { + return Representation::Tagged(); + } + + HValue* enumerable() { return OperandAt(0); } + HValue* map() { return OperandAt(1); } + int idx() { return idx_; } + + HForInCacheArray* index_cache() { + return index_cache_; + } + + void set_index_cache(HForInCacheArray* index_cache) { + index_cache_ = index_cache; + } + + virtual void PrintDataTo(StringStream* stream); + + virtual HType CalculateInferredType() { + return HType::Tagged(); + } + + DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); + + private: + int idx_; + HForInCacheArray* index_cache_; +}; + + +class HLoadFieldByIndex : public HTemplateInstruction<2> { + public: + HLoadFieldByIndex(HValue* object, + HValue* index) { + SetOperandAt(0, object); + SetOperandAt(1, index); + set_representation(Representation::Tagged()); + } + + virtual Representation RequiredInputRepresentation(int index) { + return Representation::Tagged(); + } + + HValue* object() { return OperandAt(0); } + HValue* index() { return OperandAt(1); } + + virtual void PrintDataTo(StringStream* stream); + + virtual HType CalculateInferredType() { + return HType::Tagged(); + } + + DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); +}; + + #undef DECLARE_INSTRUCTION #undef DECLARE_CONCRETE_INSTRUCTION |