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

Unified Diff: src/code-stub-assembler.cc

Issue 2471033004: [ignition,modules] Introduce bytecodes for loading/storing module variables. (Closed)
Patch Set: More comments. 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/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 970dc4f54230a7f30747f82b016bf90b0f6e7a3c..4847366c3ef1f05be572b94de07c3c87d58a8a59 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -1276,6 +1276,27 @@ Node* CodeStubAssembler::LoadNativeContext(Node* context) {
return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX);
}
+Node* CodeStubAssembler::LoadModuleContext(Node* context) {
+ Variable var_context(this, MachineRepresentation::kTaggedPointer);
+ var_context.Bind(context);
+
+ Label loop_start(this, &var_context), loop_end(this);
+ Goto(&loop_start);
+ Bind(&loop_start);
+ {
+ Node* context_map = LoadMap(var_context.value());
+ Node* is_module_context =
+ WordEqual(context_map, LoadRoot(Heap::kModuleContextMapRootIndex));
+ GotoIf(is_module_context, &loop_end);
+
+ var_context.Bind(
+ LoadContextElement(var_context.value(), Context::PREVIOUS_INDEX));
+ Goto(&loop_start);
+ }
+ Bind(&loop_end);
+ return var_context.value();
+}
+
Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind,
Node* native_context) {
CSA_ASSERT(IsNativeContext(native_context));

Powered by Google App Engine
This is Rietveld 408576698