Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 6c7ca344cb323cfee4dc49397e6c271f4be17917..ca50c3a1b4a8e48cb94c66ed12ccdc9c13672a9b 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -1419,12 +1419,14 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
continue; |
} |
- register_allocator()->PrepareForConsecutiveAllocations(4); |
+ register_allocator()->PrepareForConsecutiveAllocations(5); |
Register literal_argument = register_allocator()->NextConsecutiveRegister(); |
Register key = register_allocator()->NextConsecutiveRegister(); |
Register value = register_allocator()->NextConsecutiveRegister(); |
Register attr = register_allocator()->NextConsecutiveRegister(); |
DCHECK(Register::AreContiguous(literal_argument, key, value, attr)); |
+ Register set_function_name = |
+ register_allocator()->NextConsecutiveRegister(); |
builder()->MoveRegister(literal, literal_argument); |
VisitForAccumulatorValue(property->key()); |
@@ -1433,24 +1435,28 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
builder()->StoreAccumulatorInRegister(value); |
VisitSetHomeObject(value, literal, property); |
builder()->LoadLiteral(Smi::FromInt(NONE)).StoreAccumulatorInRegister(attr); |
- Runtime::FunctionId function_id = static_cast<Runtime::FunctionId>(-1); |
switch (property->kind()) { |
case ObjectLiteral::Property::CONSTANT: |
case ObjectLiteral::Property::COMPUTED: |
case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
- function_id = Runtime::kDefineDataPropertyUnchecked; |
+ builder() |
+ ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) |
+ .StoreAccumulatorInRegister(set_function_name); |
+ builder()->CallRuntime(Runtime::kDefineDataPropertyInLiteral, |
+ literal_argument, 5); |
break; |
case ObjectLiteral::Property::PROTOTYPE: |
UNREACHABLE(); // Handled specially above. |
break; |
case ObjectLiteral::Property::GETTER: |
- function_id = Runtime::kDefineGetterPropertyUnchecked; |
+ builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, |
+ literal_argument, 4); |
break; |
case ObjectLiteral::Property::SETTER: |
- function_id = Runtime::kDefineSetterPropertyUnchecked; |
+ builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, |
+ literal_argument, 4); |
break; |
} |
- builder()->CallRuntime(function_id, literal_argument, 4); |
} |
// Transform literals that contain functions to fast properties. |