Chromium Code Reviews| Index: src/interpreter/bytecode-generator.cc |
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
| index 2b9357144eac55bc94072230d6080db0fb275d60..538160ffce07b77d63b6d23b971ca858ad538e15 100644 |
| --- a/src/interpreter/bytecode-generator.cc |
| +++ b/src/interpreter/bytecode-generator.cc |
| @@ -757,22 +757,16 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) { |
| } |
| break; |
| case VariableLocation::LOOKUP: { |
| - DCHECK(IsDeclaredVariableMode(mode)); |
| + DCHECK_EQ(VAR, mode); |
| DCHECK(!hole_init); |
| - register_allocator()->PrepareForConsecutiveAllocations(3); |
| + register_allocator()->PrepareForConsecutiveAllocations(1); |
|
Michael Starzinger
2016/06/14 14:47:32
nit: For a single register, there is no need to pr
adamk
2016/06/14 14:59:43
Done.
|
| Register name = register_allocator()->NextConsecutiveRegister(); |
|
Michael Starzinger
2016/06/14 14:47:32
nit: This can be just register_allocator()->NewReg
adamk
2016/06/14 14:59:43
Done.
|
| - Register init_value = register_allocator()->NextConsecutiveRegister(); |
| - Register attributes = register_allocator()->NextConsecutiveRegister(); |
| - builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name); |
| - builder() |
| - ->LoadLiteral(Smi::FromInt(0)) |
| - .StoreAccumulatorInRegister(init_value); |
| builder() |
| - ->LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes())) |
| - .StoreAccumulatorInRegister(attributes) |
| - .CallRuntime(Runtime::kDeclareLookupSlot, name, 3); |
| + ->LoadLiteral(variable->name()) |
| + .StoreAccumulatorInRegister(name) |
| + .CallRuntime(Runtime::kDeclareEvalVar, name, 1); |
| break; |
| } |
| } |
| @@ -808,18 +802,14 @@ void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) { |
| break; |
| } |
| case VariableLocation::LOOKUP: { |
| - register_allocator()->PrepareForConsecutiveAllocations(3); |
| + register_allocator()->PrepareForConsecutiveAllocations(2); |
| Register name = register_allocator()->NextConsecutiveRegister(); |
| Register literal = register_allocator()->NextConsecutiveRegister(); |
| - Register attributes = register_allocator()->NextConsecutiveRegister(); |
| builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name); |
| VisitForAccumulatorValue(decl->fun()); |
| - builder() |
| - ->StoreAccumulatorInRegister(literal) |
| - .LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes())) |
| - .StoreAccumulatorInRegister(attributes) |
| - .CallRuntime(Runtime::kDeclareLookupSlot, name, 3); |
| + builder()->StoreAccumulatorInRegister(literal).CallRuntime( |
| + Runtime::kDeclareEvalFunction, name, 2); |
| } |
| } |
| } |