OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 int ReserveIdRange(int n) { | 41 int ReserveIdRange(int n) { |
42 int tmp = next_id_; | 42 int tmp = next_id_; |
43 next_id_ += n; | 43 next_id_ += n; |
44 return tmp; | 44 return tmp; |
45 } | 45 } |
46 | 46 |
47 void IncrementNodeCount() { properties_.add_node_count(1); } | 47 void IncrementNodeCount() { properties_.add_node_count(1); } |
48 void DisableCrankshaft(BailoutReason reason) { | 48 void DisableCrankshaft(BailoutReason reason) { |
49 dont_crankshaft_reason_ = reason; | 49 dont_crankshaft_reason_ = reason; |
50 properties_.flags()->Add(kDontSelfOptimize); | 50 DisableSelfOptimization(); |
51 } | 51 } |
52 // TODO(turbofan): Remove the dont_turbofan_reason once no nodes are | 52 // TODO(turbofan): Remove the dont_turbofan_reason once no nodes are |
53 // DontTurbofanNode. That set of nodes must be kept in sync with | 53 // DisableTurbofan. That set of nodes must be kept in sync with |
54 // Pipeline::GenerateCode. | 54 // Pipeline::GenerateCode. |
55 void DisableTurbofan(BailoutReason reason) { | 55 void DisableTurbofan(BailoutReason reason) { |
56 dont_crankshaft_reason_ = reason; | 56 dont_crankshaft_reason_ = reason; |
57 dont_turbofan_reason_ = reason; | 57 dont_turbofan_reason_ = reason; |
58 DisableSelfOptimization(); | 58 DisableSelfOptimization(); |
59 } | 59 } |
60 void DisableSelfOptimization() { | 60 void DisableSelfOptimization() { |
61 properties_.flags()->Add(kDontSelfOptimize); | 61 properties_.flags()->Add(kDontSelfOptimize); |
62 } | 62 } |
63 void DisableCaching(BailoutReason reason) { | 63 void DisableCaching(BailoutReason reason) { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 ReserveFeedbackSlots(node); | 383 ReserveFeedbackSlots(node); |
384 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); | 384 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); |
385 Visit(node->each()); | 385 Visit(node->each()); |
386 Visit(node->enumerable()); | 386 Visit(node->enumerable()); |
387 Visit(node->body()); | 387 Visit(node->body()); |
388 } | 388 } |
389 | 389 |
390 | 390 |
391 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { | 391 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { |
392 IncrementNodeCount(); | 392 IncrementNodeCount(); |
393 DisableTurbofan(kForOfStatement); | 393 DisableCrankshaft(kForOfStatement); |
adamk
2015/01/13 19:02:36
Does this mean that any function that happens to u
Michael Starzinger
2015/01/13 19:28:01
Not yet, there are two things missing. First you w
| |
394 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); | 394 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); |
395 Visit(node->assign_iterator()); | 395 Visit(node->assign_iterator()); |
396 Visit(node->next_result()); | 396 Visit(node->next_result()); |
397 Visit(node->result_done()); | 397 Visit(node->result_done()); |
398 Visit(node->assign_each()); | 398 Visit(node->assign_each()); |
399 Visit(node->body()); | 399 Visit(node->body()); |
400 } | 400 } |
401 | 401 |
402 | 402 |
403 void AstNumberingVisitor::VisitConditional(Conditional* node) { | 403 void AstNumberingVisitor::VisitConditional(Conditional* node) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 return Finish(node); | 569 return Finish(node); |
570 } | 570 } |
571 | 571 |
572 | 572 |
573 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { | 573 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { |
574 AstNumberingVisitor visitor(zone); | 574 AstNumberingVisitor visitor(zone); |
575 return visitor.Renumber(function); | 575 return visitor.Renumber(function); |
576 } | 576 } |
577 } | 577 } |
578 } // namespace v8::internal | 578 } // namespace v8::internal |
OLD | NEW |