OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 #include "vm/flow_graph_builder.h" | |
6 | |
7 #include "vm/ast.h" | |
8 #include "vm/os.h" | |
9 #include "vm/parser.h" | |
10 | |
11 namespace dart { | |
12 | |
13 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from graph builder."); | |
14 DECLARE_FLAG(bool, enable_type_checks); | |
15 | |
16 class Computation : public ZoneAllocated { }; | |
17 | |
18 | |
19 class Value : public Computation { }; | |
20 | |
21 | |
22 class TempValue : public Value { | |
23 public: | |
24 explicit TempValue(intptr_t index) : index_(index) { } | |
25 | |
26 private: | |
27 uintptr_t index_; | |
srdjan
2012/02/16 14:14:34
->intptr_t (here and elsewhere).
We also add DISA
Kevin Millikin (Google)
2012/02/20 14:50:19
Thanks for reminding me.
It's strictly only neces
| |
28 }; | |
29 | |
30 | |
31 class InstanceValue: public Value { | |
32 public: | |
33 explicit InstanceValue(const Instance& instance) : instance_(instance) { } | |
34 | |
35 private: | |
36 const Instance& instance_; | |
37 }; | |
38 | |
39 | |
40 class AssertAssignableComp : public Computation { | |
41 public: | |
42 explicit AssertAssignableComp(Value* value) : value_(value) { } | |
43 | |
44 private: | |
45 Value* value_; | |
46 }; | |
47 | |
48 | |
49 class InstanceCallComp : public Computation { | |
50 public: | |
51 InstanceCallComp(Value* first, Value* second) : arguments_(2) { | |
52 arguments_.Add(first); | |
53 arguments_.Add(second); | |
54 } | |
55 | |
56 private: | |
57 GrowableArray<Value*> arguments_; | |
58 }; | |
59 | |
60 | |
61 class Instruction : public ZoneAllocated { | |
62 public: | |
63 virtual void set_successor(Instruction* instr) = 0; | |
64 }; | |
65 | |
66 | |
67 class DoInstr : public Instruction { | |
68 public: | |
69 explicit DoInstr(Computation* comp) : computation_(comp), successor_(NULL) { } | |
70 | |
71 virtual void set_successor(Instruction* instr) { successor_ = instr; } | |
72 | |
73 private: | |
74 Computation* computation_; | |
75 Instruction* successor_; | |
76 }; | |
77 | |
78 | |
79 class BindInstr : public Instruction { | |
80 public: | |
81 BindInstr(intptr_t index, Computation* comp) | |
82 : index_(index), computation_(comp), successor_(NULL) { } | |
83 | |
84 virtual void set_successor(Instruction* instr) { successor_ = instr; } | |
85 | |
86 private: | |
87 uintptr_t index_; | |
88 Computation* computation_; | |
89 Instruction* successor_; | |
90 }; | |
91 | |
92 | |
93 class ReturnInstr : public Instruction { | |
94 public: | |
95 explicit ReturnInstr(Value* value) : value_(value) { } | |
96 | |
97 virtual void set_successor(Instruction* instr) { UNREACHABLE(); } | |
98 | |
99 private: | |
100 Value* value_; | |
101 }; | |
102 | |
103 | |
104 class BranchInstr : public Instruction { | |
105 public: | |
106 explicit BranchInstr(Value* value) | |
107 : value_(value), first_successor_(NULL), second_successor_(NULL) { } | |
108 | |
109 virtual void set_successor(Instruction* instr) { UNREACHABLE(); } | |
110 | |
111 Instruction** first_successor_address() { return &first_successor_; } | |
112 Instruction** second_successor_address() { return &second_successor_; } | |
113 | |
114 private: | |
115 Value* value_; | |
116 Instruction* first_successor_; | |
117 Instruction* second_successor_; | |
118 }; | |
119 | |
120 | |
121 class EmptyInstr : public Instruction { | |
122 public: | |
123 EmptyInstr() : successor_(NULL) { } | |
124 | |
125 virtual void set_successor(Instruction* instr) { successor_ = instr; } | |
126 | |
127 private: | |
128 Instruction* successor_; | |
129 }; | |
130 | |
131 | |
132 class JoinInstr : public Instruction { | |
133 public: | |
134 JoinInstr() : successor_(NULL) { } | |
135 | |
136 virtual void set_successor(Instruction* instr) { successor_ = instr; } | |
137 | |
138 private: | |
139 Instruction* successor_; | |
140 }; | |
141 | |
142 | |
143 #define DEFINE_VISIT(type, name) virtual void Visit##type(type* node); | |
144 | |
145 class TestBuilder; | |
146 | |
147 class EffectBuilder : public AstNodeVisitor { | |
148 public: | |
149 EffectBuilder(const FlowGraphBuilder& owner, uintptr_t temp_index) | |
150 : owner_(owner), | |
151 temp_index_(temp_index), | |
152 head_(NULL), | |
153 tail_(NULL), | |
154 bailing_out_(false) { } | |
155 | |
156 NODE_LIST(DEFINE_VISIT) | |
157 | |
158 Instruction* head() const { return head_; } | |
159 Instruction* tail() const { return tail_; } | |
160 uintptr_t temp_index() const { return temp_index_; } | |
161 const FlowGraphBuilder& owner() const { return owner_; } | |
162 | |
163 bool is_empty() const { return head_ == NULL; } | |
164 bool is_open() const { return is_empty() || tail_ != NULL; } | |
165 | |
166 void Bailout(const char* reason) { | |
167 if (FLAG_trace_bailout) { | |
168 OS::Print("Flow Graph Bailout: %s\n", reason); | |
169 } | |
170 bailing_out_ = true; | |
171 } | |
172 | |
173 void Append(const EffectBuilder& other); | |
174 void Append(Instruction* instruction); | |
175 | |
176 void Join(const TestBuilder& for_test, | |
177 const EffectBuilder& for_true, | |
178 const EffectBuilder& for_false); | |
179 | |
180 protected: | |
181 bool bailing_out() const { return bailing_out_; } | |
182 | |
183 // Implement the core part of the translation of expression node types. | |
184 AssertAssignableComp* TranslateAssignableNode(AssignableNode* node); | |
185 InstanceCallComp* TranslateBinaryOpNode(BinaryOpNode* node); | |
186 | |
187 void Close() { tail_ = NULL; } | |
188 uintptr_t AllocateTempIndex() { return temp_index_++; } | |
189 | |
190 private: | |
191 // Input parameters. | |
192 const FlowGraphBuilder& owner_; | |
193 | |
194 // In/out parameters. | |
195 uintptr_t temp_index_; | |
196 | |
197 // Output parameters. | |
198 Instruction* head_; | |
199 Instruction* tail_; | |
200 | |
201 // State. | |
202 bool bailing_out_; | |
203 }; | |
204 | |
205 | |
206 class ValueBuilder : public EffectBuilder { | |
207 public: | |
208 explicit ValueBuilder(const FlowGraphBuilder& owner, uintptr_t temp_index) | |
209 : EffectBuilder(owner, temp_index), value_(NULL) { } | |
210 | |
211 NODE_LIST(DEFINE_VISIT) | |
212 | |
213 Value* value() const { return value_; } | |
214 | |
215 private: | |
216 void ReturnTempValue() { value_ = new TempValue(AllocateTempIndex()); } | |
217 | |
218 // Output parameters. | |
219 Value* value_; | |
220 }; | |
221 | |
222 | |
223 class TestBuilder : public EffectBuilder { | |
224 public: | |
225 explicit TestBuilder(const FlowGraphBuilder& owner, uintptr_t temp_index) | |
226 : EffectBuilder(owner, temp_index), if_true_(NULL), if_false_(NULL) { } | |
227 | |
228 NODE_LIST(DEFINE_VISIT) | |
229 | |
230 bool can_be_true() const { return if_true_ != NULL; } | |
231 bool can_be_false() const { return if_true_ != NULL; } | |
srdjan
2012/02/16 14:14:34
In almost all of code 'can_be_true' and 'can_be_fa
Kevin Millikin (Google)
2012/02/20 14:50:19
There is some value in having them for things like
srdjan
2012/02/21 14:00:21
Since there will be no inlining at AST level this
| |
232 | |
233 Instruction** if_true() const { return if_true_; } | |
234 Instruction** if_false() const { return if_false_; } | |
235 | |
236 private: | |
237 void Branch(Value* value); | |
238 | |
239 // Output parameters. | |
240 Instruction** if_true_; | |
241 Instruction** if_false_; | |
242 }; | |
243 | |
244 #undef DEFINE_VISIT | |
245 | |
246 | |
247 void EffectBuilder::Append(const EffectBuilder& other) { | |
srdjan
2012/02/16 14:14:34
I'd rather use different names than function name
Kevin Millikin (Google)
2012/02/20 14:50:19
Done. Append works on graph fragments, AddInstruc
srdjan
2012/02/21 14:00:21
I assume that was all done in the other CL, will c
| |
248 if (is_empty()) { | |
249 head_ = other.head(); | |
250 tail_ = other.tail(); | |
251 } else if (is_open()) { | |
252 tail()->set_successor(other.head()); | |
253 tail_ = other.tail(); | |
254 } | |
srdjan
2012/02/16 14:14:34
Should an UNREACHABLE be added in an else clause
Kevin Millikin (Google)
2012/02/20 14:50:19
That's a good question. It's sometimes convenient
| |
255 } | |
256 | |
257 | |
258 void EffectBuilder::Append(Instruction* instruction) { | |
srdjan
2012/02/16 14:14:34
ASSERT(instruction->successor() == NULL) ?
Kevin Millikin (Google)
2012/02/20 14:50:19
Asserted in set_successor functions, which makes t
| |
259 if (is_empty()) { | |
260 head_ = tail_ = instruction; | |
261 } else if (is_open()) { | |
262 tail()->set_successor(instruction); | |
263 tail_ = instruction; | |
264 } | |
265 } | |
266 | |
267 | |
268 void EffectBuilder::Join(const TestBuilder& for_test, | |
269 const EffectBuilder& for_true, | |
270 const EffectBuilder& for_false) { | |
271 Instruction* last_true = NULL; | |
272 Instruction* last_false = NULL; | |
273 | |
274 if (for_test.can_be_true()) { | |
275 if (for_true.is_empty()) { | |
276 last_true = new EmptyInstr; | |
srdjan
2012/02/16 14:14:34
We are typically adding parenthesis to constructor
Kevin Millikin (Google)
2012/02/20 14:50:19
Done.
| |
277 *for_test.if_true() = last_true; | |
278 } else { | |
279 *for_test.if_true() = for_true.head(); | |
280 last_true = for_true.tail(); | |
281 } | |
282 } | |
283 | |
284 if (for_test.can_be_false()) { | |
285 if (for_false.is_empty()) { | |
286 *for_test.if_false() = last_false = new EmptyInstr; | |
287 } else { | |
288 *for_test.if_false() = for_false.head(); | |
289 last_false = for_false.tail(); | |
290 } | |
291 } | |
292 | |
293 if (last_true == NULL) { | |
294 tail_ = last_false; // May be NULL. | |
295 } else if (last_false == NULL) { | |
296 tail_ = last_true; | |
297 } else { | |
298 tail_ = new JoinInstr; | |
299 last_true->set_successor(tail_); | |
300 last_false->set_successor(tail_); | |
301 } | |
302 } | |
303 | |
304 | |
305 void TestBuilder::Branch(Value* value) { | |
306 BranchInstr* branch = new BranchInstr(value); | |
307 Append(branch); | |
308 Close(); | |
309 if_true_ = branch->first_successor_address(); | |
310 if_false_ = branch->second_successor_address(); | |
311 } | |
312 | |
313 | |
314 #define CHECK_ALIVE(bailout) \ | |
315 do { \ | |
316 if (bailing_out() || tail() == NULL) { \ | |
317 bailout; \ | |
318 } \ | |
319 } while (false) | |
320 | |
321 | |
322 // <Statement> ::= Return { value: <Expression> | |
323 // inlined_finally_list: <InlinedFinally>* } | |
324 void EffectBuilder::VisitReturnNode(ReturnNode* node) { | |
325 ValueBuilder for_value(owner(), temp_index()); | |
326 node->value()->Visit(&for_value); | |
327 Append(for_value); | |
328 CHECK_ALIVE(return); | |
329 | |
330 for (intptr_t i = 0; i < node->inlined_finally_list_length(); i++) { | |
331 EffectBuilder for_effect(owner(), for_value.temp_index()); | |
332 node->InlinedFinallyNodeAt(i)->Visit(&for_effect); | |
333 Append(for_effect); | |
334 CHECK_ALIVE(return); | |
335 } | |
336 | |
337 Value* return_value = for_value.value(); | |
338 if (FLAG_enable_type_checks) { | |
339 const RawFunction::Kind kind = owner().parsed_function().function().kind(); | |
340 // Implicit getters do not need a type check at return. | |
341 if (kind != RawFunction::kImplicitGetter && | |
342 kind != RawFunction::kConstImplicitGetter) { | |
343 AssertAssignableComp* assert = new AssertAssignableComp(return_value); | |
344 Append(new BindInstr(temp_index(), assert)); | |
345 return_value = new TempValue(temp_index()); | |
346 } | |
347 } | |
348 | |
349 Append(new ReturnInstr(return_value)); | |
350 Close(); | |
351 } | |
352 | |
353 void ValueBuilder::VisitReturnNode(ReturnNode* node) { UNREACHABLE(); } | |
354 void TestBuilder::VisitReturnNode(ReturnNode* node) { UNREACHABLE(); } | |
355 | |
356 | |
357 // <Expression> ::= Literal { literal: Instance } | |
358 void EffectBuilder::VisitLiteralNode(LiteralNode* node) { | |
359 return; | |
360 } | |
361 | |
362 void ValueBuilder::VisitLiteralNode(LiteralNode* node) { | |
363 value_ = new InstanceValue(node->literal()); | |
364 } | |
365 | |
366 void TestBuilder::VisitLiteralNode(LiteralNode* node) { | |
367 Branch(new InstanceValue(node->literal())); | |
368 } | |
369 | |
370 | |
371 // Type nodes only occur as the right-hand side of instanceof comparisons, | |
372 // and they are handled specially in that context. | |
373 void EffectBuilder::VisitTypeNode(TypeNode* node) { UNREACHABLE(); } | |
374 void ValueBuilder::VisitTypeNode(TypeNode* node) { UNREACHABLE(); } | |
375 void TestBuilder::VisitTypeNode(TypeNode* node) { UNREACHABLE(); } | |
376 | |
377 | |
378 // <Expression> :: Assignable { expr: <Expression> | |
379 // type: AbstractType | |
380 // dst_name: String } | |
381 AssertAssignableComp* EffectBuilder::TranslateAssignableNode( | |
382 AssignableNode* node) { | |
383 ValueBuilder for_value(owner(), temp_index()); | |
384 node->expr()->Visit(&for_value); | |
385 Append(for_value); | |
386 CHECK_ALIVE(return NULL); | |
387 | |
388 return new AssertAssignableComp(for_value.value()); | |
389 } | |
390 | |
391 | |
392 void EffectBuilder::VisitAssignableNode(AssignableNode* node) { | |
393 AssertAssignableComp* assert = TranslateAssignableNode(node); | |
394 Append(new DoInstr(assert)); | |
395 } | |
396 | |
397 void ValueBuilder::VisitAssignableNode(AssignableNode* node) { | |
398 AssertAssignableComp* assert = TranslateAssignableNode(node); | |
399 Append(new BindInstr(temp_index(), assert)); | |
400 ReturnTempValue(); | |
401 } | |
402 | |
403 | |
404 void TestBuilder::VisitAssignableNode(AssignableNode* node) { | |
405 AssertAssignableComp* assert = TranslateAssignableNode(node); | |
406 Append(new BindInstr(temp_index(), assert)); | |
407 Branch(new TempValue(temp_index())); | |
408 } | |
409 | |
410 | |
411 // <Expression> :: BinaryOp { kind: Token::Kind | |
412 // left: <Expression> | |
413 // right: <Expression> } | |
414 InstanceCallComp* EffectBuilder::TranslateBinaryOpNode(BinaryOpNode* node) { | |
415 if (node->kind() == Token::kAND || node->kind() == Token::kOR) { | |
416 Bailout("EffectBuilder::VisitBinaryOpNode"); | |
417 return NULL; | |
418 } | |
419 ValueBuilder for_left_value(owner(), temp_index()); | |
420 node->left()->Visit(&for_left_value); | |
421 ValueBuilder for_right_value(owner(), for_left_value.temp_index()); | |
422 node->right()->Visit(&for_right_value); | |
423 return new InstanceCallComp(for_left_value.value(), for_right_value.value()); | |
424 } | |
425 | |
426 | |
427 void EffectBuilder::VisitBinaryOpNode(BinaryOpNode* node) { | |
428 InstanceCallComp* call = TranslateBinaryOpNode(node); | |
429 CHECK_ALIVE(return); | |
430 Append(new DoInstr(call)); | |
431 } | |
432 | |
433 void ValueBuilder::VisitBinaryOpNode(BinaryOpNode* node) { | |
434 InstanceCallComp* call = TranslateBinaryOpNode(node); | |
435 CHECK_ALIVE(return); | |
srdjan
2012/02/16 14:14:34
There seems to be some code duplication between Ef
Kevin Millikin (Google)
2012/02/20 14:50:19
Yeah. I created some helpers.
| |
436 Append(new BindInstr(temp_index(), call)); | |
437 ReturnTempValue(); | |
438 } | |
439 | |
440 void TestBuilder::VisitBinaryOpNode(BinaryOpNode* node) { | |
441 InstanceCallComp* call = TranslateBinaryOpNode(node); | |
442 CHECK_ALIVE(return); | |
443 Append(new BindInstr(temp_index(), call)); | |
444 Branch(new TempValue(temp_index())); | |
445 } | |
446 | |
447 | |
448 void EffectBuilder::VisitStringConcatNode(StringConcatNode* node) { | |
449 Bailout("EffectBuilder::VisitStringConcatNode"); | |
450 } | |
451 void ValueBuilder::VisitStringConcatNode(StringConcatNode* node) { | |
452 Bailout("ValueBuilder::VisitStringConcatNode"); | |
453 } | |
454 void TestBuilder::VisitStringConcatNode(StringConcatNode* node) { | |
455 Bailout("TestBuilder::VisitStringConcatNode"); | |
456 } | |
457 | |
458 | |
459 void EffectBuilder::VisitComparisonNode(ComparisonNode* node) { | |
460 Bailout("EffectBuilder::VisitComparisonNode"); | |
461 } | |
462 void ValueBuilder::VisitComparisonNode(ComparisonNode* node) { | |
463 Bailout("ValueBuilder::VisitComparisonNode"); | |
464 } | |
465 void TestBuilder::VisitComparisonNode(ComparisonNode* node) { | |
466 Bailout("TestBuilder::VisitComparisonNode"); | |
467 } | |
468 | |
469 | |
470 void EffectBuilder::VisitUnaryOpNode(UnaryOpNode* node) { | |
471 Bailout("EffectBuilder::VisitUnaryOpNode"); | |
472 } | |
473 void ValueBuilder::VisitUnaryOpNode(UnaryOpNode* node) { | |
474 Bailout("ValueBuilder::VisitUnaryOpNode"); | |
475 } | |
476 void TestBuilder::VisitUnaryOpNode(UnaryOpNode* node) { | |
477 Bailout("TestBuilder::VisitUnaryOpNode"); | |
478 } | |
479 | |
480 | |
481 void EffectBuilder::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | |
482 Bailout("EffectBuilder::VisitIncrOpLocalNode"); | |
483 } | |
484 void ValueBuilder::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | |
485 Bailout("ValueBuilder::VisitIncrOpLocalNode"); | |
486 } | |
487 void TestBuilder::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | |
488 Bailout("TestBuilder::VisitIncrOpLocalNode"); | |
489 } | |
490 | |
491 | |
492 void EffectBuilder::VisitIncrOpInstanceFieldNode( | |
493 IncrOpInstanceFieldNode* node) { | |
494 Bailout("EffectBuilder::VisitIncrOpInstanceFieldNode"); | |
495 } | |
496 void ValueBuilder::VisitIncrOpInstanceFieldNode(IncrOpInstanceFieldNode* node) { | |
497 Bailout("ValueBuilder::VisitIncrOpInstanceFieldNode"); | |
498 } | |
499 void TestBuilder::VisitIncrOpInstanceFieldNode(IncrOpInstanceFieldNode* node) { | |
500 Bailout("TestBuilder::VisitIncrOpInstanceFieldNode"); | |
501 } | |
502 | |
503 | |
504 void EffectBuilder::VisitIncrOpStaticFieldNode(IncrOpStaticFieldNode* node) { | |
505 Bailout("EffectBuilder::VisitIncrOpStaticFieldNode"); | |
506 } | |
507 void ValueBuilder::VisitIncrOpStaticFieldNode(IncrOpStaticFieldNode* node) { | |
508 Bailout("ValueBuilder::VisitIncrOpStaticFieldNode"); | |
509 } | |
510 void TestBuilder::VisitIncrOpStaticFieldNode(IncrOpStaticFieldNode* node) { | |
511 Bailout("TestBuilder::VisitIncrOpStaticFieldNode"); | |
512 } | |
513 | |
514 | |
515 void EffectBuilder::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { | |
516 Bailout("EffectBuilder::VisitIncrOpIndexedNode"); | |
517 } | |
518 void ValueBuilder::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { | |
519 Bailout("ValueBuilder::VisitIncrOpIndexedNode"); | |
520 } | |
521 void TestBuilder::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { | |
522 Bailout("TestBuilder::VisitIncrOpIndexedNode"); | |
523 } | |
524 | |
525 | |
526 void EffectBuilder::VisitConditionalExprNode(ConditionalExprNode* node) { | |
527 Bailout("EffectBuilder::VisitConditionalExprNode"); | |
528 } | |
529 void ValueBuilder::VisitConditionalExprNode(ConditionalExprNode* node) { | |
530 Bailout("ValueBuilder::VisitConditionalExprNode"); | |
531 } | |
532 void TestBuilder::VisitConditionalExprNode(ConditionalExprNode* node) { | |
533 Bailout("TestBuilder::VisitConditionalExprNode"); | |
534 } | |
535 | |
536 | |
537 // <Statement> ::= If { condition: <Expression> | |
538 // true_branch: <Sequence> | |
539 // false_branch: <Sequence> } | |
540 void EffectBuilder::VisitIfNode(IfNode* node) { | |
541 TestBuilder for_test(owner(), temp_index()); | |
542 node->condition()->Visit(&for_test); | |
543 Append(for_test); | |
544 | |
545 EffectBuilder for_true(owner(), temp_index()); | |
546 EffectBuilder for_false(owner(), temp_index()); | |
547 | |
548 if (for_test.can_be_true()) node->true_branch()->Visit(&for_true); | |
549 if (for_test.can_be_false()) node->false_branch()->Visit(&for_false); | |
srdjan
2012/02/16 14:14:34
node->false_branch() can be NULL.
Kevin Millikin (Google)
2012/02/20 14:50:19
Thanks.
| |
550 Join(for_test, for_true, for_false); | |
551 } | |
552 | |
553 void ValueBuilder::VisitIfNode(IfNode* node) { UNREACHABLE(); } | |
554 void TestBuilder::VisitIfNode(IfNode* node) { UNREACHABLE(); } | |
555 | |
556 | |
557 void EffectBuilder::VisitSwitchNode(SwitchNode* node) { | |
558 Bailout("EffectBuilder::VisitSwitchNode"); | |
559 } | |
560 void ValueBuilder::VisitSwitchNode(SwitchNode* node) { | |
561 Bailout("ValueBuilder::VisitSwitchNode"); | |
562 } | |
563 void TestBuilder::VisitSwitchNode(SwitchNode* node) { | |
564 Bailout("TestBuilder::VisitSwitchNode"); | |
565 } | |
566 | |
567 | |
568 void EffectBuilder::VisitCaseNode(CaseNode* node) { | |
569 Bailout("EffectBuilder::VisitCaseNode"); | |
570 } | |
571 void ValueBuilder::VisitCaseNode(CaseNode* node) { | |
572 Bailout("ValueBuilder::VisitCaseNode"); | |
573 } | |
574 void TestBuilder::VisitCaseNode(CaseNode* node) { | |
575 Bailout("TestBuilder::VisitCaseNode"); | |
576 } | |
577 | |
578 | |
579 void EffectBuilder::VisitWhileNode(WhileNode* node) { | |
580 Bailout("EffectBuilder::VisitWhileNode"); | |
581 } | |
582 void ValueBuilder::VisitWhileNode(WhileNode* node) { | |
583 Bailout("ValueBuilder::VisitWhileNode"); | |
584 } | |
585 void TestBuilder::VisitWhileNode(WhileNode* node) { | |
586 Bailout("TestBuilder::VisitWhileNode"); | |
587 } | |
588 | |
589 | |
590 void EffectBuilder::VisitDoWhileNode(DoWhileNode* node) { | |
591 Bailout("EffectBuilder::VisitDoWhileNode"); | |
592 } | |
593 void ValueBuilder::VisitDoWhileNode(DoWhileNode* node) { | |
594 Bailout("ValueBuilder::VisitDoWhileNode"); | |
595 } | |
596 void TestBuilder::VisitDoWhileNode(DoWhileNode* node) { | |
597 Bailout("TestBuilder::VisitDoWhileNode"); | |
598 } | |
599 | |
600 | |
601 void EffectBuilder::VisitForNode(ForNode* node) { | |
602 Bailout("EffectBuilder::VisitForNode"); | |
603 } | |
604 void ValueBuilder::VisitForNode(ForNode* node) { | |
605 Bailout("ValueBuilder::VisitForNode"); | |
606 } | |
607 void TestBuilder::VisitForNode(ForNode* node) { | |
608 Bailout("TestBuilder::VisitForNode"); | |
609 } | |
610 | |
611 | |
612 void EffectBuilder::VisitJumpNode(JumpNode* node) { | |
613 Bailout("EffectBuilder::VisitJumpNode"); | |
614 } | |
615 void ValueBuilder::VisitJumpNode(JumpNode* node) { | |
616 Bailout("ValueBuilder::VisitJumpNode"); | |
617 } | |
618 void TestBuilder::VisitJumpNode(JumpNode* node) { | |
619 Bailout("TestBuilder::VisitJumpNode"); | |
620 } | |
621 | |
622 | |
623 void EffectBuilder::VisitArgumentListNode(ArgumentListNode* node) { | |
624 Bailout("EffectBuilder::VisitArgumentListNode"); | |
625 } | |
626 void ValueBuilder::VisitArgumentListNode(ArgumentListNode* node) { | |
627 Bailout("ValueBuilder::VisitArgumentListNode"); | |
628 } | |
629 void TestBuilder::VisitArgumentListNode(ArgumentListNode* node) { | |
630 Bailout("TestBuilder::VisitArgumentListNode"); | |
631 } | |
632 | |
633 | |
634 void EffectBuilder::VisitArrayNode(ArrayNode* node) { | |
635 Bailout("EffectBuilder::VisitArrayNode"); | |
636 } | |
637 void ValueBuilder::VisitArrayNode(ArrayNode* node) { | |
638 Bailout("ValueBuilder::VisitArrayNode"); | |
639 } | |
640 void TestBuilder::VisitArrayNode(ArrayNode* node) { | |
641 Bailout("TestBuilder::VisitArrayNode"); | |
642 } | |
643 | |
644 | |
645 void EffectBuilder::VisitClosureNode(ClosureNode* node) { | |
646 Bailout("EffectBuilder::VisitClosureNode"); | |
647 } | |
648 void ValueBuilder::VisitClosureNode(ClosureNode* node) { | |
649 Bailout("ValueBuilder::VisitClosureNode"); | |
650 } | |
651 void TestBuilder::VisitClosureNode(ClosureNode* node) { | |
652 Bailout("TestBuilder::VisitClosureNode"); | |
653 } | |
654 | |
655 | |
656 void EffectBuilder::VisitInstanceCallNode(InstanceCallNode* node) { | |
657 Bailout("EffectBuilder::VisitInstanceCallNode"); | |
658 } | |
659 void ValueBuilder::VisitInstanceCallNode(InstanceCallNode* node) { | |
660 Bailout("ValueBuilder::VisitInstanceCallNode"); | |
661 } | |
662 void TestBuilder::VisitInstanceCallNode(InstanceCallNode* node) { | |
663 Bailout("TestBuilder::VisitInstanceCallNode"); | |
664 } | |
665 | |
666 | |
667 void EffectBuilder::VisitStaticCallNode(StaticCallNode* node) { | |
668 Bailout("EffectBuilder::VisitStaticCallNode"); | |
669 } | |
670 void ValueBuilder::VisitStaticCallNode(StaticCallNode* node) { | |
671 Bailout("ValueBuilder::VisitStaticCallNode"); | |
672 } | |
673 void TestBuilder::VisitStaticCallNode(StaticCallNode* node) { | |
674 Bailout("TestBuilder::VisitStaticCallNode"); | |
675 } | |
676 | |
677 | |
678 void EffectBuilder::VisitClosureCallNode(ClosureCallNode* node) { | |
679 Bailout("EffectBuilder::VisitClosureCallNode"); | |
680 } | |
681 void ValueBuilder::VisitClosureCallNode(ClosureCallNode* node) { | |
682 Bailout("ValueBuilder::VisitClosureCallNode"); | |
683 } | |
684 void TestBuilder::VisitClosureCallNode(ClosureCallNode* node) { | |
685 Bailout("TestBuilder::VisitClosureCallNode"); | |
686 } | |
687 | |
688 | |
689 void EffectBuilder::VisitCloneContextNode(CloneContextNode* node) { | |
690 Bailout("EffectBuilder::VisitCloneContextNode"); | |
691 } | |
692 void ValueBuilder::VisitCloneContextNode(CloneContextNode* node) { | |
693 Bailout("ValueBuilder::VisitCloneContextNode"); | |
694 } | |
695 void TestBuilder::VisitCloneContextNode(CloneContextNode* node) { | |
696 Bailout("TestBuilder::VisitCloneContextNode"); | |
697 } | |
698 | |
699 | |
700 void EffectBuilder::VisitConstructorCallNode(ConstructorCallNode* node) { | |
701 Bailout("EffectBuilder::VisitConstructorCallNode"); | |
702 } | |
703 void ValueBuilder::VisitConstructorCallNode(ConstructorCallNode* node) { | |
704 Bailout("ValueBuilder::VisitConstructorCallNode"); | |
705 } | |
706 void TestBuilder::VisitConstructorCallNode(ConstructorCallNode* node) { | |
707 Bailout("TestBuilder::VisitConstructorCallNode"); | |
708 } | |
709 | |
710 | |
711 void EffectBuilder::VisitInstanceGetterNode(InstanceGetterNode* node) { | |
712 Bailout("EffectBuilder::VisitInstanceGetterNode"); | |
713 } | |
714 void ValueBuilder::VisitInstanceGetterNode(InstanceGetterNode* node) { | |
715 Bailout("ValueBuilder::VisitInstanceGetterNode"); | |
716 } | |
717 void TestBuilder::VisitInstanceGetterNode(InstanceGetterNode* node) { | |
718 Bailout("TestBuilder::VisitInstanceGetterNode"); | |
719 } | |
720 | |
721 | |
722 void EffectBuilder::VisitInstanceSetterNode(InstanceSetterNode* node) { | |
723 Bailout("EffectBuilder::VisitInstanceSetterNode"); | |
724 } | |
725 void ValueBuilder::VisitInstanceSetterNode(InstanceSetterNode* node) { | |
726 Bailout("ValueBuilder::VisitInstanceSetterNode"); | |
727 } | |
728 void TestBuilder::VisitInstanceSetterNode(InstanceSetterNode* node) { | |
729 Bailout("TestBuilder::VisitInstanceSetterNode"); | |
730 } | |
731 | |
732 | |
733 void EffectBuilder::VisitStaticGetterNode(StaticGetterNode* node) { | |
734 Bailout("EffectBuilder::VisitStaticGetterNode"); | |
735 } | |
736 void ValueBuilder::VisitStaticGetterNode(StaticGetterNode* node) { | |
737 Bailout("ValueBuilder::VisitStaticGetterNode"); | |
738 } | |
739 void TestBuilder::VisitStaticGetterNode(StaticGetterNode* node) { | |
740 Bailout("TestBuilder::VisitStaticGetterNode"); | |
741 } | |
742 | |
743 | |
744 void EffectBuilder::VisitStaticSetterNode(StaticSetterNode* node) { | |
745 Bailout("EffectBuilder::VisitStaticSetterNode"); | |
746 } | |
747 void ValueBuilder::VisitStaticSetterNode(StaticSetterNode* node) { | |
748 Bailout("ValueBuilder::VisitStaticSetterNode"); | |
749 } | |
750 void TestBuilder::VisitStaticSetterNode(StaticSetterNode* node) { | |
751 Bailout("TestBuilder::VisitStaticSetterNode"); | |
752 } | |
753 | |
754 | |
755 void EffectBuilder::VisitNativeBodyNode(NativeBodyNode* node) { | |
756 Bailout("EffectBuilder::VisitNativeBodyNode"); | |
757 } | |
758 void ValueBuilder::VisitNativeBodyNode(NativeBodyNode* node) { | |
759 Bailout("ValueBuilder::VisitNativeBodyNode"); | |
760 } | |
761 void TestBuilder::VisitNativeBodyNode(NativeBodyNode* node) { | |
762 Bailout("TestBuilder::VisitNativeBodyNode"); | |
763 } | |
764 | |
765 | |
766 void EffectBuilder::VisitPrimaryNode(PrimaryNode* node) { | |
767 Bailout("EffectBuilder::VisitPrimaryNode"); | |
768 } | |
769 void ValueBuilder::VisitPrimaryNode(PrimaryNode* node) { | |
770 Bailout("ValueBuilder::VisitPrimaryNode"); | |
771 } | |
772 void TestBuilder::VisitPrimaryNode(PrimaryNode* node) { | |
773 Bailout("TestBuilder::VisitPrimaryNode"); | |
774 } | |
775 | |
776 | |
777 void EffectBuilder::VisitLoadLocalNode(LoadLocalNode* node) { | |
778 Bailout("EffectBuilder::VisitLoadLocalNode"); | |
779 } | |
780 void ValueBuilder::VisitLoadLocalNode(LoadLocalNode* node) { | |
781 Bailout("ValueBuilder::VisitLoadLocalNode"); | |
782 } | |
783 void TestBuilder::VisitLoadLocalNode(LoadLocalNode* node) { | |
784 Bailout("TestBuilder::VisitLoadLocalNode"); | |
785 } | |
786 | |
787 | |
788 void EffectBuilder::VisitStoreLocalNode(StoreLocalNode* node) { | |
789 Bailout("EffectBuilder::VisitStoreLocalNode"); | |
790 } | |
791 void ValueBuilder::VisitStoreLocalNode(StoreLocalNode* node) { | |
792 Bailout("ValueBuilder::VisitStoreLocalNode"); | |
793 } | |
794 void TestBuilder::VisitStoreLocalNode(StoreLocalNode* node) { | |
795 Bailout("TestBuilder::VisitStoreLocalNode"); | |
796 } | |
797 | |
798 | |
799 void EffectBuilder::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { | |
800 Bailout("EffectBuilder::VisitLoadInstanceFieldNode"); | |
801 } | |
802 void ValueBuilder::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { | |
803 Bailout("ValueBuilder::VisitLoadInstanceFieldNode"); | |
804 } | |
805 void TestBuilder::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { | |
806 Bailout("TestBuilder::VisitLoadInstanceFieldNode"); | |
807 } | |
808 | |
809 | |
810 void EffectBuilder::VisitStoreInstanceFieldNode(StoreInstanceFieldNode* node) { | |
811 Bailout("EffectBuilder::VisitStoreInstanceFieldNode"); | |
812 } | |
813 void ValueBuilder::VisitStoreInstanceFieldNode(StoreInstanceFieldNode* node) { | |
814 Bailout("ValueBuilder::VisitStoreInstanceFieldNode"); | |
815 } | |
816 void TestBuilder::VisitStoreInstanceFieldNode(StoreInstanceFieldNode* node) { | |
817 Bailout("TestBuilder::VisitStoreInstanceFieldNode"); | |
818 } | |
819 | |
820 | |
821 void EffectBuilder::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { | |
822 Bailout("EffectBuilder::VisitLoadStaticFieldNode"); | |
823 } | |
824 void ValueBuilder::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { | |
825 Bailout("ValueBuilder::VisitLoadStaticFieldNode"); | |
826 } | |
827 void TestBuilder::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { | |
828 Bailout("TestBuilder::VisitLoadStaticFieldNode"); | |
829 } | |
830 | |
831 | |
832 void EffectBuilder::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { | |
833 Bailout("EffectBuilder::VisitStoreStaticFieldNode"); | |
834 } | |
835 void ValueBuilder::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { | |
836 Bailout("ValueBuilder::VisitStoreStaticFieldNode"); | |
837 } | |
838 void TestBuilder::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { | |
839 Bailout("TestBuilder::VisitStoreStaticFieldNode"); | |
840 } | |
841 | |
842 | |
843 void EffectBuilder::VisitLoadIndexedNode(LoadIndexedNode* node) { | |
844 Bailout("EffectBuilder::VisitLoadIndexedNode"); | |
845 } | |
846 void ValueBuilder::VisitLoadIndexedNode(LoadIndexedNode* node) { | |
847 Bailout("ValueBuilder::VisitLoadIndexedNode"); | |
848 } | |
849 void TestBuilder::VisitLoadIndexedNode(LoadIndexedNode* node) { | |
850 Bailout("TestBuilder::VisitLoadIndexedNode"); | |
851 } | |
852 | |
853 | |
854 void EffectBuilder::VisitStoreIndexedNode(StoreIndexedNode* node) { | |
855 Bailout("EffectBuilder::VisitStoreIndexedNode"); | |
856 } | |
857 void ValueBuilder::VisitStoreIndexedNode(StoreIndexedNode* node) { | |
858 Bailout("ValueBuilder::VisitStoreIndexedNode"); | |
859 } | |
860 void TestBuilder::VisitStoreIndexedNode(StoreIndexedNode* node) { | |
861 Bailout("TestBuilder::VisitStoreIndexedNode"); | |
862 } | |
863 | |
864 | |
865 void EffectBuilder::VisitSequenceNode(SequenceNode* node) { | |
866 Bailout("EffectBuilder::VisitSequenceNode"); | |
867 } | |
868 void ValueBuilder::VisitSequenceNode(SequenceNode* node) { | |
869 Bailout("ValueBuilder::VisitSequenceNode"); | |
870 } | |
871 void TestBuilder::VisitSequenceNode(SequenceNode* node) { | |
872 Bailout("TestBuilder::VisitSequenceNode"); | |
873 } | |
874 | |
875 | |
876 void EffectBuilder::VisitCatchClauseNode(CatchClauseNode* node) { | |
877 Bailout("EffectBuilder::VisitCatchClauseNode"); | |
878 } | |
879 void ValueBuilder::VisitCatchClauseNode(CatchClauseNode* node) { | |
880 Bailout("ValueBuilder::VisitCatchClauseNode"); | |
881 } | |
882 void TestBuilder::VisitCatchClauseNode(CatchClauseNode* node) { | |
883 Bailout("TestBuilder::VisitCatchClauseNode"); | |
884 } | |
885 | |
886 | |
887 void EffectBuilder::VisitTryCatchNode(TryCatchNode* node) { | |
888 Bailout("EffectBuilder::VisitTryCatchNode"); | |
889 } | |
890 void ValueBuilder::VisitTryCatchNode(TryCatchNode* node) { | |
891 Bailout("ValueBuilder::VisitTryCatchNode"); | |
892 } | |
893 void TestBuilder::VisitTryCatchNode(TryCatchNode* node) { | |
894 Bailout("TestBuilder::VisitTryCatchNode"); | |
895 } | |
896 | |
897 | |
898 void EffectBuilder::VisitThrowNode(ThrowNode* node) { | |
899 Bailout("EffectBuilder::VisitThrowNode"); | |
900 } | |
901 void ValueBuilder::VisitThrowNode(ThrowNode* node) { | |
902 Bailout("ValueBuilder::VisitThrowNode"); | |
903 } | |
904 void TestBuilder::VisitThrowNode(ThrowNode* node) { | |
905 Bailout("TestBuilder::VisitThrowNode"); | |
906 } | |
907 | |
908 | |
909 void EffectBuilder::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | |
910 Bailout("EffectBuilder::VisitInlinedFinallyNode"); | |
911 } | |
912 void ValueBuilder::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | |
913 Bailout("ValueBuilder::VisitInlinedFinallyNode"); | |
914 } | |
915 void TestBuilder::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | |
916 Bailout("TestBuilder::VisitInlinedFinallyNode"); | |
917 } | |
918 | |
919 | |
920 void FlowGraphBuilder::TraceBailout() const { | |
921 if (FLAG_trace_bailout && bailout_reason_ != NULL) { | |
922 OS::Print("%s", bailout_reason_); | |
923 } | |
924 } | |
925 | |
926 | |
927 void FlowGraphBuilder::BuildGraph() { | |
928 EffectBuilder for_effect(*this, 0); | |
929 parsed_function().node_sequence()->Visit(&for_effect); | |
930 } | |
931 | |
932 } // namespace dart | |
OLD | NEW |