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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 #include "src/compiler.h" 6 #include "src/compiler.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace interpreter { 10 namespace interpreter {
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 if (!exit_seen_in_block_) { 1055 if (!exit_seen_in_block_) {
1056 LoadUndefined(); 1056 LoadUndefined();
1057 SetReturnPosition(literal); 1057 SetReturnPosition(literal);
1058 Return(); 1058 Return();
1059 } 1059 }
1060 } 1060 }
1061 1061
1062 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, 1062 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
1063 Register receiver_args, 1063 Register receiver_args,
1064 size_t receiver_args_count, 1064 size_t receiver_args_count,
1065 int feedback_slot) { 1065 int feedback_slot,
1066 TailCallMode tail_call_mode) {
1067 Bytecode bytecode = BytecodeForCall(tail_call_mode);
1066 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) && 1068 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) &&
1067 FitsInIdx8Operand(receiver_args_count) && 1069 FitsInIdx8Operand(receiver_args_count) &&
1068 FitsInIdx8Operand(feedback_slot)) { 1070 FitsInIdx8Operand(feedback_slot)) {
1069 Output(Bytecode::kCall, callable.ToRawOperand(), 1071 Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(),
1070 receiver_args.ToRawOperand(),
1071 static_cast<uint8_t>(receiver_args_count), 1072 static_cast<uint8_t>(receiver_args_count),
1072 static_cast<uint8_t>(feedback_slot)); 1073 static_cast<uint8_t>(feedback_slot));
1073 } else if (FitsInReg16Operand(callable) && 1074 } else if (FitsInReg16Operand(callable) &&
1074 FitsInReg16Operand(receiver_args) && 1075 FitsInReg16Operand(receiver_args) &&
1075 FitsInIdx16Operand(receiver_args_count) && 1076 FitsInIdx16Operand(receiver_args_count) &&
1076 FitsInIdx16Operand(feedback_slot)) { 1077 FitsInIdx16Operand(feedback_slot)) {
1077 Output(Bytecode::kCallWide, callable.ToRawOperand(), 1078 bytecode = BytecodeForWideOperands(bytecode);
1078 receiver_args.ToRawOperand(), 1079 Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(),
1079 static_cast<uint16_t>(receiver_args_count), 1080 static_cast<uint16_t>(receiver_args_count),
1080 static_cast<uint16_t>(feedback_slot)); 1081 static_cast<uint16_t>(feedback_slot));
1081 } else { 1082 } else {
1082 UNIMPLEMENTED(); 1083 UNIMPLEMENTED();
1083 } 1084 }
1084 return *this; 1085 return *this;
1085 } 1086 }
1086 1087
1087 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, 1088 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor,
1088 Register first_arg, 1089 Register first_arg,
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 default: 1419 default:
1419 UNREACHABLE(); 1420 UNREACHABLE();
1420 return static_cast<Bytecode>(-1); 1421 return static_cast<Bytecode>(-1);
1421 } 1422 }
1422 } 1423 }
1423 1424
1424 1425
1425 // static 1426 // static
1426 Bytecode BytecodeArrayBuilder::BytecodeForWideOperands(Bytecode bytecode) { 1427 Bytecode BytecodeArrayBuilder::BytecodeForWideOperands(Bytecode bytecode) {
1427 switch (bytecode) { 1428 switch (bytecode) {
1429 case Bytecode::kCall:
1430 return Bytecode::kCallWide;
1431 case Bytecode::kTailCall:
1432 return Bytecode::kTailCallWide;
1428 case Bytecode::kLoadIC: 1433 case Bytecode::kLoadIC:
1429 return Bytecode::kLoadICWide; 1434 return Bytecode::kLoadICWide;
1430 case Bytecode::kKeyedLoadIC: 1435 case Bytecode::kKeyedLoadIC:
1431 return Bytecode::kKeyedLoadICWide; 1436 return Bytecode::kKeyedLoadICWide;
1432 case Bytecode::kStoreICSloppy: 1437 case Bytecode::kStoreICSloppy:
1433 return Bytecode::kStoreICSloppyWide; 1438 return Bytecode::kStoreICSloppyWide;
1434 case Bytecode::kStoreICStrict: 1439 case Bytecode::kStoreICStrict:
1435 return Bytecode::kStoreICStrictWide; 1440 return Bytecode::kStoreICStrictWide;
1436 case Bytecode::kKeyedStoreICSloppy: 1441 case Bytecode::kKeyedStoreICSloppy:
1437 return Bytecode::kKeyedStoreICSloppyWide; 1442 return Bytecode::kKeyedStoreICSloppyWide;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 case STRICT: 1562 case STRICT:
1558 return Bytecode::kDeletePropertyStrict; 1563 return Bytecode::kDeletePropertyStrict;
1559 case STRONG: 1564 case STRONG:
1560 UNIMPLEMENTED(); 1565 UNIMPLEMENTED();
1561 default: 1566 default:
1562 UNREACHABLE(); 1567 UNREACHABLE();
1563 } 1568 }
1564 return static_cast<Bytecode>(-1); 1569 return static_cast<Bytecode>(-1);
1565 } 1570 }
1566 1571
1572 // static
1573 Bytecode BytecodeArrayBuilder::BytecodeForCall(TailCallMode tail_call_mode) {
1574 switch (tail_call_mode) {
1575 case TailCallMode::kDisallow:
1576 return Bytecode::kCall;
1577 case TailCallMode::kAllow:
1578 return Bytecode::kTailCall;
1579 default:
1580 UNREACHABLE();
1581 }
1582 return static_cast<Bytecode>(-1);
1583 }
1567 1584
1568 // static 1585 // static
1569 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) { 1586 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) {
1570 return kMinUInt8 <= value && value <= kMaxUInt8; 1587 return kMinUInt8 <= value && value <= kMaxUInt8;
1571 } 1588 }
1572 1589
1573 1590
1574 // static 1591 // static
1575 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) { 1592 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) {
1576 return value <= static_cast<size_t>(kMaxUInt8); 1593 return value <= static_cast<size_t>(kMaxUInt8);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 } 1629 }
1613 1630
1614 // static 1631 // static
1615 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { 1632 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) {
1616 return value.is_short_operand(); 1633 return value.is_short_operand();
1617 } 1634 }
1618 1635
1619 } // namespace interpreter 1636 } // namespace interpreter
1620 } // namespace internal 1637 } // namespace internal
1621 } // namespace v8 1638 } // namespace v8
OLDNEW
« 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