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

Unified Diff: src/interpreter/bytecode-array-builder.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/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 5e7770532d6a67233a82cfc942aec97eb040e895..7103c7217812395ff47fbcd78f3212d3ad10d355 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -1062,20 +1062,21 @@ void BytecodeArrayBuilder::EnsureReturn(FunctionLiteral* literal) {
BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
Register receiver_args,
size_t receiver_args_count,
- int feedback_slot) {
+ int feedback_slot,
+ TailCallMode tail_call_mode) {
+ Bytecode bytecode = BytecodeForCall(tail_call_mode);
if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) &&
FitsInIdx8Operand(receiver_args_count) &&
FitsInIdx8Operand(feedback_slot)) {
- Output(Bytecode::kCall, callable.ToRawOperand(),
- receiver_args.ToRawOperand(),
+ Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(),
static_cast<uint8_t>(receiver_args_count),
static_cast<uint8_t>(feedback_slot));
} else if (FitsInReg16Operand(callable) &&
FitsInReg16Operand(receiver_args) &&
FitsInIdx16Operand(receiver_args_count) &&
FitsInIdx16Operand(feedback_slot)) {
- Output(Bytecode::kCallWide, callable.ToRawOperand(),
- receiver_args.ToRawOperand(),
+ bytecode = BytecodeForWideOperands(bytecode);
+ Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(),
static_cast<uint16_t>(receiver_args_count),
static_cast<uint16_t>(feedback_slot));
} else {
@@ -1425,6 +1426,10 @@ Bytecode BytecodeArrayBuilder::BytecodeForCompareOperation(Token::Value op) {
// static
Bytecode BytecodeArrayBuilder::BytecodeForWideOperands(Bytecode bytecode) {
switch (bytecode) {
+ case Bytecode::kCall:
+ return Bytecode::kCallWide;
+ case Bytecode::kTailCall:
+ return Bytecode::kTailCallWide;
case Bytecode::kLoadIC:
return Bytecode::kLoadICWide;
case Bytecode::kKeyedLoadIC:
@@ -1564,6 +1569,18 @@ Bytecode BytecodeArrayBuilder::BytecodeForDelete(LanguageMode language_mode) {
return static_cast<Bytecode>(-1);
}
+// static
+Bytecode BytecodeArrayBuilder::BytecodeForCall(TailCallMode tail_call_mode) {
+ switch (tail_call_mode) {
+ case TailCallMode::kDisallow:
+ return Bytecode::kCall;
+ case TailCallMode::kAllow:
+ return Bytecode::kTailCall;
+ default:
+ UNREACHABLE();
+ }
+ return static_cast<Bytecode>(-1);
+}
// static
bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) {
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698