| 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/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 915 |
| 916 | 916 |
| 917 // DeletePropertySloppy | 917 // DeletePropertySloppy |
| 918 // | 918 // |
| 919 // Delete the property specified in the accumulator from the object | 919 // Delete the property specified in the accumulator from the object |
| 920 // referenced by the register operand following sloppy mode semantics. | 920 // referenced by the register operand following sloppy mode semantics. |
| 921 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) { | 921 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) { |
| 922 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler); | 922 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler); |
| 923 } | 923 } |
| 924 | 924 |
| 925 | 925 void Interpreter::DoJSCall(InterpreterAssembler* assembler, |
| 926 void Interpreter::DoJSCall(InterpreterAssembler* assembler) { | 926 TailCallMode tail_call_mode) { |
| 927 Node* function_reg = __ BytecodeOperandReg(0); | 927 Node* function_reg = __ BytecodeOperandReg(0); |
| 928 Node* function = __ LoadRegister(function_reg); | 928 Node* function = __ LoadRegister(function_reg); |
| 929 Node* receiver_reg = __ BytecodeOperandReg(1); | 929 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 930 Node* receiver_arg = __ RegisterLocation(receiver_reg); | 930 Node* receiver_arg = __ RegisterLocation(receiver_reg); |
| 931 Node* receiver_args_count = __ BytecodeOperandCount(2); | 931 Node* receiver_args_count = __ BytecodeOperandCount(2); |
| 932 Node* receiver_count = __ Int32Constant(1); | 932 Node* receiver_count = __ Int32Constant(1); |
| 933 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); | 933 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
| 934 Node* context = __ GetContext(); | 934 Node* context = __ GetContext(); |
| 935 // TODO(rmcilroy): Use the call type feedback slot to call via CallStub. | 935 // TODO(rmcilroy): Use the call type feedback slot to call via CallStub. |
| 936 Node* result = __ CallJS(function, context, receiver_arg, args_count); | 936 Node* result = |
| 937 __ CallJS(function, context, receiver_arg, args_count, tail_call_mode); |
| 937 __ SetAccumulator(result); | 938 __ SetAccumulator(result); |
| 938 __ Dispatch(); | 939 __ Dispatch(); |
| 939 } | 940 } |
| 940 | 941 |
| 941 | 942 |
| 942 // Call <callable> <receiver> <arg_count> | 943 // Call <callable> <receiver> <arg_count> |
| 943 // | 944 // |
| 944 // Call a JSfunction or Callable in |callable| with the |receiver| and | 945 // Call a JSfunction or Callable in |callable| with the |receiver| and |
| 945 // |arg_count| arguments in subsequent registers. | 946 // |arg_count| arguments in subsequent registers. |
| 946 void Interpreter::DoCall(InterpreterAssembler* assembler) { | 947 void Interpreter::DoCall(InterpreterAssembler* assembler) { |
| 947 DoJSCall(assembler); | 948 DoJSCall(assembler, TailCallMode::kDisallow); |
| 948 } | 949 } |
| 949 | 950 |
| 950 | 951 |
| 951 // CallWide <callable> <receiver> <arg_count> | 952 // CallWide <callable> <receiver> <arg_count> |
| 952 // | 953 // |
| 953 // Call a JSfunction or Callable in |callable| with the |receiver| and | 954 // Call a JSfunction or Callable in |callable| with the |receiver| and |
| 954 // |arg_count| arguments in subsequent registers. | 955 // |arg_count| arguments in subsequent registers. |
| 955 void Interpreter::DoCallWide(InterpreterAssembler* assembler) { | 956 void Interpreter::DoCallWide(InterpreterAssembler* assembler) { |
| 956 DoJSCall(assembler); | 957 DoJSCall(assembler, TailCallMode::kDisallow); |
| 958 } |
| 959 |
| 960 // TailCall <callable> <receiver> <arg_count> |
| 961 // |
| 962 // Tail call a JSfunction or Callable in |callable| with the |receiver| and |
| 963 // |arg_count| arguments in subsequent registers. |
| 964 void Interpreter::DoTailCall(InterpreterAssembler* assembler) { |
| 965 DoJSCall(assembler, TailCallMode::kAllow); |
| 966 } |
| 967 |
| 968 // TailCallWide <callable> <receiver> <arg_count> |
| 969 // |
| 970 // Tail call a JSfunction or Callable in |callable| with the |receiver| and |
| 971 // |arg_count| arguments in subsequent registers. |
| 972 void Interpreter::DoTailCallWide(InterpreterAssembler* assembler) { |
| 973 DoJSCall(assembler, TailCallMode::kAllow); |
| 957 } | 974 } |
| 958 | 975 |
| 959 void Interpreter::DoCallRuntimeCommon(InterpreterAssembler* assembler) { | 976 void Interpreter::DoCallRuntimeCommon(InterpreterAssembler* assembler) { |
| 960 Node* function_id = __ BytecodeOperandIdx(0); | 977 Node* function_id = __ BytecodeOperandIdx(0); |
| 961 Node* first_arg_reg = __ BytecodeOperandReg(1); | 978 Node* first_arg_reg = __ BytecodeOperandReg(1); |
| 962 Node* first_arg = __ RegisterLocation(first_arg_reg); | 979 Node* first_arg = __ RegisterLocation(first_arg_reg); |
| 963 Node* args_count = __ BytecodeOperandCount(2); | 980 Node* args_count = __ BytecodeOperandCount(2); |
| 964 Node* context = __ GetContext(); | 981 Node* context = __ GetContext(); |
| 965 Node* result = __ CallRuntimeN(function_id, context, first_arg, args_count); | 982 Node* result = __ CallRuntimeN(function_id, context, first_arg, args_count); |
| 966 __ SetAccumulator(result); | 983 __ SetAccumulator(result); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 Node* receiver_count = __ Int32Constant(1); | 1054 Node* receiver_count = __ Int32Constant(1); |
| 1038 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); | 1055 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
| 1039 | 1056 |
| 1040 // Get the function to call from the native context. | 1057 // Get the function to call from the native context. |
| 1041 Node* context = __ GetContext(); | 1058 Node* context = __ GetContext(); |
| 1042 Node* native_context = | 1059 Node* native_context = |
| 1043 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | 1060 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); |
| 1044 Node* function = __ LoadContextSlot(native_context, context_index); | 1061 Node* function = __ LoadContextSlot(native_context, context_index); |
| 1045 | 1062 |
| 1046 // Call the function. | 1063 // Call the function. |
| 1047 Node* result = __ CallJS(function, context, first_arg, args_count); | 1064 Node* result = __ CallJS(function, context, first_arg, args_count, |
| 1065 TailCallMode::kDisallow); |
| 1048 __ SetAccumulator(result); | 1066 __ SetAccumulator(result); |
| 1049 __ Dispatch(); | 1067 __ Dispatch(); |
| 1050 } | 1068 } |
| 1051 | 1069 |
| 1052 | 1070 |
| 1053 // CallJSRuntime <context_index> <receiver> <arg_count> | 1071 // CallJSRuntime <context_index> <receiver> <arg_count> |
| 1054 // | 1072 // |
| 1055 // Call the JS runtime function that has the |context_index| with the receiver | 1073 // Call the JS runtime function that has the |context_index| with the receiver |
| 1056 // in register |receiver| and |arg_count| arguments in subsequent registers. | 1074 // in register |receiver| and |arg_count| arguments in subsequent registers. |
| 1057 void Interpreter::DoCallJSRuntime(InterpreterAssembler* assembler) { | 1075 void Interpreter::DoCallJSRuntime(InterpreterAssembler* assembler) { |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 Node* index = __ LoadRegister(index_reg); | 1811 Node* index = __ LoadRegister(index_reg); |
| 1794 Node* context = __ GetContext(); | 1812 Node* context = __ GetContext(); |
| 1795 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1813 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); |
| 1796 __ SetAccumulator(result); | 1814 __ SetAccumulator(result); |
| 1797 __ Dispatch(); | 1815 __ Dispatch(); |
| 1798 } | 1816 } |
| 1799 | 1817 |
| 1800 } // namespace interpreter | 1818 } // namespace interpreter |
| 1801 } // namespace internal | 1819 } // namespace internal |
| 1802 } // namespace v8 | 1820 } // namespace v8 |
| OLD | NEW |