Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 73eee32fcb5aa7b66458639ab91fc363721c0b29..2706741206016526ca7d4acc06d3c38ed6f7df44 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -563,9 +563,27 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) { |
variable->index()); |
} |
break; |
- case VariableLocation::LOOKUP: |
- UNIMPLEMENTED(); |
+ case VariableLocation::LOOKUP: { |
+ TemporaryRegisterScope temporary_register_scope(builder()); |
rmcilroy
2016/01/14 11:21:12
Please don't use TemporaryRegisterScope (it is goi
mythria
2016/01/15 11:27:04
Done.
|
+ temporary_register_scope.PrepareForConsecutiveAllocations(3); |
+ DCHECK(IsDeclaredVariableMode(mode)); |
rmcilroy
2016/01/14 11:21:12
nit - move to the top of the case
mythria
2016/01/15 11:27:04
Done.
|
+ Register name = temporary_register_scope.NextConsecutiveRegister(); |
+ Register init_value = temporary_register_scope.NextConsecutiveRegister(); |
+ Register attributes = temporary_register_scope.NextConsecutiveRegister(); |
+ builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name); |
rmcilroy
2016/01/14 11:21:12
nit - newline abovem, and newline between LoadLite
mythria
2016/01/15 11:27:04
I am not sure, I understood this correctly. cl for
|
+ if (hole_init) { |
+ builder()->LoadTheHole().StoreAccumulatorInRegister(init_value); |
rmcilroy
2016/01/14 11:21:12
ditto
|
+ } else { |
+ builder() |
+ ->LoadLiteral(Smi::FromInt(0)) |
rmcilroy
2016/01/14 11:21:12
Add comment that this indicates no initial value a
mythria
2016/01/15 11:27:04
Done.
|
+ .StoreAccumulatorInRegister(init_value); |
+ } |
+ builder() |
+ ->LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes())) |
+ .StoreAccumulatorInRegister(attributes); |
+ builder()->CallRuntime(Runtime::kDeclareLookupSlot, name, 3); |
rmcilroy
2016/01/14 11:21:12
nit - no need for builder() here
mythria
2016/01/15 11:27:04
Done.
|
break; |
+ } |
} |
} |
@@ -596,8 +614,20 @@ void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) { |
variable->index()); |
break; |
} |
- case VariableLocation::LOOKUP: |
- UNIMPLEMENTED(); |
+ case VariableLocation::LOOKUP: { |
+ TemporaryRegisterScope temporary_register_scope(builder()); |
+ temporary_register_scope.PrepareForConsecutiveAllocations(3); |
+ Register name = temporary_register_scope.NextConsecutiveRegister(); |
+ Register literal = temporary_register_scope.NextConsecutiveRegister(); |
+ Register attributes = temporary_register_scope.NextConsecutiveRegister(); |
+ builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name); |
rmcilroy
2016/01/14 11:21:12
newline
mythria
2016/01/15 11:27:04
Done.
|
+ VisitForAccumulatorValue(decl->fun()); |
+ builder()->StoreAccumulatorInRegister(literal); |
+ builder() |
+ ->LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes())) |
+ .StoreAccumulatorInRegister(attributes); |
+ builder()->CallRuntime(Runtime::kDeclareLookupSlot, name, 3); |
rmcilroy
2016/01/14 11:21:12
only one builder() for these 5 lines
mythria
2016/01/15 11:27:04
Done.
|
+ } |
} |
} |
@@ -1409,6 +1439,8 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable, |
break; |
} |
case VariableLocation::LOOKUP: { |
+ // TODO(mythria): Use Runtime::kInitializeLegacyConstLookupSlot for |
+ // initializations of const declarations. |
mythria
2016/01/13 17:27:21
This is not related to this cl. I should have adde
|
builder()->StoreLookupSlot(variable->name(), language_mode()); |
break; |
} |