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

Side by Side Diff: src/compiler/raw-machine-assembler.cc

Issue 1477413002: Move RMA::Label out of the class, so it can be forward declared. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback: Move RawLabel class. Created 5 years 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/compiler/raw-machine-assembler.h" 5 #include "src/compiler/raw-machine-assembler.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/pipeline.h" 8 #include "src/compiler/pipeline.h"
9 #include "src/compiler/scheduler.h" 9 #include "src/compiler/scheduler.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return schedule; 44 return schedule;
45 } 45 }
46 46
47 47
48 Node* RawMachineAssembler::Parameter(size_t index) { 48 Node* RawMachineAssembler::Parameter(size_t index) {
49 DCHECK(index < parameter_count()); 49 DCHECK(index < parameter_count());
50 return parameters_[index]; 50 return parameters_[index];
51 } 51 }
52 52
53 53
54 void RawMachineAssembler::Goto(Label* label) { 54 void RawMachineAssembler::Goto(RawLabel* label) {
55 DCHECK(current_block_ != schedule()->end()); 55 DCHECK(current_block_ != schedule()->end());
56 schedule()->AddGoto(CurrentBlock(), Use(label)); 56 schedule()->AddGoto(CurrentBlock(), Use(label));
57 current_block_ = nullptr; 57 current_block_ = nullptr;
58 } 58 }
59 59
60 60
61 void RawMachineAssembler::Branch(Node* condition, Label* true_val, 61 void RawMachineAssembler::Branch(Node* condition, RawLabel* true_val,
62 Label* false_val) { 62 RawLabel* false_val) {
63 DCHECK(current_block_ != schedule()->end()); 63 DCHECK(current_block_ != schedule()->end());
64 Node* branch = AddNode(common()->Branch(), condition); 64 Node* branch = AddNode(common()->Branch(), condition);
65 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); 65 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val));
66 current_block_ = nullptr; 66 current_block_ = nullptr;
67 } 67 }
68 68
69 69
70 void RawMachineAssembler::Switch(Node* index, Label* default_label, 70 void RawMachineAssembler::Switch(Node* index, RawLabel* default_label,
71 int32_t* case_values, Label** case_labels, 71 int32_t* case_values, RawLabel** case_labels,
72 size_t case_count) { 72 size_t case_count) {
73 DCHECK_NE(schedule()->end(), current_block_); 73 DCHECK_NE(schedule()->end(), current_block_);
74 size_t succ_count = case_count + 1; 74 size_t succ_count = case_count + 1;
75 Node* switch_node = AddNode(common()->Switch(succ_count), index); 75 Node* switch_node = AddNode(common()->Switch(succ_count), index);
76 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); 76 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count);
77 for (size_t index = 0; index < case_count; ++index) { 77 for (size_t index = 0; index < case_count; ++index) {
78 int32_t case_value = case_values[index]; 78 int32_t case_value = case_values[index];
79 BasicBlock* case_block = Use(case_labels[index]); 79 BasicBlock* case_block = Use(case_labels[index]);
80 Node* case_node = 80 Node* case_node =
81 graph()->NewNode(common()->IfValue(case_value), switch_node); 81 graph()->NewNode(common()->IfValue(case_value), switch_node);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 arg6, 285 arg6,
286 arg7, 286 arg7,
287 graph()->start(), 287 graph()->start(),
288 graph()->start()}; 288 graph()->start()};
289 const CallDescriptor* descriptor = 289 const CallDescriptor* descriptor =
290 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); 290 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
291 return AddNode(common()->Call(descriptor), arraysize(args), args); 291 return AddNode(common()->Call(descriptor), arraysize(args), args);
292 } 292 }
293 293
294 294
295 void RawMachineAssembler::Bind(Label* label) { 295 void RawMachineAssembler::Bind(RawLabel* label) {
296 DCHECK(current_block_ == nullptr); 296 DCHECK(current_block_ == nullptr);
297 DCHECK(!label->bound_); 297 DCHECK(!label->bound_);
298 label->bound_ = true; 298 label->bound_ = true;
299 current_block_ = EnsureBlock(label); 299 current_block_ = EnsureBlock(label);
300 } 300 }
301 301
302 302
303 BasicBlock* RawMachineAssembler::Use(Label* label) { 303 BasicBlock* RawMachineAssembler::Use(RawLabel* label) {
304 label->used_ = true; 304 label->used_ = true;
305 return EnsureBlock(label); 305 return EnsureBlock(label);
306 } 306 }
307 307
308 308
309 BasicBlock* RawMachineAssembler::EnsureBlock(Label* label) { 309 BasicBlock* RawMachineAssembler::EnsureBlock(RawLabel* label) {
310 if (label->block_ == nullptr) label->block_ = schedule()->NewBasicBlock(); 310 if (label->block_ == nullptr) label->block_ = schedule()->NewBasicBlock();
311 return label->block_; 311 return label->block_;
312 } 312 }
313 313
314 314
315 BasicBlock* RawMachineAssembler::CurrentBlock() { 315 BasicBlock* RawMachineAssembler::CurrentBlock() {
316 DCHECK(current_block_); 316 DCHECK(current_block_);
317 return current_block_; 317 return current_block_;
318 } 318 }
319 319
(...skipping 11 matching lines...) Expand all
331 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count, 331 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
332 Node** inputs) { 332 Node** inputs) {
333 // The raw machine assembler nodes do not have effect and control inputs, 333 // The raw machine assembler nodes do not have effect and control inputs,
334 // so we disable checking input counts here. 334 // so we disable checking input counts here.
335 return graph()->NewNodeUnchecked(op, input_count, inputs); 335 return graph()->NewNodeUnchecked(op, input_count, inputs);
336 } 336 }
337 337
338 } // namespace compiler 338 } // namespace compiler
339 } // namespace internal 339 } // namespace internal
340 } // namespace v8 340 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698