| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 Output(bytecode, static_cast<uint8_t>(name_index)); | 476 Output(bytecode, static_cast<uint8_t>(name_index)); |
| 477 } else if (FitsInIdx16Operand(name_index)) { | 477 } else if (FitsInIdx16Operand(name_index)) { |
| 478 Output(BytecodeForWideOperands(bytecode), | 478 Output(BytecodeForWideOperands(bytecode), |
| 479 static_cast<uint16_t>(name_index)); | 479 static_cast<uint16_t>(name_index)); |
| 480 } else { | 480 } else { |
| 481 UNIMPLEMENTED(); | 481 UNIMPLEMENTED(); |
| 482 } | 482 } |
| 483 return *this; | 483 return *this; |
| 484 } | 484 } |
| 485 | 485 |
| 486 | |
| 487 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( | 486 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( |
| 488 Register object, const Handle<String> name, int feedback_slot, | 487 Register object, const Handle<Name> name, int feedback_slot, |
| 489 LanguageMode language_mode) { | 488 LanguageMode language_mode) { |
| 490 Bytecode bytecode = BytecodeForLoadIC(language_mode); | 489 Bytecode bytecode = BytecodeForLoadIC(language_mode); |
| 491 size_t name_index = GetConstantPoolEntry(name); | 490 size_t name_index = GetConstantPoolEntry(name); |
| 492 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { | 491 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
| 493 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), | 492 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), |
| 494 static_cast<uint8_t>(feedback_slot)); | 493 static_cast<uint8_t>(feedback_slot)); |
| 495 } else if (FitsInIdx16Operand(name_index) && | 494 } else if (FitsInIdx16Operand(name_index) && |
| 496 FitsInIdx16Operand(feedback_slot)) { | 495 FitsInIdx16Operand(feedback_slot)) { |
| 497 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), | 496 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), |
| 498 static_cast<uint16_t>(name_index), | 497 static_cast<uint16_t>(name_index), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 512 static_cast<uint8_t>(feedback_slot)); | 511 static_cast<uint8_t>(feedback_slot)); |
| 513 } else if (FitsInIdx16Operand(feedback_slot)) { | 512 } else if (FitsInIdx16Operand(feedback_slot)) { |
| 514 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), | 513 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), |
| 515 static_cast<uint16_t>(feedback_slot)); | 514 static_cast<uint16_t>(feedback_slot)); |
| 516 } else { | 515 } else { |
| 517 UNIMPLEMENTED(); | 516 UNIMPLEMENTED(); |
| 518 } | 517 } |
| 519 return *this; | 518 return *this; |
| 520 } | 519 } |
| 521 | 520 |
| 522 | |
| 523 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( | 521 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( |
| 524 Register object, const Handle<String> name, int feedback_slot, | 522 Register object, const Handle<Name> name, int feedback_slot, |
| 525 LanguageMode language_mode) { | 523 LanguageMode language_mode) { |
| 526 Bytecode bytecode = BytecodeForStoreIC(language_mode); | 524 Bytecode bytecode = BytecodeForStoreIC(language_mode); |
| 527 size_t name_index = GetConstantPoolEntry(name); | 525 size_t name_index = GetConstantPoolEntry(name); |
| 528 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { | 526 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
| 529 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), | 527 Output(bytecode, object.ToRawOperand(), static_cast<uint8_t>(name_index), |
| 530 static_cast<uint8_t>(feedback_slot)); | 528 static_cast<uint8_t>(feedback_slot)); |
| 531 } else if (FitsInIdx16Operand(name_index) && | 529 } else if (FitsInIdx16Operand(name_index) && |
| 532 FitsInIdx16Operand(feedback_slot)) { | 530 FitsInIdx16Operand(feedback_slot)) { |
| 533 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), | 531 Output(BytecodeForWideOperands(bytecode), object.ToRawOperand(), |
| 534 static_cast<uint16_t>(name_index), | 532 static_cast<uint16_t>(name_index), |
| (...skipping 565 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1692 } | 1689 } |
| 1693 | 1690 |
| 1694 // static | 1691 // static |
| 1695 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { | 1692 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { |
| 1696 return value.is_short_operand(); | 1693 return value.is_short_operand(); |
| 1697 } | 1694 } |
| 1698 | 1695 |
| 1699 } // namespace interpreter | 1696 } // namespace interpreter |
| 1700 } // namespace internal | 1697 } // namespace internal |
| 1701 } // namespace v8 | 1698 } // namespace v8 |
| OLD | NEW |