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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 current_(NULL) {} | 23 current_(NULL) {} |
24 | 24 |
25 ZoneVector<InstructionBlock*> blocks_; | 25 ZoneVector<InstructionBlock*> blocks_; |
26 InstructionSequence sequence_; | 26 InstructionSequence sequence_; |
27 RpoNumber rpo_number_; | 27 RpoNumber rpo_number_; |
28 InstructionBlock* current_; | 28 InstructionBlock* current_; |
29 | 29 |
30 int Jump(int target) { | 30 int Jump(int target) { |
31 Start(); | 31 Start(); |
32 InstructionOperand ops[] = {UseRpo(target)}; | 32 InstructionOperand ops[] = {UseRpo(target)}; |
33 sequence_.AddInstruction(Instruction::New(main_zone(), kArchJmp, 0, NULL, 1, | 33 sequence_.AddInstruction( |
34 ops, 0, NULL)->MarkAsControl()); | 34 Instruction::New(main_zone(), kArchJmp, 0, NULL, 1, ops, 0, NULL)); |
35 int pos = static_cast<int>(sequence_.instructions().size() - 1); | 35 int pos = static_cast<int>(sequence_.instructions().size() - 1); |
36 End(); | 36 End(); |
37 return pos; | 37 return pos; |
38 } | 38 } |
39 void Fallthru() { | 39 void Fallthru() { |
40 Start(); | 40 Start(); |
41 End(); | 41 End(); |
42 } | 42 } |
43 int Branch(int ttarget, int ftarget) { | 43 int Branch(int ttarget, int ftarget) { |
44 Start(); | 44 Start(); |
45 InstructionOperand ops[] = {UseRpo(ttarget), UseRpo(ftarget)}; | 45 InstructionOperand ops[] = {UseRpo(ttarget), UseRpo(ftarget)}; |
46 InstructionCode code = 119 | FlagsModeField::encode(kFlags_branch) | | 46 InstructionCode code = 119 | FlagsModeField::encode(kFlags_branch) | |
47 FlagsConditionField::encode(kEqual); | 47 FlagsConditionField::encode(kEqual); |
48 sequence_.AddInstruction(Instruction::New(main_zone(), code, 0, NULL, 2, | 48 sequence_.AddInstruction( |
49 ops, 0, NULL)->MarkAsControl()); | 49 Instruction::New(main_zone(), code, 0, NULL, 2, ops, 0, NULL)); |
50 int pos = static_cast<int>(sequence_.instructions().size() - 1); | 50 int pos = static_cast<int>(sequence_.instructions().size() - 1); |
51 End(); | 51 End(); |
52 return pos; | 52 return pos; |
53 } | 53 } |
54 void Nop() { | 54 void Nop() { |
55 Start(); | 55 Start(); |
56 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop)); | 56 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop)); |
57 } | 57 } |
58 void RedundantMoves() { | 58 void RedundantMoves() { |
59 Start(); | 59 Start(); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 for (int k = 4; k < 5; k++) assembly[k]--; | 753 for (int k = 4; k < 5; k++) assembly[k]--; |
754 } | 754 } |
755 CheckAssemblyOrder(code, 5, assembly); | 755 CheckAssemblyOrder(code, 5, assembly); |
756 } | 756 } |
757 } | 757 } |
758 } | 758 } |
759 | 759 |
760 } // namespace compiler | 760 } // namespace compiler |
761 } // namespace internal | 761 } // namespace internal |
762 } // namespace v8 | 762 } // namespace v8 |
OLD | NEW |