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

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

Issue 1090393003: Simplified 'return' handling in the instruction selector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/instruction-selector.cc ('k') | no next file » | 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 BasicBlock* default_block = Use(default_label); 94 BasicBlock* default_block = Use(default_label);
95 Node* default_node = graph()->NewNode(common()->IfDefault(), switch_node); 95 Node* default_node = graph()->NewNode(common()->IfDefault(), switch_node);
96 schedule()->AddNode(default_block, default_node); 96 schedule()->AddNode(default_block, default_node);
97 succ_blocks[case_count] = default_block; 97 succ_blocks[case_count] = default_block;
98 schedule()->AddSwitch(CurrentBlock(), switch_node, succ_blocks, succ_count); 98 schedule()->AddSwitch(CurrentBlock(), switch_node, succ_blocks, succ_count);
99 current_block_ = nullptr; 99 current_block_ = nullptr;
100 } 100 }
101 101
102 102
103 void RawMachineAssembler::Return(Node* value) { 103 void RawMachineAssembler::Return(Node* value) {
104 schedule()->AddReturn(CurrentBlock(), value); 104 Node* ret = NewNode(common()->Return(), value);
105 schedule()->AddReturn(CurrentBlock(), ret);
105 current_block_ = NULL; 106 current_block_ = NULL;
106 } 107 }
107 108
108 109
109 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, 110 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver,
110 Node* context, Node* frame_state, 111 Node* context, Node* frame_state,
111 CallFunctionFlags flags) { 112 CallFunctionFlags flags) {
112 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags); 113 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags);
113 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 114 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
114 isolate(), zone(), callable.descriptor(), 1, 115 isolate(), zone(), callable.descriptor(), 1,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 177 }
177 178
178 179
179 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count, 180 Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
180 Node** inputs, bool incomplete) { 181 Node** inputs, bool incomplete) {
181 DCHECK(ScheduleValid()); 182 DCHECK(ScheduleValid());
182 DCHECK(current_block_ != NULL); 183 DCHECK(current_block_ != NULL);
183 Node* node = graph()->NewNode(op, input_count, inputs, incomplete); 184 Node* node = graph()->NewNode(op, input_count, inputs, incomplete);
184 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() 185 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start()
185 : CurrentBlock(); 186 : CurrentBlock();
186 schedule()->AddNode(block, node); 187 if (op->opcode() != IrOpcode::kReturn) {
188 schedule()->AddNode(block, node);
189 }
187 return node; 190 return node;
188 } 191 }
189 192
190 } // namespace compiler 193 } // namespace compiler
191 } // namespace internal 194 } // namespace internal
192 } // namespace v8 195 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698