Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 2107193002: [ic] Initialize feedback slots for LoadGlobalIC in Runtime::kDeclareGlobals when possible to ... (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing on top of Issue 2127583002 Patch 120001 Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698