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

Side by Side Diff: src/compiler/code-stub-assembler.cc

Issue 1493963003: [turbofan] Make RawMachineAssembler handle the end node. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment. 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/code-stub-assembler.h ('k') | src/compiler/common-operator.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/code-stub-assembler.h" 5 #include "src/compiler/code-stub-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 14 matching lines...) Expand all
25 namespace compiler { 25 namespace compiler {
26 26
27 27
28 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, 28 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
29 const CallInterfaceDescriptor& descriptor, 29 const CallInterfaceDescriptor& descriptor,
30 Code::Kind kind, const char* name) 30 Code::Kind kind, const char* name)
31 : raw_assembler_(new RawMachineAssembler( 31 : raw_assembler_(new RawMachineAssembler(
32 isolate, new (zone) Graph(zone), 32 isolate, new (zone) Graph(zone),
33 Linkage::GetStubCallDescriptor(isolate, zone, descriptor, 0, 33 Linkage::GetStubCallDescriptor(isolate, zone, descriptor, 0,
34 CallDescriptor::kNoFlags))), 34 CallDescriptor::kNoFlags))),
35 end_nodes_(zone),
36 kind_(kind), 35 kind_(kind),
37 name_(name), 36 name_(name),
38 code_generated_(false) {} 37 code_generated_(false) {}
39 38
40 39
41 CodeStubAssembler::~CodeStubAssembler() {} 40 CodeStubAssembler::~CodeStubAssembler() {}
42 41
43 42
44 Handle<Code> CodeStubAssembler::GenerateCode() { 43 Handle<Code> CodeStubAssembler::GenerateCode() {
45 DCHECK(!code_generated_); 44 DCHECK(!code_generated_);
46 45
47 End();
48
49 Schedule* schedule = raw_assembler_->Export(); 46 Schedule* schedule = raw_assembler_->Export();
50 Handle<Code> code = Pipeline::GenerateCodeForCodeStub( 47 Handle<Code> code = Pipeline::GenerateCodeForCodeStub(
51 isolate(), raw_assembler_->call_descriptor(), graph(), schedule, kind_, 48 isolate(), raw_assembler_->call_descriptor(), graph(), schedule, kind_,
52 name_); 49 name_);
53 50
54 code_generated_ = true; 51 code_generated_ = true;
55 return code; 52 return code;
56 } 53 }
57 54
58 55
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 154 }
158 155
159 156
160 Node* CodeStubAssembler::TailCallRuntime(Runtime::FunctionId function_id, 157 Node* CodeStubAssembler::TailCallRuntime(Runtime::FunctionId function_id,
161 Node* context, Node* arg1, 158 Node* context, Node* arg1,
162 Node* arg2) { 159 Node* arg2) {
163 return raw_assembler_->TailCallRuntime2(function_id, arg1, arg2, context); 160 return raw_assembler_->TailCallRuntime2(function_id, arg1, arg2, context);
164 } 161 }
165 162
166 163
167 void CodeStubAssembler::AddEndInput(Node* input) {
168 DCHECK_NOT_NULL(input);
169 end_nodes_.push_back(input);
170 }
171
172
173 void CodeStubAssembler::End() {
174 if (end_nodes_.size() == 0) {
175 end_nodes_.push_back(graph()->start());
176 }
177 int end_count = static_cast<int>(end_nodes_.size());
178 Node* end = graph()->NewNode(raw_assembler_->common()->End(end_count),
179 end_count, &end_nodes_[0]);
180 graph()->SetEnd(end);
181 }
182
183
184 // RawMachineAssembler delegate helpers: 164 // RawMachineAssembler delegate helpers:
185 Isolate* CodeStubAssembler::isolate() { return raw_assembler_->isolate(); } 165 Isolate* CodeStubAssembler::isolate() { return raw_assembler_->isolate(); }
186 166
187 167
188 Graph* CodeStubAssembler::graph() { return raw_assembler_->graph(); } 168 Graph* CodeStubAssembler::graph() { return raw_assembler_->graph(); }
189 169
190 170
191 Zone* CodeStubAssembler::zone() { return raw_assembler_->zone(); } 171 Zone* CodeStubAssembler::zone() { return raw_assembler_->zone(); }
192 172
193 173
194 } // namespace compiler 174 } // namespace compiler
195 } // namespace internal 175 } // namespace internal
196 } // namespace v8 176 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-stub-assembler.h ('k') | src/compiler/common-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698