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.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 Node* dst_index = __ BytecodeOperandReg(1); | 209 Node* dst_index = __ BytecodeOperandReg(1); |
210 __ StoreRegister(src_value, dst_index); | 210 __ StoreRegister(src_value, dst_index); |
211 __ Dispatch(); | 211 __ Dispatch(); |
212 } | 212 } |
213 | 213 |
214 | 214 |
215 void Interpreter::DoLoadGlobal(Callable ic, | 215 void Interpreter::DoLoadGlobal(Callable ic, |
216 compiler::InterpreterAssembler* assembler) { | 216 compiler::InterpreterAssembler* assembler) { |
217 // Get the global object. | 217 // Get the global object. |
218 Node* context = __ GetContext(); | 218 Node* context = __ GetContext(); |
219 Node* native_context = | 219 Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); |
220 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | |
221 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); | |
222 | 220 |
223 // Load the global via the LoadIC. | 221 // Load the global via the LoadIC. |
224 Node* code_target = __ HeapConstant(ic.code()); | 222 Node* code_target = __ HeapConstant(ic.code()); |
225 Node* constant_index = __ BytecodeOperandIdx(0); | 223 Node* constant_index = __ BytecodeOperandIdx(0); |
226 Node* name = __ LoadConstantPoolEntry(constant_index); | 224 Node* name = __ LoadConstantPoolEntry(constant_index); |
227 Node* raw_slot = __ BytecodeOperandIdx(1); | 225 Node* raw_slot = __ BytecodeOperandIdx(1); |
228 Node* smi_slot = __ SmiTag(raw_slot); | 226 Node* smi_slot = __ SmiTag(raw_slot); |
229 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 227 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
230 Node* result = __ CallIC(ic.descriptor(), code_target, global, name, smi_slot, | 228 Node* result = __ CallIC(ic.descriptor(), code_target, global, name, smi_slot, |
231 type_feedback_vector); | 229 type_feedback_vector); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, | 323 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, |
326 STRICT, UNINITIALIZED); | 324 STRICT, UNINITIALIZED); |
327 DoLoadGlobal(ic, assembler); | 325 DoLoadGlobal(ic, assembler); |
328 } | 326 } |
329 | 327 |
330 | 328 |
331 void Interpreter::DoStoreGlobal(Callable ic, | 329 void Interpreter::DoStoreGlobal(Callable ic, |
332 compiler::InterpreterAssembler* assembler) { | 330 compiler::InterpreterAssembler* assembler) { |
333 // Get the global object. | 331 // Get the global object. |
334 Node* context = __ GetContext(); | 332 Node* context = __ GetContext(); |
335 Node* native_context = | 333 Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); |
336 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | |
337 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); | |
338 | 334 |
339 // Store the global via the StoreIC. | 335 // Store the global via the StoreIC. |
340 Node* code_target = __ HeapConstant(ic.code()); | 336 Node* code_target = __ HeapConstant(ic.code()); |
341 Node* constant_index = __ BytecodeOperandIdx(0); | 337 Node* constant_index = __ BytecodeOperandIdx(0); |
342 Node* name = __ LoadConstantPoolEntry(constant_index); | 338 Node* name = __ LoadConstantPoolEntry(constant_index); |
343 Node* value = __ GetAccumulator(); | 339 Node* value = __ GetAccumulator(); |
344 Node* raw_slot = __ BytecodeOperandIdx(1); | 340 Node* raw_slot = __ BytecodeOperandIdx(1); |
345 Node* smi_slot = __ SmiTag(raw_slot); | 341 Node* smi_slot = __ SmiTag(raw_slot); |
346 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 342 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
347 __ CallIC(ic.descriptor(), code_target, global, name, value, smi_slot, | 343 __ CallIC(ic.descriptor(), code_target, global, name, value, smi_slot, |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 // Call the JS runtime function that has the |context_index| with the receiver | 945 // Call the JS runtime function that has the |context_index| with the receiver |
950 // in register |receiver| and |arg_count| arguments in subsequent registers. | 946 // in register |receiver| and |arg_count| arguments in subsequent registers. |
951 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) { | 947 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) { |
952 Node* context_index = __ BytecodeOperandIdx(0); | 948 Node* context_index = __ BytecodeOperandIdx(0); |
953 Node* receiver_reg = __ BytecodeOperandReg(1); | 949 Node* receiver_reg = __ BytecodeOperandReg(1); |
954 Node* first_arg = __ RegisterLocation(receiver_reg); | 950 Node* first_arg = __ RegisterLocation(receiver_reg); |
955 Node* args_count = __ BytecodeOperandCount(2); | 951 Node* args_count = __ BytecodeOperandCount(2); |
956 | 952 |
957 // Get the function to call from the native context. | 953 // Get the function to call from the native context. |
958 Node* context = __ GetContext(); | 954 Node* context = __ GetContext(); |
| 955 Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); |
959 Node* native_context = | 956 Node* native_context = |
960 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | 957 __ LoadObjectField(global, JSGlobalObject::kNativeContextOffset); |
961 Node* function = __ LoadContextSlot(native_context, context_index); | 958 Node* function = __ LoadContextSlot(native_context, context_index); |
962 | 959 |
963 // Call the function. | 960 // Call the function. |
964 Node* result = __ CallJS(function, first_arg, args_count); | 961 Node* result = __ CallJS(function, first_arg, args_count); |
965 __ SetAccumulator(result); | 962 __ SetAccumulator(result); |
966 __ Dispatch(); | 963 __ Dispatch(); |
967 } | 964 } |
968 | 965 |
969 | 966 |
970 // New <constructor> <first_arg> <arg_count> | 967 // New <constructor> <first_arg> <arg_count> |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); | 1474 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); |
1478 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); | 1475 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); |
1479 __ SetAccumulator(result); | 1476 __ SetAccumulator(result); |
1480 __ Dispatch(); | 1477 __ Dispatch(); |
1481 } | 1478 } |
1482 | 1479 |
1483 | 1480 |
1484 } // namespace interpreter | 1481 } // namespace interpreter |
1485 } // namespace internal | 1482 } // namespace internal |
1486 } // namespace v8 | 1483 } // namespace v8 |
OLD | NEW |