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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 922 |
923 | 923 |
924 // DeletePropertySloppy | 924 // DeletePropertySloppy |
925 // | 925 // |
926 // Delete the property specified in the accumulator from the object | 926 // Delete the property specified in the accumulator from the object |
927 // referenced by the register operand following sloppy mode semantics. | 927 // referenced by the register operand following sloppy mode semantics. |
928 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) { | 928 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) { |
929 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler); | 929 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler); |
930 } | 930 } |
931 | 931 |
| 932 void Interpreter::DoJSCallWithFeedback(InterpreterAssembler* assembler, |
| 933 TailCallMode tail_call_mode) { |
| 934 Node* function_reg = __ BytecodeOperandReg(0); |
| 935 Node* function = __ LoadRegister(function_reg); |
| 936 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 937 Node* receiver_arg = __ RegisterLocation(receiver_reg); |
| 938 Node* receiver_args_count = __ BytecodeOperandCount(2); |
| 939 Node* receiver_count = __ Int32Constant(1); |
| 940 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
| 941 Node* slot_id_raw = __ BytecodeOperandIdx(3); |
| 942 Node* slot_id = __ SmiTag(slot_id_raw); |
| 943 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 944 Node* context = __ GetContext(); |
| 945 Node* result = |
| 946 __ CallJSWithFeedback(function, context, receiver_arg, args_count, |
| 947 slot_id, type_feedback_vector, tail_call_mode); |
| 948 __ SetAccumulator(result); |
| 949 __ Dispatch(); |
| 950 } |
| 951 |
| 952 // Call <callable> <receiver> <arg_count> |
| 953 // |
| 954 // Call a JSfunction or Callable in |callable| with the |receiver| and |
| 955 // |arg_count| arguments in subsequent registers. |
| 956 void Interpreter::DoCallIC(InterpreterAssembler* assembler) { |
| 957 DoJSCallWithFeedback(assembler, TailCallMode::kDisallow); |
| 958 } |
| 959 |
| 960 // CallWide <callable> <receiver> <arg_count> |
| 961 // |
| 962 // Call a JSfunction or Callable in |callable| with the |receiver| and |
| 963 // |arg_count| arguments in subsequent registers. |
| 964 void Interpreter::DoCallICWide(InterpreterAssembler* assembler) { |
| 965 DoJSCallWithFeedback(assembler, TailCallMode::kDisallow); |
| 966 } |
| 967 |
| 968 // Call <callable> <receiver> <arg_count> |
| 969 // |
| 970 // Call a JSfunction or Callable in |callable| with the |receiver| and |
| 971 // |arg_count| arguments in subsequent registers. |
| 972 void Interpreter::DoTailCallIC(InterpreterAssembler* assembler) { |
| 973 DoJSCallWithFeedback(assembler, TailCallMode::kAllow); |
| 974 } |
| 975 |
| 976 // CallWide <callable> <receiver> <arg_count> |
| 977 // |
| 978 // Call a JSfunction or Callable in |callable| with the |receiver| and |
| 979 // |arg_count| arguments in subsequent registers. |
| 980 void Interpreter::DoTailCallICWide(InterpreterAssembler* assembler) { |
| 981 DoJSCallWithFeedback(assembler, TailCallMode::kAllow); |
| 982 } |
| 983 |
932 void Interpreter::DoJSCall(InterpreterAssembler* assembler, | 984 void Interpreter::DoJSCall(InterpreterAssembler* assembler, |
933 TailCallMode tail_call_mode) { | 985 TailCallMode tail_call_mode) { |
934 Node* function_reg = __ BytecodeOperandReg(0); | 986 Node* function_reg = __ BytecodeOperandReg(0); |
935 Node* function = __ LoadRegister(function_reg); | 987 Node* function = __ LoadRegister(function_reg); |
936 Node* receiver_reg = __ BytecodeOperandReg(1); | 988 Node* receiver_reg = __ BytecodeOperandReg(1); |
937 Node* receiver_arg = __ RegisterLocation(receiver_reg); | 989 Node* receiver_arg = __ RegisterLocation(receiver_reg); |
938 Node* receiver_args_count = __ BytecodeOperandCount(2); | 990 Node* receiver_args_count = __ BytecodeOperandCount(2); |
939 Node* receiver_count = __ Int32Constant(1); | 991 Node* receiver_count = __ Int32Constant(1); |
940 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); | 992 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
941 Node* context = __ GetContext(); | 993 Node* context = __ GetContext(); |
942 // TODO(rmcilroy): Use the call type feedback slot to call via CallStub. | |
943 Node* result = | 994 Node* result = |
944 __ CallJS(function, context, receiver_arg, args_count, tail_call_mode); | 995 __ CallJS(function, context, receiver_arg, args_count, tail_call_mode); |
945 __ SetAccumulator(result); | 996 __ SetAccumulator(result); |
946 __ Dispatch(); | 997 __ Dispatch(); |
947 } | 998 } |
948 | 999 |
949 | 1000 |
950 // Call <callable> <receiver> <arg_count> | 1001 // Call <callable> <receiver> <arg_count> |
951 // | 1002 // |
952 // Call a JSfunction or Callable in |callable| with the |receiver| and | 1003 // Call a JSfunction or Callable in |callable| with the |receiver| and |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 Node* index = __ LoadRegister(index_reg); | 1869 Node* index = __ LoadRegister(index_reg); |
1819 Node* context = __ GetContext(); | 1870 Node* context = __ GetContext(); |
1820 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1871 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); |
1821 __ SetAccumulator(result); | 1872 __ SetAccumulator(result); |
1822 __ Dispatch(); | 1873 __ Dispatch(); |
1823 } | 1874 } |
1824 | 1875 |
1825 } // namespace interpreter | 1876 } // namespace interpreter |
1826 } // namespace internal | 1877 } // namespace internal |
1827 } // namespace v8 | 1878 } // namespace v8 |
OLD | NEW |