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/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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 if (!exit_seen_in_block_) { | 1076 if (!exit_seen_in_block_) { |
1077 LoadUndefined(); | 1077 LoadUndefined(); |
1078 SetReturnPosition(literal); | 1078 SetReturnPosition(literal); |
1079 Return(); | 1079 Return(); |
1080 } | 1080 } |
1081 } | 1081 } |
1082 | 1082 |
1083 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, | 1083 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, |
1084 Register receiver_args, | 1084 Register receiver_args, |
1085 size_t receiver_args_count, | 1085 size_t receiver_args_count, |
1086 int feedback_slot) { | 1086 int feedback_slot, |
1087 TailCallMode tail_call_mode) { | |
1087 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) && | 1088 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) && |
1088 FitsInIdx8Operand(receiver_args_count) && | 1089 FitsInIdx8Operand(receiver_args_count) && |
1089 FitsInIdx8Operand(feedback_slot)) { | 1090 FitsInIdx8Operand(feedback_slot)) { |
1090 Output(Bytecode::kCall, callable.ToRawOperand(), | 1091 Bytecode bytecode = tail_call_mode == TailCallMode::kAllow |
1091 receiver_args.ToRawOperand(), | 1092 ? Bytecode::kTailCall |
1093 : Bytecode::kCall; | |
rmcilroy
2016/02/16 17:16:58
Could you move this to a BytecodeForTailCallMode()
Igor Sheludko
2016/02/17 14:07:08
Done.
| |
1094 Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(), | |
1092 static_cast<uint8_t>(receiver_args_count), | 1095 static_cast<uint8_t>(receiver_args_count), |
1093 static_cast<uint8_t>(feedback_slot)); | 1096 static_cast<uint8_t>(feedback_slot)); |
1094 } else if (FitsInReg16Operand(callable) && | 1097 } else if (FitsInReg16Operand(callable) && |
1095 FitsInReg16Operand(receiver_args) && | 1098 FitsInReg16Operand(receiver_args) && |
1096 FitsInIdx16Operand(receiver_args_count) && | 1099 FitsInIdx16Operand(receiver_args_count) && |
1097 FitsInIdx16Operand(feedback_slot)) { | 1100 FitsInIdx16Operand(feedback_slot)) { |
1098 Output(Bytecode::kCallWide, callable.ToRawOperand(), | 1101 Bytecode bytecode = tail_call_mode == TailCallMode::kAllow |
1099 receiver_args.ToRawOperand(), | 1102 ? Bytecode::kTailCallWide |
1103 : Bytecode::kCallWide; | |
1104 Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(), | |
rmcilroy
2016/02/16 17:16:58
Please add kCall and kTailCall to BytecodeForWideO
Igor Sheludko
2016/02/17 14:07:08
Done.
| |
1100 static_cast<uint16_t>(receiver_args_count), | 1105 static_cast<uint16_t>(receiver_args_count), |
1101 static_cast<uint16_t>(feedback_slot)); | 1106 static_cast<uint16_t>(feedback_slot)); |
1102 } else { | 1107 } else { |
1103 UNIMPLEMENTED(); | 1108 UNIMPLEMENTED(); |
1104 } | 1109 } |
1105 return *this; | 1110 return *this; |
1106 } | 1111 } |
1107 | 1112 |
1108 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, | 1113 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, |
1109 Register first_arg, | 1114 Register first_arg, |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1688 } | 1693 } |
1689 | 1694 |
1690 // static | 1695 // static |
1691 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { | 1696 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { |
1692 return value.is_short_operand(); | 1697 return value.is_short_operand(); |
1693 } | 1698 } |
1694 | 1699 |
1695 } // namespace interpreter | 1700 } // namespace interpreter |
1696 } // namespace internal | 1701 } // namespace internal |
1697 } // namespace v8 | 1702 } // namespace v8 |
OLD | NEW |