OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
9 #include "src/compiler/instruction-codes.h" | 9 #include "src/compiler/instruction-codes.h" |
10 #include "src/compiler/jump-threading.h" | 10 #include "src/compiler/jump-threading.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace compiler { | 14 namespace compiler { |
15 | 15 |
16 typedef BasicBlock::RpoNumber RpoNumber; | |
17 | |
18 class TestCode : public HandleAndZoneScope { | 16 class TestCode : public HandleAndZoneScope { |
19 public: | 17 public: |
20 TestCode() | 18 TestCode() |
21 : HandleAndZoneScope(), | 19 : HandleAndZoneScope(), |
22 blocks_(main_zone()), | 20 blocks_(main_zone()), |
23 sequence_(main_isolate(), main_zone(), &blocks_), | 21 sequence_(main_isolate(), main_zone(), &blocks_), |
24 rpo_number_(RpoNumber::FromInt(0)), | 22 rpo_number_(RpoNumber::FromInt(0)), |
25 current_(NULL) {} | 23 current_(NULL) {} |
26 | 24 |
27 ZoneVector<InstructionBlock*> blocks_; | 25 ZoneVector<InstructionBlock*> blocks_; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 sequence_.EndBlock(current_->rpo_number()); | 78 sequence_.EndBlock(current_->rpo_number()); |
81 current_ = NULL; | 79 current_ = NULL; |
82 rpo_number_ = RpoNumber::FromInt(rpo_number_.ToInt() + 1); | 80 rpo_number_ = RpoNumber::FromInt(rpo_number_.ToInt() + 1); |
83 } | 81 } |
84 InstructionOperand UseRpo(int num) { | 82 InstructionOperand UseRpo(int num) { |
85 int index = sequence_.AddImmediate(Constant(RpoNumber::FromInt(num))); | 83 int index = sequence_.AddImmediate(Constant(RpoNumber::FromInt(num))); |
86 return ImmediateOperand(index); | 84 return ImmediateOperand(index); |
87 } | 85 } |
88 void Start(bool deferred = false) { | 86 void Start(bool deferred = false) { |
89 if (current_ == NULL) { | 87 if (current_ == NULL) { |
90 current_ = new (main_zone()) InstructionBlock( | 88 current_ = new (main_zone()) |
91 main_zone(), BasicBlock::Id::FromInt(rpo_number_.ToInt()), | 89 InstructionBlock(main_zone(), rpo_number_, RpoNumber::Invalid(), |
92 rpo_number_, RpoNumber::Invalid(), RpoNumber::Invalid(), deferred); | 90 RpoNumber::Invalid(), deferred); |
93 blocks_.push_back(current_); | 91 blocks_.push_back(current_); |
94 sequence_.StartBlock(rpo_number_); | 92 sequence_.StartBlock(rpo_number_); |
95 } | 93 } |
96 } | 94 } |
97 void Defer() { | 95 void Defer() { |
98 CHECK(current_ == NULL); | 96 CHECK(current_ == NULL); |
99 Start(true); | 97 Start(true); |
100 } | 98 } |
101 }; | 99 }; |
102 | 100 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 for (int k = 4; k < 5; k++) assembly[k]--; | 753 for (int k = 4; k < 5; k++) assembly[k]--; |
756 } | 754 } |
757 CheckAssemblyOrder(code, 5, assembly); | 755 CheckAssemblyOrder(code, 5, assembly); |
758 } | 756 } |
759 } | 757 } |
760 } | 758 } |
761 | 759 |
762 } // namespace compiler | 760 } // namespace compiler |
763 } // namespace internal | 761 } // namespace internal |
764 } // namespace v8 | 762 } // namespace v8 |
OLD | NEW |