Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: test/cctest/compiler/test-jump-threading.cc

Issue 889843003: [turbofan] Don't allocate UnallocatedOperands in Zone memory during instruction selection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 rpo_number_(RpoNumber::FromInt(0)), 24 rpo_number_(RpoNumber::FromInt(0)),
25 current_(NULL) {} 25 current_(NULL) {}
26 26
27 ZoneVector<InstructionBlock*> blocks_; 27 ZoneVector<InstructionBlock*> blocks_;
28 InstructionSequence sequence_; 28 InstructionSequence sequence_;
29 RpoNumber rpo_number_; 29 RpoNumber rpo_number_;
30 InstructionBlock* current_; 30 InstructionBlock* current_;
31 31
32 int Jump(int target) { 32 int Jump(int target) {
33 Start(); 33 Start();
34 InstructionOperand* ops[] = {UseRpo(target)}; 34 InstructionOperand ops[] = {UseRpo(target)};
35 sequence_.AddInstruction(Instruction::New(main_zone(), kArchJmp, 0, NULL, 1, 35 sequence_.AddInstruction(Instruction::New(main_zone(), kArchJmp, 0, NULL, 1,
36 ops, 0, NULL)->MarkAsControl()); 36 ops, 0, NULL)->MarkAsControl());
37 int pos = static_cast<int>(sequence_.instructions().size() - 1); 37 int pos = static_cast<int>(sequence_.instructions().size() - 1);
38 End(); 38 End();
39 return pos; 39 return pos;
40 } 40 }
41 void Fallthru() { 41 void Fallthru() {
42 Start(); 42 Start();
43 End(); 43 End();
44 } 44 }
45 int Branch(int ttarget, int ftarget) { 45 int Branch(int ttarget, int ftarget) {
46 Start(); 46 Start();
47 InstructionOperand* ops[] = {UseRpo(ttarget), UseRpo(ftarget)}; 47 InstructionOperand ops[] = {UseRpo(ttarget), UseRpo(ftarget)};
48 InstructionCode code = 119 | FlagsModeField::encode(kFlags_branch) | 48 InstructionCode code = 119 | FlagsModeField::encode(kFlags_branch) |
49 FlagsConditionField::encode(kEqual); 49 FlagsConditionField::encode(kEqual);
50 sequence_.AddInstruction(Instruction::New(main_zone(), code, 0, NULL, 2, 50 sequence_.AddInstruction(Instruction::New(main_zone(), code, 0, NULL, 2,
51 ops, 0, NULL)->MarkAsControl()); 51 ops, 0, NULL)->MarkAsControl());
52 int pos = static_cast<int>(sequence_.instructions().size() - 1); 52 int pos = static_cast<int>(sequence_.instructions().size() - 1);
53 End(); 53 End();
54 return pos; 54 return pos;
55 } 55 }
56 void Nop() { 56 void Nop() {
57 Start(); 57 Start();
(...skipping 16 matching lines...) Expand all
74 void Other() { 74 void Other() {
75 Start(); 75 Start();
76 sequence_.AddInstruction(Instruction::New(main_zone(), 155)); 76 sequence_.AddInstruction(Instruction::New(main_zone(), 155));
77 } 77 }
78 void End() { 78 void End() {
79 Start(); 79 Start();
80 sequence_.EndBlock(current_->rpo_number()); 80 sequence_.EndBlock(current_->rpo_number());
81 current_ = NULL; 81 current_ = NULL;
82 rpo_number_ = RpoNumber::FromInt(rpo_number_.ToInt() + 1); 82 rpo_number_ = RpoNumber::FromInt(rpo_number_.ToInt() + 1);
83 } 83 }
84 InstructionOperand* UseRpo(int num) { 84 InstructionOperand UseRpo(int num) {
85 int index = sequence_.AddImmediate(Constant(RpoNumber::FromInt(num))); 85 int index = sequence_.AddImmediate(Constant(RpoNumber::FromInt(num)));
86 return ImmediateOperand::Create(index, main_zone()); 86 return ImmediateOperand(index);
87 } 87 }
88 void Start(bool deferred = false) { 88 void Start(bool deferred = false) {
89 if (current_ == NULL) { 89 if (current_ == NULL) {
90 current_ = new (main_zone()) InstructionBlock( 90 current_ = new (main_zone()) InstructionBlock(
91 main_zone(), BasicBlock::Id::FromInt(rpo_number_.ToInt()), 91 main_zone(), BasicBlock::Id::FromInt(rpo_number_.ToInt()),
92 rpo_number_, RpoNumber::Invalid(), RpoNumber::Invalid(), deferred); 92 rpo_number_, RpoNumber::Invalid(), RpoNumber::Invalid(), deferred);
93 blocks_.push_back(current_); 93 blocks_.push_back(current_);
94 sequence_.StartBlock(rpo_number_); 94 sequence_.StartBlock(rpo_number_);
95 } 95 }
96 } 96 }
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 for (int k = 4; k < 5; k++) assembly[k]--; 755 for (int k = 4; k < 5; k++) assembly[k]--;
756 } 756 }
757 CheckAssemblyOrder(code, 5, assembly); 757 CheckAssemblyOrder(code, 5, assembly);
758 } 758 }
759 } 759 }
760 } 760 }
761 761
762 } // namespace compiler 762 } // namespace compiler
763 } // namespace internal 763 } // namespace internal
764 } // namespace v8 764 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-instruction.cc ('k') | test/unittests/compiler/instruction-sequence-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698