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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 Node* function_id = __ BytecodeOperandIdx(0); | 907 Node* function_id = __ BytecodeOperandIdx(0); |
908 Node* first_arg_reg = __ BytecodeOperandReg(1); | 908 Node* first_arg_reg = __ BytecodeOperandReg(1); |
909 Node* first_arg = __ RegisterLocation(first_arg_reg); | 909 Node* first_arg = __ RegisterLocation(first_arg_reg); |
910 Node* args_count = __ BytecodeOperandCount(2); | 910 Node* args_count = __ BytecodeOperandCount(2); |
911 Node* result = __ CallRuntime(function_id, first_arg, args_count); | 911 Node* result = __ CallRuntime(function_id, first_arg, args_count); |
912 __ SetAccumulator(result); | 912 __ SetAccumulator(result); |
913 __ Dispatch(); | 913 __ Dispatch(); |
914 } | 914 } |
915 | 915 |
916 | 916 |
| 917 // CallJSRuntime <context_index> <receiver> <arg_count> |
| 918 // |
| 919 // Call the JS runtime function that has the |context_index| with the receiver |
| 920 // in register |receiver| and |arg_count| arguments in subsequent registers. |
| 921 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) { |
| 922 Node* context_index = __ BytecodeOperandIdx(0); |
| 923 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 924 Node* first_arg = __ RegisterLocation(receiver_reg); |
| 925 Node* args_count = __ BytecodeOperandCount(2); |
| 926 |
| 927 // Get the function to call from the native context. |
| 928 Node* context = __ GetContext(); |
| 929 Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); |
| 930 Node* native_context = |
| 931 __ LoadObjectField(global, JSGlobalObject::kNativeContextOffset); |
| 932 Node* function = __ LoadContextSlot(native_context, context_index); |
| 933 |
| 934 // Call the function. |
| 935 Node* result = __ CallJS(function, first_arg, args_count); |
| 936 __ SetAccumulator(result); |
| 937 __ Dispatch(); |
| 938 } |
| 939 |
| 940 |
917 // New <constructor> <arg_count> | 941 // New <constructor> <arg_count> |
918 // | 942 // |
919 // Call operator new with |constructor| and the first argument in | 943 // Call operator new with |constructor| and the first argument in |
920 // register |first_arg| and |arg_count| arguments in subsequent | 944 // register |first_arg| and |arg_count| arguments in subsequent |
921 // | 945 // |
922 void Interpreter::DoNew(compiler::InterpreterAssembler* assembler) { | 946 void Interpreter::DoNew(compiler::InterpreterAssembler* assembler) { |
923 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); | 947 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); |
924 Node* constructor_reg = __ BytecodeOperandReg(0); | 948 Node* constructor_reg = __ BytecodeOperandReg(0); |
925 Node* constructor = __ LoadRegister(constructor_reg); | 949 Node* constructor = __ LoadRegister(constructor_reg); |
926 Node* first_arg_reg = __ BytecodeOperandReg(1); | 950 Node* first_arg_reg = __ BytecodeOperandReg(1); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); | 1450 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); |
1427 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); | 1451 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); |
1428 __ SetAccumulator(result); | 1452 __ SetAccumulator(result); |
1429 __ Dispatch(); | 1453 __ Dispatch(); |
1430 } | 1454 } |
1431 | 1455 |
1432 | 1456 |
1433 } // namespace interpreter | 1457 } // namespace interpreter |
1434 } // namespace internal | 1458 } // namespace internal |
1435 } // namespace v8 | 1459 } // namespace v8 |
OLD | NEW |