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

Unified Diff: src/interpreter/interpreter-assembler.cc

Issue 2343633002: [interpreter] Add a fast path for dynamic local load (Closed)
Patch Set: Disable clang format for the new test Created 4 years, 3 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
Index: src/interpreter/interpreter-assembler.cc
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc
index 2ea7e85acd409946cf43e273c42c93d3b6c01b7e..7a75a9c7d06fde3812ffeb655374516982a54984 100644
--- a/src/interpreter/interpreter-assembler.cc
+++ b/src/interpreter/interpreter-assembler.cc
@@ -114,6 +114,41 @@ Node* InterpreterAssembler::GetContextAtDepth(Node* context, Node* depth) {
return cur_context.value();
}
+void InterpreterAssembler::GotoIfHasContextExtensionUpToDepth(Node* context,
+ Node* depth,
+ Label* target) {
+ Variable cur_context(this, MachineRepresentation::kTaggedPointer);
+ cur_context.Bind(context);
+
+ Variable cur_depth(this, MachineRepresentation::kWord32);
+ cur_depth.Bind(depth);
+
+ Variable* context_search_loop_variables[2] = {&cur_depth, &cur_context};
+ Label context_search(this, 2, context_search_loop_variables);
+
+ // Loop until the depth is 0.
+ Goto(&context_search);
+ Bind(&context_search);
+ {
+ // TODO(leszeks): We only need to do this check if the context had a sloppy
+ // eval, we could pass in a context chain bitmask to figure out which
+ // contexts actually need to be checked.
rmcilroy 2016/09/16 08:56:55 It would probably take as long to check the bitmap
Leszek Swirski 2016/09/16 10:46:54 I see your point, but it would e.g. make a big dif
+
+ Node* extension_slot =
+ LoadContextSlot(cur_context.value(), Context::EXTENSION_INDEX);
+
+ // Jump to the target if the extension slot is not a hole
+ GotoIf(Word32NotEqual(extension_slot, TheHoleConstant()), target);
+
+ cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
+ cur_context.Bind(
+ LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX));
+
+ GotoIf(Word32NotEqual(cur_depth.value(), Int32Constant(0)),
+ &context_search);
+ }
+}
+
Node* InterpreterAssembler::BytecodeOffset() {
return bytecode_offset_.value();
}

Powered by Google App Engine
This is Rietveld 408576698