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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 Node* function_id = __ BytecodeOperandIdx(0); | 859 Node* function_id = __ BytecodeOperandIdx(0); |
860 Node* first_arg_reg = __ BytecodeOperandReg(1); | 860 Node* first_arg_reg = __ BytecodeOperandReg(1); |
861 Node* first_arg = __ RegisterLocation(first_arg_reg); | 861 Node* first_arg = __ RegisterLocation(first_arg_reg); |
862 Node* args_count = __ BytecodeOperandCount(2); | 862 Node* args_count = __ BytecodeOperandCount(2); |
863 Node* result = __ CallRuntime(function_id, first_arg, args_count); | 863 Node* result = __ CallRuntime(function_id, first_arg, args_count); |
864 __ SetAccumulator(result); | 864 __ SetAccumulator(result); |
865 __ Dispatch(); | 865 __ Dispatch(); |
866 } | 866 } |
867 | 867 |
868 | 868 |
| 869 // CallJSRuntime <context_index> <receiver> <arg_count> |
| 870 // |
| 871 // Call the JS runtime function that has the |context_index| with the receiver |
| 872 // in register |receiver| and |arg_count| arguments in subsequent registers. |
| 873 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) { |
| 874 Node* context_index = __ BytecodeOperandIdx(0); |
| 875 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 876 Node* first_arg = __ RegisterLocation(receiver_reg); |
| 877 Node* args_count = __ BytecodeOperandCount(2); |
| 878 |
| 879 // Get the function to call from the native context. |
| 880 Node* context = __ GetContext(); |
| 881 Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); |
| 882 Node* native_context = |
| 883 __ LoadObjectField(global, GlobalObject::kNativeContextOffset); |
| 884 Node* function = __ LoadContextSlot(native_context, context_index); |
| 885 |
| 886 // Call the function. |
| 887 Node* result = __ CallJS(function, first_arg, args_count); |
| 888 __ SetAccumulator(result); |
| 889 __ Dispatch(); |
| 890 } |
| 891 |
| 892 |
869 // New <constructor> <arg_count> | 893 // New <constructor> <arg_count> |
870 // | 894 // |
871 // Call operator new with |constructor| and the first argument in | 895 // Call operator new with |constructor| and the first argument in |
872 // register |first_arg| and |arg_count| arguments in subsequent | 896 // register |first_arg| and |arg_count| arguments in subsequent |
873 // | 897 // |
874 void Interpreter::DoNew(compiler::InterpreterAssembler* assembler) { | 898 void Interpreter::DoNew(compiler::InterpreterAssembler* assembler) { |
875 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); | 899 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); |
876 Node* constructor_reg = __ BytecodeOperandReg(0); | 900 Node* constructor_reg = __ BytecodeOperandReg(0); |
877 Node* constructor = __ LoadRegister(constructor_reg); | 901 Node* constructor = __ LoadRegister(constructor_reg); |
878 Node* first_arg_reg = __ BytecodeOperandReg(1); | 902 Node* first_arg_reg = __ BytecodeOperandReg(1); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); | 1402 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); |
1379 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); | 1403 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); |
1380 __ SetAccumulator(result); | 1404 __ SetAccumulator(result); |
1381 __ Dispatch(); | 1405 __ Dispatch(); |
1382 } | 1406 } |
1383 | 1407 |
1384 | 1408 |
1385 } // namespace interpreter | 1409 } // namespace interpreter |
1386 } // namespace internal | 1410 } // namespace internal |
1387 } // namespace v8 | 1411 } // namespace v8 |
OLD | NEW |