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

Unified 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: Fixed Bytecodes::IsCallOrNew() 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 6d0f65ee29f95afc4930db09c1378a592ceedaed..70f841656c41bad410e69647cc0306972ca18f8a 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -922,8 +922,8 @@ void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) {
DoDelete(Runtime::kDeleteProperty_Sloppy, assembler);
}
-
-void Interpreter::DoJSCall(InterpreterAssembler* assembler) {
+void Interpreter::DoJSCall(InterpreterAssembler* assembler,
+ TailCallMode tail_call_mode) {
Node* function_reg = __ BytecodeOperandReg(0);
Node* function = __ LoadRegister(function_reg);
Node* receiver_reg = __ BytecodeOperandReg(1);
@@ -933,7 +933,8 @@ void Interpreter::DoJSCall(InterpreterAssembler* assembler) {
Node* args_count = __ Int32Sub(receiver_args_count, receiver_count);
Node* context = __ GetContext();
// TODO(rmcilroy): Use the call type feedback slot to call via CallStub.
- Node* result = __ CallJS(function, context, receiver_arg, args_count);
+ Node* result =
+ __ CallJS(function, context, receiver_arg, args_count, tail_call_mode);
__ SetAccumulator(result);
__ Dispatch();
}
@@ -944,7 +945,7 @@ void Interpreter::DoJSCall(InterpreterAssembler* assembler) {
// Call a JSfunction or Callable in |callable| with the |receiver| and
// |arg_count| arguments in subsequent registers.
void Interpreter::DoCall(InterpreterAssembler* assembler) {
- DoJSCall(assembler);
+ DoJSCall(assembler, TailCallMode::kDisallow);
}
@@ -953,7 +954,23 @@ void Interpreter::DoCall(InterpreterAssembler* assembler) {
// Call a JSfunction or Callable in |callable| with the |receiver| and
// |arg_count| arguments in subsequent registers.
void Interpreter::DoCallWide(InterpreterAssembler* assembler) {
- DoJSCall(assembler);
+ DoJSCall(assembler, TailCallMode::kDisallow);
+}
+
+// TailCall <callable> <receiver> <arg_count>
+//
+// Tail call a JSfunction or Callable in |callable| with the |receiver| and
+// |arg_count| arguments in subsequent registers.
+void Interpreter::DoTailCall(InterpreterAssembler* assembler) {
+ DoJSCall(assembler, TailCallMode::kAllow);
+}
+
+// TailCallWide <callable> <receiver> <arg_count>
+//
+// Tail call a JSfunction or Callable in |callable| with the |receiver| and
+// |arg_count| arguments in subsequent registers.
+void Interpreter::DoTailCallWide(InterpreterAssembler* assembler) {
+ DoJSCall(assembler, TailCallMode::kAllow);
}
void Interpreter::DoCallRuntimeCommon(InterpreterAssembler* assembler) {
@@ -1044,7 +1061,8 @@ void Interpreter::DoCallJSRuntimeCommon(InterpreterAssembler* assembler) {
Node* function = __ LoadContextSlot(native_context, context_index);
// Call the function.
- Node* result = __ CallJS(function, context, first_arg, args_count);
+ Node* result = __ CallJS(function, context, first_arg, args_count,
+ TailCallMode::kDisallow);
__ SetAccumulator(result);
__ Dispatch();
}
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698