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

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 1456453002: [Interpreter] Add support for Call bytecode to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Compilation fix (signed/unsigned). Created 5 years, 1 month 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-array-iterator.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 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 bytecodes()->insert(bytecodes()->end(), operand_bytes, 130 bytecodes()->insert(bytecodes()->end(), operand_bytes,
131 operand_bytes + 2); 131 operand_bytes + 2);
132 break; 132 break;
133 } 133 }
134 } 134 }
135 } 135 }
136 } 136 }
137 137
138 138
139 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t operand0, 139 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t operand0,
140 uint32_t operand1, uint32_t operand2,
141 uint32_t operand3) {
142 uint32_t operands[] = {operand0, operand1, operand2, operand3};
143 Output(bytecode, operands);
144 }
145
146
147 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t operand0,
140 uint32_t operand1, uint32_t operand2) { 148 uint32_t operand1, uint32_t operand2) {
141 uint32_t operands[] = {operand0, operand1, operand2}; 149 uint32_t operands[] = {operand0, operand1, operand2};
142 Output(bytecode, operands); 150 Output(bytecode, operands);
143 } 151 }
144 152
145 153
146 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t operand0, 154 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t operand0,
147 uint32_t operand1) { 155 uint32_t operand1) {
148 uint32_t operands[] = {operand0, operand1}; 156 uint32_t operands[] = {operand0, operand1};
149 Output(bytecode, operands); 157 Output(bytecode, operands);
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 void BytecodeArrayBuilder::EnsureReturn() { 769 void BytecodeArrayBuilder::EnsureReturn() {
762 if (!exit_seen_in_block_) { 770 if (!exit_seen_in_block_) {
763 LoadUndefined(); 771 LoadUndefined();
764 Return(); 772 Return();
765 } 773 }
766 } 774 }
767 775
768 776
769 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, 777 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
770 Register receiver, 778 Register receiver,
771 size_t arg_count) { 779 size_t arg_count,
772 if (FitsInIdx8Operand(arg_count)) { 780 int feedback_slot) {
781 if (FitsInIdx8Operand(arg_count) && FitsInIdx8Operand(feedback_slot)) {
773 Output(Bytecode::kCall, callable.ToOperand(), receiver.ToOperand(), 782 Output(Bytecode::kCall, callable.ToOperand(), receiver.ToOperand(),
774 static_cast<uint8_t>(arg_count)); 783 static_cast<uint8_t>(arg_count),
784 static_cast<uint8_t>(feedback_slot));
785 } else if (FitsInIdx16Operand(arg_count) &&
786 FitsInIdx16Operand(feedback_slot)) {
787 Output(Bytecode::kCallWide, callable.ToOperand(), receiver.ToOperand(),
788 static_cast<uint16_t>(arg_count),
789 static_cast<uint16_t>(feedback_slot));
775 } else { 790 } else {
776 UNIMPLEMENTED(); 791 UNIMPLEMENTED();
777 } 792 }
778 return *this; 793 return *this;
779 } 794 }
780 795
781 796
782 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, 797 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor,
783 Register first_arg, 798 Register first_arg,
784 size_t arg_count) { 799 size_t arg_count) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 } 931 }
917 } 932 }
918 933
919 934
920 bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index, 935 bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index,
921 uint32_t operand_value) const { 936 uint32_t operand_value) const {
922 OperandType operand_type = Bytecodes::GetOperandType(bytecode, operand_index); 937 OperandType operand_type = Bytecodes::GetOperandType(bytecode, operand_index);
923 switch (operand_type) { 938 switch (operand_type) {
924 case OperandType::kNone: 939 case OperandType::kNone:
925 return false; 940 return false;
941 case OperandType::kCount16:
926 case OperandType::kIdx16: 942 case OperandType::kIdx16:
927 return static_cast<uint16_t>(operand_value) == operand_value; 943 return static_cast<uint16_t>(operand_value) == operand_value;
928 case OperandType::kCount8: 944 case OperandType::kCount8:
929 case OperandType::kImm8: 945 case OperandType::kImm8:
930 case OperandType::kIdx8: 946 case OperandType::kIdx8:
931 return static_cast<uint8_t>(operand_value) == operand_value; 947 return static_cast<uint8_t>(operand_value) == operand_value;
932 case OperandType::kMaybeReg8: 948 case OperandType::kMaybeReg8:
933 if (operand_value == 0) { 949 if (operand_value == 0) {
934 return true; 950 return true;
935 } 951 }
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 DCHECK_GT(next_consecutive_count_, 0); 1315 DCHECK_GT(next_consecutive_count_, 0);
1300 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1316 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1301 allocated_.push_back(next_consecutive_register_); 1317 allocated_.push_back(next_consecutive_register_);
1302 next_consecutive_count_--; 1318 next_consecutive_count_--;
1303 return Register(next_consecutive_register_++); 1319 return Register(next_consecutive_register_++);
1304 } 1320 }
1305 1321
1306 } // namespace interpreter 1322 } // namespace interpreter
1307 } // namespace internal 1323 } // namespace internal
1308 } // namespace v8 1324 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-array-iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698