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 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 if (FitsInIdx8Operand(slot_index)) { | 431 if (FitsInIdx8Operand(slot_index)) { |
432 Output(Bytecode::kStaContextSlot, context.ToOperand(), | 432 Output(Bytecode::kStaContextSlot, context.ToOperand(), |
433 static_cast<uint8_t>(slot_index)); | 433 static_cast<uint8_t>(slot_index)); |
434 } else { | 434 } else { |
435 UNIMPLEMENTED(); | 435 UNIMPLEMENTED(); |
436 } | 436 } |
437 return *this; | 437 return *this; |
438 } | 438 } |
439 | 439 |
440 | 440 |
| 441 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLookupSlot( |
| 442 const Handle<String> name, TypeofMode typeof_mode) { |
| 443 Bytecode bytecode = (typeof_mode == INSIDE_TYPEOF) |
| 444 ? Bytecode::kLdaLookupSlotInsideTypeof |
| 445 : Bytecode::kLdaLookupSlot; |
| 446 size_t name_index = GetConstantPoolEntry(name); |
| 447 if (FitsInIdx8Operand(name_index)) { |
| 448 Output(bytecode, static_cast<uint8_t>(name_index)); |
| 449 } else { |
| 450 UNIMPLEMENTED(); |
| 451 } |
| 452 return *this; |
| 453 } |
| 454 |
| 455 |
| 456 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreLookupSlot( |
| 457 const Handle<String> name, LanguageMode language_mode) { |
| 458 Bytecode bytecode = BytecodeForStoreLookupSlot(language_mode); |
| 459 size_t name_index = GetConstantPoolEntry(name); |
| 460 if (FitsInIdx8Operand(name_index)) { |
| 461 Output(bytecode, static_cast<uint8_t>(name_index)); |
| 462 } else { |
| 463 UNIMPLEMENTED(); |
| 464 } |
| 465 return *this; |
| 466 } |
| 467 |
| 468 |
441 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( | 469 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( |
442 Register object, size_t name_index, int feedback_slot, | 470 Register object, size_t name_index, int feedback_slot, |
443 LanguageMode language_mode) { | 471 LanguageMode language_mode) { |
444 Bytecode bytecode = BytecodeForLoadIC(language_mode); | 472 Bytecode bytecode = BytecodeForLoadIC(language_mode); |
445 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { | 473 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
446 Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index), | 474 Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index), |
447 static_cast<uint8_t>(feedback_slot)); | 475 static_cast<uint8_t>(feedback_slot)); |
448 } else if (FitsInIdx16Operand(name_index) && | 476 } else if (FitsInIdx16Operand(name_index) && |
449 FitsInIdx16Operand(feedback_slot)) { | 477 FitsInIdx16Operand(feedback_slot)) { |
450 Output(BytecodeForWideOperands(bytecode), object.ToOperand(), | 478 Output(BytecodeForWideOperands(bytecode), object.ToOperand(), |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 case STRONG: | 1344 case STRONG: |
1317 UNIMPLEMENTED(); | 1345 UNIMPLEMENTED(); |
1318 default: | 1346 default: |
1319 UNREACHABLE(); | 1347 UNREACHABLE(); |
1320 } | 1348 } |
1321 return static_cast<Bytecode>(-1); | 1349 return static_cast<Bytecode>(-1); |
1322 } | 1350 } |
1323 | 1351 |
1324 | 1352 |
1325 // static | 1353 // static |
| 1354 Bytecode BytecodeArrayBuilder::BytecodeForStoreLookupSlot( |
| 1355 LanguageMode language_mode) { |
| 1356 switch (language_mode) { |
| 1357 case SLOPPY: |
| 1358 return Bytecode::kStaLookupSlotSloppy; |
| 1359 case STRICT: |
| 1360 return Bytecode::kStaLookupSlotStrict; |
| 1361 case STRONG: |
| 1362 UNIMPLEMENTED(); |
| 1363 default: |
| 1364 UNREACHABLE(); |
| 1365 } |
| 1366 return static_cast<Bytecode>(-1); |
| 1367 } |
| 1368 |
| 1369 |
| 1370 // static |
1326 Bytecode BytecodeArrayBuilder::BytecodeForCreateArguments( | 1371 Bytecode BytecodeArrayBuilder::BytecodeForCreateArguments( |
1327 CreateArgumentsType type) { | 1372 CreateArgumentsType type) { |
1328 switch (type) { | 1373 switch (type) { |
1329 case CreateArgumentsType::kMappedArguments: | 1374 case CreateArgumentsType::kMappedArguments: |
1330 return Bytecode::kCreateMappedArguments; | 1375 return Bytecode::kCreateMappedArguments; |
1331 case CreateArgumentsType::kUnmappedArguments: | 1376 case CreateArgumentsType::kUnmappedArguments: |
1332 return Bytecode::kCreateUnmappedArguments; | 1377 return Bytecode::kCreateUnmappedArguments; |
1333 default: | 1378 default: |
1334 UNREACHABLE(); | 1379 UNREACHABLE(); |
1335 } | 1380 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 DCHECK_GT(next_consecutive_count_, 0); | 1473 DCHECK_GT(next_consecutive_count_, 0); |
1429 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); | 1474 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); |
1430 allocated_.push_back(next_consecutive_register_); | 1475 allocated_.push_back(next_consecutive_register_); |
1431 next_consecutive_count_--; | 1476 next_consecutive_count_--; |
1432 return Register(next_consecutive_register_++); | 1477 return Register(next_consecutive_register_++); |
1433 } | 1478 } |
1434 | 1479 |
1435 } // namespace interpreter | 1480 } // namespace interpreter |
1436 } // namespace internal | 1481 } // namespace internal |
1437 } // namespace v8 | 1482 } // namespace v8 |
OLD | NEW |