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

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

Issue 2471033004: [ignition,modules] Introduce bytecodes for loading/storing module variables. (Closed)
Patch Set: Address other feedback. 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
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index ee60421e58efe54c584150757af1f11e0fa4945d..f0c4e55c8472bc50da891d66afa6a6e587e79102 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -1866,11 +1866,7 @@ 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);
+ builder()->LoadModuleVariable(variable->index());
if (hole_check_mode == HoleCheckMode::kRequired) {
BuildThrowIfHole(variable->name());
}
@@ -2038,18 +2034,15 @@ 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]);
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());
BuildHoleCheckForVariableAssignment(variable, op);
+ builder()->LoadAccumulatorWithRegister(value_temp);
}
- builder()
- ->CallRuntime(Runtime::kStoreModuleVariable, args)
- .LoadAccumulatorWithRegister(args[1]);
+ builder()->StoreModuleVariable(variable->index());
break;
}
}

Powered by Google App Engine
This is Rietveld 408576698