Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 5d467949592e27fe050aa512655742801a897523..a03c55d7f3debdbdf64d3cc0c3db5d5811569678 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -121,7 +121,7 @@ class LChunkBuilder; |
V(IsStringAndBranch) \ |
V(IsSmiAndBranch) \ |
V(IsUndetectableAndBranch) \ |
- V(StringCompareAndBranch) \ |
+ V(StringCompareAndBranch) \ |
V(JSArrayLength) \ |
V(LeaveInlined) \ |
V(LoadContextSlot) \ |
@@ -139,7 +139,8 @@ class LChunkBuilder; |
V(LoadNamedGeneric) \ |
V(Mod) \ |
V(Mul) \ |
- V(ObjectLiteral) \ |
+ V(ObjectLiteralFast) \ |
+ V(ObjectLiteralGeneric) \ |
V(OsrEntry) \ |
V(OuterContext) \ |
V(Parameter) \ |
@@ -4195,14 +4196,49 @@ class HArrayLiteral: public HMaterializedLiteral<1> { |
}; |
-class HObjectLiteral: public HMaterializedLiteral<1> { |
+class HObjectLiteralFast: public HMaterializedLiteral<1> { |
public: |
- HObjectLiteral(HValue* context, |
- Handle<FixedArray> constant_properties, |
- bool fast_elements, |
- int literal_index, |
- int depth, |
- bool has_function) |
+ 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> { |
+ public: |
+ HObjectLiteralGeneric(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), |
@@ -4222,7 +4258,7 @@ class HObjectLiteral: public HMaterializedLiteral<1> { |
} |
virtual HType CalculateInferredType(); |
- DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) |
+ DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralGeneric) |
private: |
Handle<FixedArray> constant_properties_; |
@@ -4317,7 +4353,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->IsObjectLiteral()); |
+ ASSERT(value->IsObjectLiteralGeneric()); |
set_representation(Representation::Tagged()); |
} |