Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/interpreter/interpreter-assembler.h" | 5 #include "src/interpreter/interpreter-assembler.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 } | 77 } |
| 78 | 78 |
| 79 Node* InterpreterAssembler::GetContext() { | 79 Node* InterpreterAssembler::GetContext() { |
| 80 return LoadRegister(Register::current_context()); | 80 return LoadRegister(Register::current_context()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void InterpreterAssembler::SetContext(Node* value) { | 83 void InterpreterAssembler::SetContext(Node* value) { |
| 84 StoreRegister(value, Register::current_context()); | 84 StoreRegister(value, Register::current_context()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 Node* InterpreterAssembler::GetContextAtDepth(Node* root_context, Node* depth) { | |
|
Michael Starzinger
2016/09/13 09:53:08
nit: Likewise about "root_context" vs "context" he
Leszek Swirski
2016/09/13 10:17:51
Done.
| |
| 88 Variable context(this, MachineRepresentation::kTaggedPointer); | |
| 89 context.Bind(root_context); | |
| 90 | |
| 91 Variable cur_depth(this, MachineRepresentation::kWord32); | |
| 92 cur_depth.Bind(depth); | |
| 93 | |
| 94 Label context_found(this); | |
| 95 | |
| 96 Variable* context_search_loop_variables[2] = {&cur_depth, &context}; | |
| 97 Label context_search(this, 2, context_search_loop_variables); | |
| 98 | |
| 99 // Fast path if the depth is 0. | |
| 100 BranchIfWord32Equal(depth, Int32Constant(0), &context_found, &context_search); | |
| 101 | |
| 102 // Loop until the depth is 0. | |
| 103 Bind(&context_search); | |
| 104 { | |
| 105 cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1))); | |
| 106 context.Bind(LoadContextSlot(context.value(), Context::PREVIOUS_INDEX)); | |
| 107 | |
| 108 BranchIfWord32Equal(cur_depth.value(), Int32Constant(0), &context_found, | |
| 109 &context_search); | |
| 110 } | |
| 111 | |
| 112 Bind(&context_found); | |
| 113 return context.value(); | |
| 114 } | |
| 115 | |
| 87 Node* InterpreterAssembler::BytecodeOffset() { | 116 Node* InterpreterAssembler::BytecodeOffset() { |
| 88 return bytecode_offset_.value(); | 117 return bytecode_offset_.value(); |
| 89 } | 118 } |
| 90 | 119 |
| 91 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { | 120 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { |
| 92 if (made_call_) { | 121 if (made_call_) { |
| 93 // If we have made a call, restore bytecode array from stack frame in case | 122 // If we have made a call, restore bytecode array from stack frame in case |
| 94 // the debugger has swapped us to the patched debugger bytecode array. | 123 // the debugger has swapped us to the patched debugger bytecode array. |
| 95 return LoadRegister(Register::bytecode_array()); | 124 return LoadRegister(Register::bytecode_array()); |
| 96 } else { | 125 } else { |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1324 Goto(&loop); | 1353 Goto(&loop); |
| 1325 } | 1354 } |
| 1326 Bind(&done_loop); | 1355 Bind(&done_loop); |
| 1327 | 1356 |
| 1328 return array; | 1357 return array; |
| 1329 } | 1358 } |
| 1330 | 1359 |
| 1331 } // namespace interpreter | 1360 } // namespace interpreter |
| 1332 } // namespace internal | 1361 } // namespace internal |
| 1333 } // namespace v8 | 1362 } // namespace v8 |
| OLD | NEW |