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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // static | 439 // static |
440 Bytecode BytecodeArrayBuilder::GetJumpWithConstantOperand( | 440 Bytecode BytecodeArrayBuilder::GetJumpWithConstantOperand( |
441 Bytecode jump_bytecode) { | 441 Bytecode jump_bytecode) { |
442 switch (jump_bytecode) { | 442 switch (jump_bytecode) { |
443 case Bytecode::kJump: | 443 case Bytecode::kJump: |
444 return Bytecode::kJumpConstant; | 444 return Bytecode::kJumpConstant; |
445 case Bytecode::kJumpIfTrue: | 445 case Bytecode::kJumpIfTrue: |
446 return Bytecode::kJumpIfTrueConstant; | 446 return Bytecode::kJumpIfTrueConstant; |
447 case Bytecode::kJumpIfFalse: | 447 case Bytecode::kJumpIfFalse: |
448 return Bytecode::kJumpIfFalseConstant; | 448 return Bytecode::kJumpIfFalseConstant; |
| 449 case Bytecode::kJumpIfToBooleanTrue: |
| 450 return Bytecode::kJumpIfToBooleanTrueConstant; |
| 451 case Bytecode::kJumpIfToBooleanFalse: |
| 452 return Bytecode::kJumpIfToBooleanFalseConstant; |
449 default: | 453 default: |
450 UNREACHABLE(); | 454 UNREACHABLE(); |
451 return Bytecode::kJumpConstant; | 455 return Bytecode::kJumpConstant; |
452 } | 456 } |
453 } | 457 } |
454 | 458 |
455 | 459 |
456 void BytecodeArrayBuilder::PatchJump( | 460 void BytecodeArrayBuilder::PatchJump( |
457 const ZoneVector<uint8_t>::iterator& jump_target, | 461 const ZoneVector<uint8_t>::iterator& jump_target, |
458 ZoneVector<uint8_t>::iterator jump_location) { | 462 ZoneVector<uint8_t>::iterator jump_location) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfTrue(BytecodeLabel* label) { | 531 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfTrue(BytecodeLabel* label) { |
528 return OutputJump(Bytecode::kJumpIfTrue, label); | 532 return OutputJump(Bytecode::kJumpIfTrue, label); |
529 } | 533 } |
530 | 534 |
531 | 535 |
532 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfFalse(BytecodeLabel* label) { | 536 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfFalse(BytecodeLabel* label) { |
533 return OutputJump(Bytecode::kJumpIfFalse, label); | 537 return OutputJump(Bytecode::kJumpIfFalse, label); |
534 } | 538 } |
535 | 539 |
536 | 540 |
| 541 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfToBooleanTrue( |
| 542 BytecodeLabel* label) { |
| 543 return OutputJump(Bytecode::kJumpIfToBooleanTrue, label); |
| 544 } |
| 545 |
| 546 |
| 547 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfToBooleanFalse( |
| 548 BytecodeLabel* label) { |
| 549 return OutputJump(Bytecode::kJumpIfToBooleanFalse, label); |
| 550 } |
| 551 |
| 552 |
537 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { | 553 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { |
538 Output(Bytecode::kReturn); | 554 Output(Bytecode::kReturn); |
539 return_seen_in_block_ = true; | 555 return_seen_in_block_ = true; |
540 return *this; | 556 return *this; |
541 } | 557 } |
542 | 558 |
543 | 559 |
544 BytecodeArrayBuilder& BytecodeArrayBuilder::EnterBlock() { return *this; } | 560 BytecodeArrayBuilder& BytecodeArrayBuilder::EnterBlock() { return *this; } |
545 | 561 |
546 | 562 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 | 833 |
818 Register TemporaryRegisterScope::NewRegister() { | 834 Register TemporaryRegisterScope::NewRegister() { |
819 count_++; | 835 count_++; |
820 last_register_index_ = builder_->BorrowTemporaryRegister(); | 836 last_register_index_ = builder_->BorrowTemporaryRegister(); |
821 return Register(last_register_index_); | 837 return Register(last_register_index_); |
822 } | 838 } |
823 | 839 |
824 } // namespace interpreter | 840 } // namespace interpreter |
825 } // namespace internal | 841 } // namespace internal |
826 } // namespace v8 | 842 } // namespace v8 |
OLD | NEW |