Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1698273003: [es6] [interpreter] Add tail calls support to Ignition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-turbo-2
Patch Set: Decreased number of iterations to fix timeouts Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 1012
1013 1013
1014 // DeletePropertySloppy 1014 // DeletePropertySloppy
1015 // 1015 //
1016 // Delete the property specified in the accumulator from the object 1016 // Delete the property specified in the accumulator from the object
1017 // referenced by the register operand following sloppy mode semantics. 1017 // referenced by the register operand following sloppy mode semantics.
1018 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) { 1018 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) {
1019 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler); 1019 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler);
1020 } 1020 }
1021 1021
1022 1022 void Interpreter::DoJSCall(InterpreterAssembler* assembler,
1023 void Interpreter::DoJSCall(InterpreterAssembler* assembler) { 1023 TailCallMode tail_call_mode) {
1024 Node* function_reg = __ BytecodeOperandReg(0); 1024 Node* function_reg = __ BytecodeOperandReg(0);
1025 Node* function = __ LoadRegister(function_reg); 1025 Node* function = __ LoadRegister(function_reg);
1026 Node* receiver_reg = __ BytecodeOperandReg(1); 1026 Node* receiver_reg = __ BytecodeOperandReg(1);
1027 Node* receiver_arg = __ RegisterLocation(receiver_reg); 1027 Node* receiver_arg = __ RegisterLocation(receiver_reg);
1028 Node* receiver_args_count = __ BytecodeOperandCount(2); 1028 Node* receiver_args_count = __ BytecodeOperandCount(2);
1029 Node* receiver_count = __ Int32Constant(1); 1029 Node* receiver_count = __ Int32Constant(1);
1030 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); 1030 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count);
1031 Node* context = __ GetContext(); 1031 Node* context = __ GetContext();
1032 // TODO(rmcilroy): Use the call type feedback slot to call via CallStub. 1032 // TODO(rmcilroy): Use the call type feedback slot to call via CallStub.
1033 Node* result = __ CallJS(function, context, receiver_arg, args_count); 1033 Node* result =
1034 __ CallJS(function, context, receiver_arg, args_count, tail_call_mode);
1034 __ SetAccumulator(result); 1035 __ SetAccumulator(result);
1035 __ Dispatch(); 1036 __ Dispatch();
1036 } 1037 }
1037 1038
1038 1039
1039 // Call <callable> <receiver> <arg_count> 1040 // Call <callable> <receiver> <arg_count>
1040 // 1041 //
1041 // Call a JSfunction or Callable in |callable| with the |receiver| and 1042 // Call a JSfunction or Callable in |callable| with the |receiver| and
1042 // |arg_count| arguments in subsequent registers. 1043 // |arg_count| arguments in subsequent registers.
1043 void Interpreter::DoCall(InterpreterAssembler* assembler) { 1044 void Interpreter::DoCall(InterpreterAssembler* assembler) {
1044 DoJSCall(assembler); 1045 DoJSCall(assembler, TailCallMode::kDisallow);
1045 } 1046 }
1046 1047
1047 1048
1048 // CallWide <callable> <receiver> <arg_count> 1049 // CallWide <callable> <receiver> <arg_count>
1049 // 1050 //
1050 // Call a JSfunction or Callable in |callable| with the |receiver| and 1051 // Call a JSfunction or Callable in |callable| with the |receiver| and
1051 // |arg_count| arguments in subsequent registers. 1052 // |arg_count| arguments in subsequent registers.
1052 void Interpreter::DoCallWide(InterpreterAssembler* assembler) { 1053 void Interpreter::DoCallWide(InterpreterAssembler* assembler) {
1053 DoJSCall(assembler); 1054 DoJSCall(assembler, TailCallMode::kDisallow);
1055 }
1056
1057 // TailCall <callable> <receiver> <arg_count>
1058 //
1059 // Tail call a JSfunction or Callable in |callable| with the |receiver| and
1060 // |arg_count| arguments in subsequent registers.
1061 void Interpreter::DoTailCall(InterpreterAssembler* assembler) {
1062 DoJSCall(assembler, TailCallMode::kAllow);
1063 }
1064
1065 // TailCallWide <callable> <receiver> <arg_count>
1066 //
1067 // Tail call a JSfunction or Callable in |callable| with the |receiver| and
1068 // |arg_count| arguments in subsequent registers.
1069 void Interpreter::DoTailCallWide(InterpreterAssembler* assembler) {
1070 DoJSCall(assembler, TailCallMode::kAllow);
1054 } 1071 }
1055 1072
1056 void Interpreter::DoCallRuntimeCommon(InterpreterAssembler* assembler) { 1073 void Interpreter::DoCallRuntimeCommon(InterpreterAssembler* assembler) {
1057 Node* function_id = __ BytecodeOperandIdx(0); 1074 Node* function_id = __ BytecodeOperandIdx(0);
1058 Node* first_arg_reg = __ BytecodeOperandReg(1); 1075 Node* first_arg_reg = __ BytecodeOperandReg(1);
1059 Node* first_arg = __ RegisterLocation(first_arg_reg); 1076 Node* first_arg = __ RegisterLocation(first_arg_reg);
1060 Node* args_count = __ BytecodeOperandCount(2); 1077 Node* args_count = __ BytecodeOperandCount(2);
1061 Node* context = __ GetContext(); 1078 Node* context = __ GetContext();
1062 Node* result = __ CallRuntimeN(function_id, context, first_arg, args_count); 1079 Node* result = __ CallRuntimeN(function_id, context, first_arg, args_count);
1063 __ SetAccumulator(result); 1080 __ SetAccumulator(result);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 Node* receiver_count = __ Int32Constant(1); 1151 Node* receiver_count = __ Int32Constant(1);
1135 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); 1152 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count);
1136 1153
1137 // Get the function to call from the native context. 1154 // Get the function to call from the native context.
1138 Node* context = __ GetContext(); 1155 Node* context = __ GetContext();
1139 Node* native_context = 1156 Node* native_context =
1140 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 1157 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
1141 Node* function = __ LoadContextSlot(native_context, context_index); 1158 Node* function = __ LoadContextSlot(native_context, context_index);
1142 1159
1143 // Call the function. 1160 // Call the function.
1144 Node* result = __ CallJS(function, context, first_arg, args_count); 1161 Node* result = __ CallJS(function, context, first_arg, args_count,
1162 TailCallMode::kDisallow);
1145 __ SetAccumulator(result); 1163 __ SetAccumulator(result);
1146 __ Dispatch(); 1164 __ Dispatch();
1147 } 1165 }
1148 1166
1149 1167
1150 // CallJSRuntime <context_index> <receiver> <arg_count> 1168 // CallJSRuntime <context_index> <receiver> <arg_count>
1151 // 1169 //
1152 // Call the JS runtime function that has the |context_index| with the receiver 1170 // Call the JS runtime function that has the |context_index| with the receiver
1153 // in register |receiver| and |arg_count| arguments in subsequent registers. 1171 // in register |receiver| and |arg_count| arguments in subsequent registers.
1154 void Interpreter::DoCallJSRuntime(InterpreterAssembler* assembler) { 1172 void Interpreter::DoCallJSRuntime(InterpreterAssembler* assembler) {
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 Node* index = __ LoadRegister(index_reg); 1908 Node* index = __ LoadRegister(index_reg);
1891 Node* context = __ GetContext(); 1909 Node* context = __ GetContext();
1892 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); 1910 Node* result = __ CallRuntime(Runtime::kForInStep, context, index);
1893 __ SetAccumulator(result); 1911 __ SetAccumulator(result);
1894 __ Dispatch(); 1912 __ Dispatch();
1895 } 1913 }
1896 1914
1897 } // namespace interpreter 1915 } // namespace interpreter
1898 } // namespace internal 1916 } // namespace internal
1899 } // namespace v8 1917 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698