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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 Output(bytecode, static_cast<uint8_t>(name_index)); | 477 Output(bytecode, static_cast<uint8_t>(name_index)); |
478 } else if (FitsInIdx16Operand(name_index)) { | 478 } else if (FitsInIdx16Operand(name_index)) { |
479 Output(BytecodeForWideOperands(bytecode), | 479 Output(BytecodeForWideOperands(bytecode), |
480 static_cast<uint16_t>(name_index)); | 480 static_cast<uint16_t>(name_index)); |
481 } else { | 481 } else { |
482 UNIMPLEMENTED(); | 482 UNIMPLEMENTED(); |
483 } | 483 } |
484 return *this; | 484 return *this; |
485 } | 485 } |
486 | 486 |
487 | |
488 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( | 487 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( |
489 Register object, const Handle<String> name, int feedback_slot, | 488 Register object, const Handle<Name> name, int feedback_slot, |
490 LanguageMode language_mode) { | 489 LanguageMode language_mode) { |
491 Bytecode bytecode = BytecodeForLoadIC(language_mode); | 490 Bytecode bytecode = BytecodeForLoadIC(language_mode); |
492 size_t name_index = GetConstantPoolEntry(name); | 491 size_t name_index = GetConstantPoolEntry(name); |
493 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { | 492 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
494 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), | 493 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), |
495 static_cast<uint8_t>(feedback_slot)); | 494 static_cast<uint8_t>(feedback_slot)); |
496 } else if (FitsInIdx16Operand(name_index) && | 495 } else if (FitsInIdx16Operand(name_index) && |
497 FitsInIdx16Operand(feedback_slot)) { | 496 FitsInIdx16Operand(feedback_slot)) { |
498 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), | 497 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), |
499 static_cast<uint16_t>(name_index), | 498 static_cast<uint16_t>(name_index), |
(...skipping 13 matching lines...) Expand all Loading... |
513 static_cast<uint8_t>(feedback_slot)); | 512 static_cast<uint8_t>(feedback_slot)); |
514 } else if (FitsInIdx16Operand(feedback_slot)) { | 513 } else if (FitsInIdx16Operand(feedback_slot)) { |
515 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), | 514 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), |
516 static_cast<uint16_t>(feedback_slot)); | 515 static_cast<uint16_t>(feedback_slot)); |
517 } else { | 516 } else { |
518 UNIMPLEMENTED(); | 517 UNIMPLEMENTED(); |
519 } | 518 } |
520 return *this; | 519 return *this; |
521 } | 520 } |
522 | 521 |
523 | |
524 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( | 522 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( |
525 Register object, const Handle<String> name, int feedback_slot, | 523 Register object, const Handle<Name> name, int feedback_slot, |
526 LanguageMode language_mode) { | 524 LanguageMode language_mode) { |
527 Bytecode bytecode = BytecodeForStoreIC(language_mode); | 525 Bytecode bytecode = BytecodeForStoreIC(language_mode); |
528 size_t name_index = GetConstantPoolEntry(name); | 526 size_t name_index = GetConstantPoolEntry(name); |
529 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { | 527 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
530 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), | 528 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), |
531 static_cast<uint8_t>(feedback_slot)); | 529 static_cast<uint8_t>(feedback_slot)); |
532 } else if (FitsInIdx16Operand(name_index) && | 530 } else if (FitsInIdx16Operand(name_index) && |
533 FitsInIdx16Operand(feedback_slot)) { | 531 FitsInIdx16Operand(feedback_slot)) { |
534 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), | 532 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), |
535 static_cast<uint16_t>(name_index), | 533 static_cast<uint16_t>(name_index), |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 Output(Bytecode::kCallWide, callable.ToRawOperand(), | 1098 Output(Bytecode::kCallWide, callable.ToRawOperand(), |
1101 receiver_args.ToRawOperand(), | 1099 receiver_args.ToRawOperand(), |
1102 static_cast<uint16_t>(receiver_args_count), | 1100 static_cast<uint16_t>(receiver_args_count), |
1103 static_cast<uint16_t>(feedback_slot)); | 1101 static_cast<uint16_t>(feedback_slot)); |
1104 } else { | 1102 } else { |
1105 UNIMPLEMENTED(); | 1103 UNIMPLEMENTED(); |
1106 } | 1104 } |
1107 return *this; | 1105 return *this; |
1108 } | 1106 } |
1109 | 1107 |
1110 | |
1111 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, | 1108 BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, |
1112 Register first_arg, | 1109 Register first_arg, |
1113 size_t arg_count) { | 1110 size_t arg_count) { |
1114 if (!first_arg.is_valid()) { | 1111 if (!first_arg.is_valid()) { |
1115 DCHECK_EQ(0u, arg_count); | 1112 DCHECK_EQ(0u, arg_count); |
1116 first_arg = Register(0); | 1113 first_arg = Register(0); |
1117 } | 1114 } |
1118 if (FitsInReg8Operand(constructor) && FitsInReg8Operand(first_arg) && | 1115 if (FitsInReg8Operand(constructor) && FitsInReg8Operand(first_arg) && |
1119 FitsInIdx8Operand(arg_count)) { | 1116 FitsInIdx8Operand(arg_count)) { |
1120 Output(Bytecode::kNew, constructor.ToRawOperand(), first_arg.ToRawOperand(), | 1117 Output(Bytecode::kNew, constructor.ToRawOperand(), first_arg.ToRawOperand(), |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 } | 1688 } |
1692 | 1689 |
1693 // static | 1690 // static |
1694 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { | 1691 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { |
1695 return value.is_short_operand(); | 1692 return value.is_short_operand(); |
1696 } | 1693 } |
1697 | 1694 |
1698 } // namespace interpreter | 1695 } // namespace interpreter |
1699 } // namespace internal | 1696 } // namespace internal |
1700 } // namespace v8 | 1697 } // namespace v8 |
OLD | NEW |