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

Side by Side Diff: src/ast-numbering.cc

Issue 1387383005: Eagerly extract stack limit from Isolate in InitializeAstVisitor() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/ast.h ('k') | src/compiler/ast-graph-builder.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 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/ast-numbering.h" 5 #include "src/ast-numbering.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/scopes.h" 8 #include "src/scopes.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 class AstNumberingVisitor final : public AstVisitor { 13 class AstNumberingVisitor final : public AstVisitor {
14 public: 14 public:
15 AstNumberingVisitor(Isolate* isolate, Zone* zone) 15 AstNumberingVisitor(Isolate* isolate, Zone* zone)
16 : AstVisitor(), 16 : AstVisitor(),
17 isolate_(isolate),
17 next_id_(BailoutId::FirstUsable().ToInt()), 18 next_id_(BailoutId::FirstUsable().ToInt()),
18 properties_(zone), 19 properties_(zone),
19 slot_cache_(zone), 20 slot_cache_(zone),
20 dont_optimize_reason_(kNoReason) { 21 dont_optimize_reason_(kNoReason) {
21 InitializeAstVisitor(isolate, zone); 22 InitializeAstVisitor(isolate, zone);
22 } 23 }
23 24
24 bool Renumber(FunctionLiteral* node); 25 bool Renumber(FunctionLiteral* node);
25 26
26 private: 27 private:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (FLAG_turbo_shipping) { 59 if (FLAG_turbo_shipping) {
59 properties_.flags() |= AstProperties::kDontCrankshaft; 60 properties_.flags() |= AstProperties::kDontCrankshaft;
60 } else { 61 } else {
61 dont_optimize_reason_ = reason; 62 dont_optimize_reason_ = reason;
62 DisableSelfOptimization(); 63 DisableSelfOptimization();
63 } 64 }
64 } 65 }
65 66
66 template <typename Node> 67 template <typename Node>
67 void ReserveFeedbackSlots(Node* node) { 68 void ReserveFeedbackSlots(Node* node) {
68 node->AssignFeedbackVectorSlots(isolate(), properties_.get_spec(), 69 node->AssignFeedbackVectorSlots(isolate_, properties_.get_spec(),
69 &slot_cache_); 70 &slot_cache_);
70 } 71 }
71 72
72 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; } 73 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; }
73 74
75 Isolate* isolate_;
74 int next_id_; 76 int next_id_;
75 AstProperties properties_; 77 AstProperties properties_;
76 // The slot cache allows us to reuse certain feedback vector slots. 78 // The slot cache allows us to reuse certain feedback vector slots.
77 FeedbackVectorSlotCache slot_cache_; 79 FeedbackVectorSlotCache slot_cache_;
78 BailoutReason dont_optimize_reason_; 80 BailoutReason dont_optimize_reason_;
79 81
80 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 82 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
81 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); 83 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor);
82 }; 84 };
83 85
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 ReserveFeedbackSlots(node); 461 ReserveFeedbackSlots(node);
460 } 462 }
461 463
462 464
463 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { 465 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) {
464 IncrementNodeCount(); 466 IncrementNodeCount();
465 node->set_base_id(ReserveIdRange(node->num_ids())); 467 node->set_base_id(ReserveIdRange(node->num_ids()));
466 for (int i = 0; i < node->properties()->length(); i++) { 468 for (int i = 0; i < node->properties()->length(); i++) {
467 VisitObjectLiteralProperty(node->properties()->at(i)); 469 VisitObjectLiteralProperty(node->properties()->at(i));
468 } 470 }
469 node->BuildConstantProperties(isolate()); 471 node->BuildConstantProperties(isolate_);
470 // Mark all computed expressions that are bound to a key that 472 // Mark all computed expressions that are bound to a key that
471 // is shadowed by a later occurrence of the same key. For the 473 // is shadowed by a later occurrence of the same key. For the
472 // marked expressions, no store code will be is emitted. 474 // marked expressions, no store code will be is emitted.
473 node->CalculateEmitStore(zone()); 475 node->CalculateEmitStore(zone());
474 ReserveFeedbackSlots(node); 476 ReserveFeedbackSlots(node);
475 } 477 }
476 478
477 479
478 void AstNumberingVisitor::VisitObjectLiteralProperty( 480 void AstNumberingVisitor::VisitObjectLiteralProperty(
479 ObjectLiteralProperty* node) { 481 ObjectLiteralProperty* node) {
480 if (node->is_computed_name()) DisableCrankshaft(kComputedPropertyName); 482 if (node->is_computed_name()) DisableCrankshaft(kComputedPropertyName);
481 Visit(node->key()); 483 Visit(node->key());
482 Visit(node->value()); 484 Visit(node->value());
483 } 485 }
484 486
485 487
486 void AstNumberingVisitor::VisitArrayLiteral(ArrayLiteral* node) { 488 void AstNumberingVisitor::VisitArrayLiteral(ArrayLiteral* node) {
487 IncrementNodeCount(); 489 IncrementNodeCount();
488 node->set_base_id(ReserveIdRange(node->num_ids())); 490 node->set_base_id(ReserveIdRange(node->num_ids()));
489 for (int i = 0; i < node->values()->length(); i++) { 491 for (int i = 0; i < node->values()->length(); i++) {
490 Visit(node->values()->at(i)); 492 Visit(node->values()->at(i));
491 } 493 }
492 node->BuildConstantElements(isolate()); 494 node->BuildConstantElements(isolate_);
493 ReserveFeedbackSlots(node); 495 ReserveFeedbackSlots(node);
494 } 496 }
495 497
496 498
497 void AstNumberingVisitor::VisitCall(Call* node) { 499 void AstNumberingVisitor::VisitCall(Call* node) {
498 IncrementNodeCount(); 500 IncrementNodeCount();
499 ReserveFeedbackSlots(node); 501 ReserveFeedbackSlots(node);
500 node->set_base_id(ReserveIdRange(Call::num_ids())); 502 node->set_base_id(ReserveIdRange(Call::num_ids()));
501 Visit(node->expression()); 503 Visit(node->expression());
502 VisitArguments(node->arguments()); 504 VisitArguments(node->arguments());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 572 }
571 573
572 574
573 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, 575 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone,
574 FunctionLiteral* function) { 576 FunctionLiteral* function) {
575 AstNumberingVisitor visitor(isolate, zone); 577 AstNumberingVisitor visitor(isolate, zone);
576 return visitor.Renumber(function); 578 return visitor.Renumber(function);
577 } 579 }
578 } // namespace internal 580 } // namespace internal
579 } // namespace v8 581 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/compiler/ast-graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698