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

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

Issue 892513003: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Wuschelstudio build. 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
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/schedule.h » ('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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/pipeline.h" 6 #include "src/compiler/pipeline.h"
7 #include "src/compiler/raw-machine-assembler.h" 7 #include "src/compiler/raw-machine-assembler.h"
8 #include "src/compiler/scheduler.h" 8 #include "src/compiler/scheduler.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 void RawMachineAssembler::Branch(Node* condition, Label* true_val, 70 void RawMachineAssembler::Branch(Node* condition, Label* true_val,
71 Label* false_val) { 71 Label* false_val) {
72 DCHECK(current_block_ != schedule()->end()); 72 DCHECK(current_block_ != schedule()->end());
73 Node* branch = NewNode(common()->Branch(), condition); 73 Node* branch = NewNode(common()->Branch(), condition);
74 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); 74 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val));
75 current_block_ = NULL; 75 current_block_ = NULL;
76 } 76 }
77 77
78 78
79 void RawMachineAssembler::Switch(Node* index, Label** succ_labels,
80 size_t succ_count) {
81 DCHECK_NE(schedule()->end(), current_block_);
82 Node* sw = NewNode(common()->Switch(succ_count), index);
83 BasicBlock** succ_blocks =
84 zone()->NewArray<BasicBlock*>(static_cast<int>(succ_count));
85 for (size_t index = 0; index < succ_count; ++index) {
86 succ_blocks[index] = Use(succ_labels[index]);
87 }
88 schedule()->AddSwitch(CurrentBlock(), sw, succ_blocks, succ_count);
89 current_block_ = nullptr;
90 }
91
92
79 void RawMachineAssembler::Return(Node* value) { 93 void RawMachineAssembler::Return(Node* value) {
80 schedule()->AddReturn(CurrentBlock(), value); 94 schedule()->AddReturn(CurrentBlock(), value);
81 current_block_ = NULL; 95 current_block_ = NULL;
82 } 96 }
83 97
84 98
85 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, 99 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver,
86 Node* context, Node* frame_state, 100 Node* context, Node* frame_state,
87 CallFunctionFlags flags) { 101 CallFunctionFlags flags) {
88 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags); 102 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 Node* node = graph()->NewNode(op, input_count, inputs, incomplete); 173 Node* node = graph()->NewNode(op, input_count, inputs, incomplete);
160 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() 174 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start()
161 : CurrentBlock(); 175 : CurrentBlock();
162 schedule()->AddNode(block, node); 176 schedule()->AddNode(block, node);
163 return node; 177 return node;
164 } 178 }
165 179
166 } // namespace compiler 180 } // namespace compiler
167 } // namespace internal 181 } // namespace internal
168 } // namespace v8 182 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/schedule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698