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

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

Issue 2471033004: [ignition,modules] Introduce bytecodes for loading/storing module variables. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('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 ad1356f31a119a128c587bcc3b87dc34b1ca8bdd..e557cd4518b0f3702adfbe5eba8bb6f7d5047b59 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -1865,11 +1865,8 @@ void BytecodeGenerator::BuildVariableLoad(Variable* variable,
break;
}
case VariableLocation::MODULE: {
- Register index = register_allocator()->NewRegister();
- builder()
- ->LoadLiteral(Smi::FromInt(variable->index()))
- .StoreAccumulatorInRegister(index)
- .CallRuntime(Runtime::kLoadModuleVariable, index);
+ int depth = execution_context()->ContextChainDepth(variable->scope());
+ builder()->LoadModuleVariable(variable->index(), depth);
if (hole_check_mode == HoleCheckMode::kRequired) {
BuildThrowIfHole(variable->name());
}
@@ -2037,18 +2034,16 @@ void BytecodeGenerator::BuildVariableAssignment(Variable* variable,
// assignments for them.
DCHECK(variable->IsExport());
- RegisterList args = register_allocator()->NewRegisterList(2);
- builder()
- ->StoreAccumulatorInRegister(args[1])
- .LoadLiteral(Smi::FromInt(variable->index()))
- .StoreAccumulatorInRegister(args[0]);
+ int depth = execution_context()->ContextChainDepth(variable->scope());
if (hole_check_mode == HoleCheckMode::kRequired) {
- builder()->CallRuntime(Runtime::kLoadModuleVariable, args[0]);
+ Register value_temp = register_allocator()->NewRegister();
+ builder()
+ ->StoreAccumulatorInRegister(value_temp)
+ .LoadModuleVariable(variable->index(), depth);
BuildHoleCheckForVariableAssignment(variable, op);
+ builder()->LoadAccumulatorWithRegister(value_temp);
}
- builder()
- ->CallRuntime(Runtime::kStoreModuleVariable, args)
- .LoadAccumulatorWithRegister(args[1]);
+ builder()->StoreModuleVariable(variable->index(), depth);
break;
}
}
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698