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

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: RawLabel -> RawMachineLabel 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
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | test/cctest/compiler/test-basic-block-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(RawMachineLabel* 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, RawMachineLabel* true_val,
62 Label* false_val) { 62 RawMachineLabel* 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, RawMachineLabel* default_label,
71 int32_t* case_values, Label** case_labels, 71 int32_t* case_values,
72 RawMachineLabel** case_labels,
72 size_t case_count) { 73 size_t case_count) {
73 DCHECK_NE(schedule()->end(), current_block_); 74 DCHECK_NE(schedule()->end(), current_block_);
74 size_t succ_count = case_count + 1; 75 size_t succ_count = case_count + 1;
75 Node* switch_node = AddNode(common()->Switch(succ_count), index); 76 Node* switch_node = AddNode(common()->Switch(succ_count), index);
76 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); 77 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count);
77 for (size_t index = 0; index < case_count; ++index) { 78 for (size_t index = 0; index < case_count; ++index) {
78 int32_t case_value = case_values[index]; 79 int32_t case_value = case_values[index];
79 BasicBlock* case_block = Use(case_labels[index]); 80 BasicBlock* case_block = Use(case_labels[index]);
80 Node* case_node = 81 Node* case_node =
81 graph()->NewNode(common()->IfValue(case_value), switch_node); 82 graph()->NewNode(common()->IfValue(case_value), switch_node);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 arg6, 286 arg6,
286 arg7, 287 arg7,
287 graph()->start(), 288 graph()->start(),
288 graph()->start()}; 289 graph()->start()};
289 const CallDescriptor* descriptor = 290 const CallDescriptor* descriptor =
290 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); 291 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
291 return AddNode(common()->Call(descriptor), arraysize(args), args); 292 return AddNode(common()->Call(descriptor), arraysize(args), args);
292 } 293 }
293 294
294 295
295 void RawMachineAssembler::Bind(Label* label) { 296 void RawMachineAssembler::Bind(RawMachineLabel* label) {
296 DCHECK(current_block_ == nullptr); 297 DCHECK(current_block_ == nullptr);
297 DCHECK(!label->bound_); 298 DCHECK(!label->bound_);
298 label->bound_ = true; 299 label->bound_ = true;
299 current_block_ = EnsureBlock(label); 300 current_block_ = EnsureBlock(label);
300 } 301 }
301 302
302 303
303 BasicBlock* RawMachineAssembler::Use(Label* label) { 304 BasicBlock* RawMachineAssembler::Use(RawMachineLabel* label) {
304 label->used_ = true; 305 label->used_ = true;
305 return EnsureBlock(label); 306 return EnsureBlock(label);
306 } 307 }
307 308
308 309
309 BasicBlock* RawMachineAssembler::EnsureBlock(Label* label) { 310 BasicBlock* RawMachineAssembler::EnsureBlock(RawMachineLabel* label) {
310 if (label->block_ == nullptr) label->block_ = schedule()->NewBasicBlock(); 311 if (label->block_ == nullptr) label->block_ = schedule()->NewBasicBlock();
311 return label->block_; 312 return label->block_;
312 } 313 }
313 314
314 315
315 BasicBlock* RawMachineAssembler::CurrentBlock() { 316 BasicBlock* RawMachineAssembler::CurrentBlock() {
316 DCHECK(current_block_); 317 DCHECK(current_block_);
317 return current_block_; 318 return current_block_;
318 } 319 }
319 320
320 321
321 Node* RawMachineAssembler::AddNode(const Operator* op, int input_count, 322 Node* RawMachineAssembler::AddNode(const Operator* op, int input_count,
322 Node** inputs) { 323 Node** inputs) {
323 DCHECK_NOT_NULL(schedule_); 324 DCHECK_NOT_NULL(schedule_);
324 DCHECK(current_block_ != nullptr); 325 DCHECK(current_block_ != nullptr);
325 Node* node = MakeNode(op, input_count, inputs); 326 Node* node = MakeNode(op, input_count, inputs);
326 schedule()->AddNode(CurrentBlock(), node); 327 schedule()->AddNode(CurrentBlock(), node);
327 return node; 328 return node;
328 } 329 }
329 330
330 331
331 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count, 332 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
332 Node** inputs) { 333 Node** inputs) {
333 // The raw machine assembler nodes do not have effect and control inputs, 334 // The raw machine assembler nodes do not have effect and control inputs,
334 // so we disable checking input counts here. 335 // so we disable checking input counts here.
335 return graph()->NewNodeUnchecked(op, input_count, inputs); 336 return graph()->NewNodeUnchecked(op, input_count, inputs);
336 } 337 }
337 338
339
340 RawMachineLabel::RawMachineLabel()
341 : block_(NULL), used_(false), bound_(false) {}
342
343
344 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); }
345
338 } // namespace compiler 346 } // namespace compiler
339 } // namespace internal 347 } // namespace internal
340 } // namespace v8 348 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | test/cctest/compiler/test-basic-block-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698