Chromium Code Reviews| Index: src/interpreter/interpreter-assembler.cc |
| diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
| index 7d8250944586dab591ab688fbf879607c4658625..b6258280b2542b64df3a61db23c09498b80c432d 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. |
| + |
| + 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); |
|
Michael Starzinger
2016/09/16 12:31:59
Shouldn't this be WordNotEqual (full word on 64-bi
Leszek Swirski
2016/09/16 13:00:49
Thank you for catching this! It has probably saved
|
| + |
| + 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(); |
| } |