Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 6154a4ebfb533561515bfb1473709ff70ddcc848..de68fc974d4b2ea33a9cb9569f1e9289d202a66b 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -731,11 +731,14 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) { |
bool hole_init = mode == CONST || mode == LET; |
switch (variable->location()) { |
case VariableLocation::GLOBAL: |
- case VariableLocation::UNALLOCATED: |
+ case VariableLocation::UNALLOCATED: { |
DCHECK(!variable->binding_needs_init()); |
- globals()->push_back(variable->name()); |
+ FeedbackVectorSlot slot = decl->proxy()->VariableFeedbackSlot(); |
+ DCHECK(!slot.IsInvalid()); |
+ globals()->push_back(handle(Smi::FromInt(slot.ToInt()), isolate())); |
globals()->push_back(isolate()->factory()->undefined_value()); |
break; |
+ } |
case VariableLocation::LOCAL: |
if (hole_init) { |
Register destination(variable->index()); |
@@ -780,7 +783,9 @@ void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) { |
decl->fun(), info()->script(), info()); |
// Check for stack-overflow exception. |
if (function.is_null()) return SetStackOverflow(); |
- globals()->push_back(variable->name()); |
+ FeedbackVectorSlot slot = decl->proxy()->VariableFeedbackSlot(); |
+ DCHECK(!slot.IsInvalid()); |
+ globals()->push_back(handle(Smi::FromInt(slot.ToInt()), isolate())); |
globals()->push_back(function); |
break; |
} |
@@ -832,16 +837,21 @@ void BytecodeGenerator::VisitDeclarations( |
for (Handle<Object> obj : *globals()) data->set(array_index++, *obj); |
int encoded_flags = info()->GetDeclareGlobalsFlags(); |
- Register pairs = register_allocator()->NewRegister(); |
+ register_allocator()->PrepareForConsecutiveAllocations(3); |
+ |
+ Register pairs = register_allocator()->NextConsecutiveRegister(); |
builder()->LoadLiteral(data); |
builder()->StoreAccumulatorInRegister(pairs); |
- Register flags = register_allocator()->NewRegister(); |
+ Register flags = register_allocator()->NextConsecutiveRegister(); |
builder()->LoadLiteral(Smi::FromInt(encoded_flags)); |
builder()->StoreAccumulatorInRegister(flags); |
DCHECK(flags.index() == pairs.index() + 1); |
- builder()->CallRuntime(Runtime::kDeclareGlobals, pairs, 2); |
+ Register function = register_allocator()->NextConsecutiveRegister(); |
+ builder()->MoveRegister(Register::function_closure(), function); |
+ |
+ builder()->CallRuntime(Runtime::kDeclareGlobalsForInterpreter, pairs, 3); |
globals()->clear(); |
} |