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

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

Issue 1385623002: [Interpreter]: Add support for strict mode load / store ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 122
123 void BytecodeArrayBuilder::Output(Bytecode bytecode) { 123 void BytecodeArrayBuilder::Output(Bytecode bytecode) {
124 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0); 124 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0);
125 last_bytecode_start_ = bytecodes()->size(); 125 last_bytecode_start_ = bytecodes()->size();
126 bytecodes()->push_back(Bytecodes::ToByte(bytecode)); 126 bytecodes()->push_back(Bytecodes::ToByte(bytecode));
127 } 127 }
128 128
129 129
130 BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value op, 130 BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(
131 Register reg) { 131 Token::Value op, Register reg, LanguageMode language_mode) {
132 if (is_strong(strength(language_mode))) {
133 UNIMPLEMENTED();
oth 2015/10/02 15:17:44 Nitletino - other updates here take a more conserv
rmcilroy 2015/10/06 13:56:34 I'd prefer not to do this since it is the language
134 }
135
132 Output(BytecodeForBinaryOperation(op), reg.ToOperand()); 136 Output(BytecodeForBinaryOperation(op), reg.ToOperand());
133 return *this; 137 return *this;
134 } 138 }
135 139
136 140
137 BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation( 141 BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation(
138 Token::Value op, Register reg, LanguageMode language_mode) { 142 Token::Value op, Register reg, LanguageMode language_mode) {
139 if (!is_sloppy(language_mode)) { 143 if (is_strong(strength(language_mode))) {
oth 2015/10/02 15:17:44 Nitletino -same here.
rmcilroy 2015/10/06 13:56:34 Acknowledged.
140 UNIMPLEMENTED(); 144 UNIMPLEMENTED();
141 } 145 }
142 146
143 Output(BytecodeForCompareOperation(op), reg.ToOperand()); 147 Output(BytecodeForCompareOperation(op), reg.ToOperand());
144 return *this; 148 return *this;
145 } 149 }
146 150
147 151
148 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral( 152 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral(
149 v8::internal::Smi* smi) { 153 v8::internal::Smi* smi) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (FitsInIdxOperand(slot_index)) { 223 if (FitsInIdxOperand(slot_index)) {
220 Output(Bytecode::kLdaGlobal, static_cast<uint8_t>(slot_index)); 224 Output(Bytecode::kLdaGlobal, static_cast<uint8_t>(slot_index));
221 } else { 225 } else {
222 UNIMPLEMENTED(); 226 UNIMPLEMENTED();
223 } 227 }
224 return *this; 228 return *this;
225 } 229 }
226 230
227 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( 231 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
228 Register object, int feedback_slot, LanguageMode language_mode) { 232 Register object, int feedback_slot, LanguageMode language_mode) {
229 if (!is_sloppy(language_mode)) { 233 Bytecode bytecode;
230 UNIMPLEMENTED(); 234 switch (language_mode) {
235 case SLOPPY:
236 bytecode = Bytecode::kLoadIC;
237 break;
238 case STRICT:
239 bytecode = Bytecode::kLoadICStrict;
240 break;
241 case STRONG:
242 default:
243 UNIMPLEMENTED();
Michael Starzinger 2015/10/05 12:04:45 nit: The strong case is UNIMPLEMENTED but the defa
rmcilroy 2015/10/06 13:56:34 Done.
231 } 244 }
232 245
233 if (FitsInIdxOperand(feedback_slot)) { 246 if (FitsInIdxOperand(feedback_slot)) {
234 Output(Bytecode::kLoadIC, object.ToOperand(), 247 Output(bytecode, object.ToOperand(), static_cast<uint8_t>(feedback_slot));
235 static_cast<uint8_t>(feedback_slot));
236 } else { 248 } else {
237 UNIMPLEMENTED(); 249 UNIMPLEMENTED();
238 } 250 }
239 return *this; 251 return *this;
240 } 252 }
241 253
242 254
243 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty( 255 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty(
244 Register object, int feedback_slot, LanguageMode language_mode) { 256 Register object, int feedback_slot, LanguageMode language_mode) {
245 if (!is_sloppy(language_mode)) { 257 Bytecode bytecode;
246 UNIMPLEMENTED(); 258 switch (language_mode) {
259 case SLOPPY:
260 bytecode = Bytecode::kKeyedLoadIC;
261 break;
262 case STRICT:
263 bytecode = Bytecode::kKeyedLoadICStrict;
264 break;
265 case STRONG:
266 default:
267 UNIMPLEMENTED();
247 } 268 }
248 269
249 if (FitsInIdxOperand(feedback_slot)) { 270 if (FitsInIdxOperand(feedback_slot)) {
250 Output(Bytecode::kKeyedLoadIC, object.ToOperand(), 271 Output(bytecode, object.ToOperand(), static_cast<uint8_t>(feedback_slot));
251 static_cast<uint8_t>(feedback_slot));
252 } else { 272 } else {
253 UNIMPLEMENTED(); 273 UNIMPLEMENTED();
254 } 274 }
255 return *this; 275 return *this;
256 } 276 }
257 277
258 278
259 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( 279 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
260 Register object, Register name, int feedback_slot, 280 Register object, Register name, int feedback_slot,
261 LanguageMode language_mode) { 281 LanguageMode language_mode) {
262 if (!is_sloppy(language_mode)) { 282 Bytecode bytecode;
263 UNIMPLEMENTED(); 283 switch (language_mode) {
284 case SLOPPY:
285 bytecode = Bytecode::kStoreIC;
286 break;
287 case STRICT:
288 bytecode = Bytecode::kStoreICStrict;
289 break;
290 case STRONG:
291 default:
292 UNIMPLEMENTED();
264 } 293 }
265 294
266 if (FitsInIdxOperand(feedback_slot)) { 295 if (FitsInIdxOperand(feedback_slot)) {
267 Output(Bytecode::kStoreIC, object.ToOperand(), name.ToOperand(), 296 Output(bytecode, object.ToOperand(), name.ToOperand(),
268 static_cast<uint8_t>(feedback_slot)); 297 static_cast<uint8_t>(feedback_slot));
269 } else { 298 } else {
270 UNIMPLEMENTED(); 299 UNIMPLEMENTED();
271 } 300 }
272 return *this; 301 return *this;
273 } 302 }
274 303
275 304
276 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty( 305 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
277 Register object, Register key, int feedback_slot, 306 Register object, Register key, int feedback_slot,
278 LanguageMode language_mode) { 307 LanguageMode language_mode) {
279 if (!is_sloppy(language_mode)) { 308 Bytecode bytecode;
280 UNIMPLEMENTED(); 309 switch (language_mode) {
310 case SLOPPY:
311 bytecode = Bytecode::kKeyedStoreIC;
312 break;
313 case STRICT:
314 bytecode = Bytecode::kKeyedStoreICStrict;
315 break;
316 case STRONG:
317 default:
318 UNIMPLEMENTED();
281 } 319 }
282 320
283 if (FitsInIdxOperand(feedback_slot)) { 321 if (FitsInIdxOperand(feedback_slot)) {
284 Output(Bytecode::kKeyedStoreIC, object.ToOperand(), key.ToOperand(), 322 Output(bytecode, object.ToOperand(), key.ToOperand(),
285 static_cast<uint8_t>(feedback_slot)); 323 static_cast<uint8_t>(feedback_slot));
286 } else { 324 } else {
287 UNIMPLEMENTED(); 325 UNIMPLEMENTED();
288 } 326 }
289 return *this; 327 return *this;
290 } 328 }
291 329
292 330
293 BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() { 331 BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() {
294 if (LastBytecodeInSameBlock()) { 332 if (LastBytecodeInSameBlock()) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 665
628 Register TemporaryRegisterScope::NewRegister() { 666 Register TemporaryRegisterScope::NewRegister() {
629 count_++; 667 count_++;
630 last_register_index_ = builder_->BorrowTemporaryRegister(); 668 last_register_index_ = builder_->BorrowTemporaryRegister();
631 return Register(last_register_index_); 669 return Register(last_register_index_);
632 } 670 }
633 671
634 } // namespace interpreter 672 } // namespace interpreter
635 } // namespace internal 673 } // namespace internal
636 } // namespace v8 674 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698