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