Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 0d01a5a08b9b37fa495684003baec4d061e96bfc..561cd50395740d974d5e19b1af69c1847ecd0dd6 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1888,14 +1888,23 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
for (; property_index < expr->properties()->length(); property_index++) { |
ObjectLiteral::Property* property = expr->properties()->at(property_index); |
+ if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { |
+ environment()->Push(literal); // Duplicate receiver. |
+ VisitForValue(property->value()); |
+ Node* value = environment()->Pop(); |
+ Node* receiver = environment()->Pop(); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); |
+ Node* call = NewNode(op, receiver, value); |
+ PrepareFrameState(call, BailoutId::None()); |
+ continue; |
+ } |
+ |
environment()->Push(literal); // Duplicate receiver. |
VisitForValue(property->key()); |
Node* name = BuildToName(environment()->Pop(), |
expr->GetIdForProperty(property_index)); |
environment()->Push(name); |
- // TODO(mstarzinger): For ObjectLiteral::Property::PROTOTYPE the key should |
- // not be on the operand stack while the value is being evaluated. Come up |
- // with a repro for this and fix it. Also find a nice way to do so. :) |
VisitForValue(property->value()); |
Node* value = environment()->Pop(); |
Node* key = environment()->Pop(); |
@@ -1913,13 +1922,9 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
PrepareFrameState(call, BailoutId::None()); |
break; |
} |
- case ObjectLiteral::Property::PROTOTYPE: { |
- const Operator* op = |
- javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); |
- Node* call = NewNode(op, receiver, value); |
- PrepareFrameState(call, BailoutId::None()); |
+ case ObjectLiteral::Property::PROTOTYPE: |
+ UNREACHABLE(); // Handled specially above. |
break; |
- } |
case ObjectLiteral::Property::GETTER: { |
Node* attr = jsgraph()->Constant(NONE); |
const Operator* op = javascript()->CallRuntime( |