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

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

Issue 1688283003: [Interpreter] Implements calls through CallICStub in the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1076 }
1077 1077
1078 void BytecodeArrayBuilder::EnsureReturn(FunctionLiteral* literal) { 1078 void BytecodeArrayBuilder::EnsureReturn(FunctionLiteral* literal) {
1079 if (!exit_seen_in_block_) { 1079 if (!exit_seen_in_block_) {
1080 LoadUndefined(); 1080 LoadUndefined();
1081 SetReturnPosition(literal); 1081 SetReturnPosition(literal);
1082 Return(); 1082 Return();
1083 } 1083 }
1084 } 1084 }
1085 1085
1086 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, 1086 BytecodeArrayBuilder& BytecodeArrayBuilder::CallIC(Register callable,
1087 Register receiver_args, 1087 Register receiver_args,
1088 size_t receiver_args_count, 1088 size_t receiver_args_count,
1089 int feedback_slot) { 1089 int feedback_slot) {
1090 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) && 1090 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) &&
1091 FitsInIdx8Operand(receiver_args_count) && 1091 FitsInIdx8Operand(receiver_args_count) &&
1092 FitsInIdx8Operand(feedback_slot)) { 1092 FitsInIdx8Operand(feedback_slot)) {
1093 Output(Bytecode::kCall, callable.ToRawOperand(), 1093 Output(Bytecode::kCallIC, callable.ToRawOperand(),
1094 receiver_args.ToRawOperand(), 1094 receiver_args.ToRawOperand(),
1095 static_cast<uint8_t>(receiver_args_count), 1095 static_cast<uint8_t>(receiver_args_count),
1096 static_cast<uint8_t>(feedback_slot)); 1096 static_cast<uint8_t>(feedback_slot));
1097 } else if (FitsInReg16Operand(callable) && 1097 } else if (FitsInReg16Operand(callable) &&
1098 FitsInReg16Operand(receiver_args) && 1098 FitsInReg16Operand(receiver_args) &&
1099 FitsInIdx16Operand(receiver_args_count) && 1099 FitsInIdx16Operand(receiver_args_count) &&
1100 FitsInIdx16Operand(feedback_slot)) { 1100 FitsInIdx16Operand(feedback_slot)) {
1101 Output(Bytecode::kCallWide, callable.ToRawOperand(), 1101 Output(Bytecode::kCallICWide, callable.ToRawOperand(),
1102 receiver_args.ToRawOperand(), 1102 receiver_args.ToRawOperand(),
1103 static_cast<uint16_t>(receiver_args_count), 1103 static_cast<uint16_t>(receiver_args_count),
1104 static_cast<uint16_t>(feedback_slot)); 1104 static_cast<uint16_t>(feedback_slot));
1105 } else { 1105 } else {
1106 UNIMPLEMENTED(); 1106 UNIMPLEMENTED();
1107 } 1107 }
1108 return *this; 1108 return *this;
1109 } 1109 }
1110 1110
1111 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
1112 Register receiver_args,
1113 size_t receiver_args_count) {
1114 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) &&
1115 FitsInIdx8Operand(receiver_args_count)) {
1116 Output(Bytecode::kCall, callable.ToRawOperand(),
1117 receiver_args.ToRawOperand(),
1118 static_cast<uint8_t>(receiver_args_count));
1119 } else if (FitsInReg16Operand(callable) &&
1120 FitsInReg16Operand(receiver_args) &&
1121 FitsInIdx16Operand(receiver_args_count)) {
1122 Output(Bytecode::kCallWide, callable.ToRawOperand(),
1123 receiver_args.ToRawOperand(),
1124 static_cast<uint16_t>(receiver_args_count));
1125 } else {
1126 UNIMPLEMENTED();
1127 }
1128 return *this;
1129 }
1111 1130
1112 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, 1131 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor,
1113 Register first_arg, 1132 Register first_arg,
1114 size_t arg_count) { 1133 size_t arg_count) {
1115 if (!first_arg.is_valid()) { 1134 if (!first_arg.is_valid()) {
1116 DCHECK_EQ(0u, arg_count); 1135 DCHECK_EQ(0u, arg_count);
1117 first_arg = Register(0); 1136 first_arg = Register(0);
1118 } 1137 }
1119 if (FitsInReg8Operand(constructor) && FitsInReg8Operand(first_arg) && 1138 if (FitsInReg8Operand(constructor) && FitsInReg8Operand(first_arg) &&
1120 FitsInIdx8Operand(arg_count)) { 1139 FitsInIdx8Operand(arg_count)) {
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 } 1711 }
1693 1712
1694 // static 1713 // static
1695 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { 1714 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) {
1696 return value.is_short_operand(); 1715 return value.is_short_operand();
1697 } 1716 }
1698 1717
1699 } // namespace interpreter 1718 } // namespace interpreter
1700 } // namespace internal 1719 } // namespace internal
1701 } // namespace v8 1720 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698