| 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 #include "src/globals.h" | 7 #include "src/globals.h" | 
| 8 #include "src/interpreter/bytecode-array-writer.h" | 8 #include "src/interpreter/bytecode-array-writer.h" | 
| 9 #include "src/interpreter/bytecode-dead-code-optimizer.h" | 9 #include "src/interpreter/bytecode-dead-code-optimizer.h" | 
| 10 #include "src/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" | 
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 700 } | 700 } | 
| 701 | 701 | 
| 702 BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(const BytecodeLabel& target, | 702 BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(const BytecodeLabel& target, | 
| 703                                                  BytecodeLabel* label) { | 703                                                  BytecodeLabel* label) { | 
| 704   pipeline_->BindLabel(target, label); | 704   pipeline_->BindLabel(target, label); | 
| 705   LeaveBasicBlock(); | 705   LeaveBasicBlock(); | 
| 706   return *this; | 706   return *this; | 
| 707 } | 707 } | 
| 708 | 708 | 
| 709 BytecodeArrayBuilder& BytecodeArrayBuilder::Jump(BytecodeLabel* label) { | 709 BytecodeArrayBuilder& BytecodeArrayBuilder::Jump(BytecodeLabel* label) { | 
|  | 710   DCHECK(!label->is_bound()); | 
| 710   OutputJump(label, 0); | 711   OutputJump(label, 0); | 
| 711   return *this; | 712   return *this; | 
| 712 } | 713 } | 
| 713 | 714 | 
| 714 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfTrue(BytecodeLabel* label) { | 715 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfTrue(BytecodeLabel* label) { | 
| 715   // The peephole optimizer attempts to simplify JumpIfToBooleanTrue | 716   // The peephole optimizer attempts to simplify JumpIfToBooleanTrue | 
| 716   // to JumpIfTrue. | 717   // to JumpIfTrue. | 
|  | 718   DCHECK(!label->is_bound()); | 
| 717   OutputJumpIfToBooleanTrue(label, 0); | 719   OutputJumpIfToBooleanTrue(label, 0); | 
| 718   return *this; | 720   return *this; | 
| 719 } | 721 } | 
| 720 | 722 | 
| 721 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfFalse(BytecodeLabel* label) { | 723 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfFalse(BytecodeLabel* label) { | 
|  | 724   DCHECK(!label->is_bound()); | 
| 722   OutputJumpIfToBooleanFalse(label, 0); | 725   OutputJumpIfToBooleanFalse(label, 0); | 
| 723   return *this; | 726   return *this; | 
| 724 } | 727 } | 
| 725 | 728 | 
| 726 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNull(BytecodeLabel* label) { | 729 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNull(BytecodeLabel* label) { | 
|  | 730   DCHECK(!label->is_bound()); | 
| 727   OutputJumpIfNull(label, 0); | 731   OutputJumpIfNull(label, 0); | 
| 728   return *this; | 732   return *this; | 
| 729 } | 733 } | 
| 730 | 734 | 
| 731 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfUndefined( | 735 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfUndefined( | 
| 732     BytecodeLabel* label) { | 736     BytecodeLabel* label) { | 
|  | 737   DCHECK(!label->is_bound()); | 
| 733   OutputJumpIfUndefined(label, 0); | 738   OutputJumpIfUndefined(label, 0); | 
| 734   return *this; | 739   return *this; | 
| 735 } | 740 } | 
| 736 | 741 | 
| 737 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole( | 742 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole( | 
| 738     BytecodeLabel* label) { | 743     BytecodeLabel* label) { | 
|  | 744   DCHECK(!label->is_bound()); | 
| 739   OutputJumpIfNotHole(label, 0); | 745   OutputJumpIfNotHole(label, 0); | 
| 740   return *this; | 746   return *this; | 
| 741 } | 747 } | 
| 742 | 748 | 
| 743 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfJSReceiver( | 749 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfJSReceiver( | 
| 744     BytecodeLabel* label) { | 750     BytecodeLabel* label) { | 
|  | 751   DCHECK(!label->is_bound()); | 
| 745   OutputJumpIfJSReceiver(label, 0); | 752   OutputJumpIfJSReceiver(label, 0); | 
| 746   return *this; | 753   return *this; | 
| 747 } | 754 } | 
| 748 | 755 | 
| 749 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpLoop(BytecodeLabel* label, | 756 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpLoop(BytecodeLabel* label, | 
| 750                                                      int loop_depth) { | 757                                                      int loop_depth) { | 
|  | 758   DCHECK(label->is_bound()); | 
| 751   OutputJumpLoop(label, 0, loop_depth); | 759   OutputJumpLoop(label, 0, loop_depth); | 
| 752   return *this; | 760   return *this; | 
| 753 } | 761 } | 
| 754 | 762 | 
| 755 BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck(int position) { | 763 BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck(int position) { | 
| 756   if (position != kNoSourcePosition) { | 764   if (position != kNoSourcePosition) { | 
| 757     // We need to attach a non-breakable source position to a stack | 765     // We need to attach a non-breakable source position to a stack | 
| 758     // check, so we simply add it as expression position. There can be | 766     // check, so we simply add it as expression position. There can be | 
| 759     // a prior statement position from constructs like: | 767     // a prior statement position from constructs like: | 
| 760     // | 768     // | 
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1050     RegisterList reg_list) { | 1058     RegisterList reg_list) { | 
| 1051   DCHECK(RegisterListIsValid(reg_list)); | 1059   DCHECK(RegisterListIsValid(reg_list)); | 
| 1052   if (register_optimizer_) | 1060   if (register_optimizer_) | 
| 1053     register_optimizer_->PrepareOutputRegisterList(reg_list); | 1061     register_optimizer_->PrepareOutputRegisterList(reg_list); | 
| 1054   return static_cast<uint32_t>(reg_list.first_register().ToOperand()); | 1062   return static_cast<uint32_t>(reg_list.first_register().ToOperand()); | 
| 1055 } | 1063 } | 
| 1056 | 1064 | 
| 1057 }  // namespace interpreter | 1065 }  // namespace interpreter | 
| 1058 }  // namespace internal | 1066 }  // namespace internal | 
| 1059 }  // namespace v8 | 1067 }  // namespace v8 | 
| OLD | NEW | 
|---|