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

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

Issue 754303003: Flesh out vector ic state query and set mechanisms. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 6 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/ast.h ('k') | src/bootstrapper.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 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 dont_crankshaft_reason_ = reason; 62 dont_crankshaft_reason_ = reason;
63 DisableSelfOptimization(); 63 DisableSelfOptimization();
64 properties_.flags()->Add(kDontCache); 64 properties_.flags()->Add(kDontCache);
65 } 65 }
66 66
67 template <typename Node> 67 template <typename Node>
68 void ReserveFeedbackSlots(Node* node) { 68 void ReserveFeedbackSlots(Node* node) {
69 FeedbackVectorRequirements reqs = 69 FeedbackVectorRequirements reqs =
70 node->ComputeFeedbackRequirements(isolate()); 70 node->ComputeFeedbackRequirements(isolate());
71 if (reqs.slots() > 0) { 71 if (reqs.slots() > 0) {
72 node->SetFirstFeedbackSlot( 72 node->SetFirstFeedbackSlot(FeedbackVectorSlot(properties_.slots()));
73 FeedbackVectorSlot(properties_.feedback_slots())); 73 properties_.increase_slots(reqs.slots());
74 properties_.increase_feedback_slots(reqs.slots());
75 } 74 }
76 if (reqs.ic_slots() > 0) { 75 if (reqs.ic_slots() > 0) {
77 node->SetFirstFeedbackICSlot( 76 int ic_slots = properties_.ic_slots();
78 FeedbackVectorICSlot(properties_.ic_feedback_slots())); 77 node->SetFirstFeedbackICSlot(FeedbackVectorICSlot(ic_slots));
79 properties_.increase_ic_feedback_slots(reqs.ic_slots()); 78 properties_.increase_ic_slots(reqs.ic_slots());
79 if (FLAG_vector_ics) {
80 for (int i = 0; i < reqs.ic_slots(); i++) {
81 properties_.SetKind(ic_slots + i, node->FeedbackICSlotKind(i));
82 }
83 }
80 } 84 }
81 } 85 }
82 86
83 BailoutReason dont_optimize_reason() const { 87 BailoutReason dont_optimize_reason() const {
84 return (dont_turbofan_reason_ != kNoReason) ? dont_turbofan_reason_ 88 return (dont_turbofan_reason_ != kNoReason) ? dont_turbofan_reason_
85 : dont_crankshaft_reason_; 89 : dont_crankshaft_reason_;
86 } 90 }
87 91
88 int next_id_; 92 int next_id_;
89 AstProperties properties_; 93 AstProperties properties_;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 282
279 void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) { 283 void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) {
280 IncrementNodeCount(); 284 IncrementNodeCount();
281 DisableCaching(kModuleLiteral); 285 DisableCaching(kModuleLiteral);
282 VisitBlock(node->body()); 286 VisitBlock(node->body());
283 } 287 }
284 288
285 289
286 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { 290 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
287 IncrementNodeCount(); 291 IncrementNodeCount();
292 ReserveFeedbackSlots(node);
288 if (node->is_jsruntime()) { 293 if (node->is_jsruntime()) {
289 // Don't try to optimize JS runtime calls because we bailout on them. 294 // Don't try to optimize JS runtime calls because we bailout on them.
290 DisableCrankshaft(kCallToAJavaScriptRuntimeFunction); 295 DisableCrankshaft(kCallToAJavaScriptRuntimeFunction);
291 } 296 }
292 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); 297 node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
293 VisitArguments(node->arguments()); 298 VisitArguments(node->arguments());
294 } 299 }
295 300
296 301
297 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { 302 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 IncrementNodeCount(); 533 IncrementNodeCount();
529 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); 534 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids()));
530 // We don't recurse into the declarations or body of the function literal: 535 // We don't recurse into the declarations or body of the function literal:
531 // you have to separately Renumber() each FunctionLiteral that you compile. 536 // you have to separately Renumber() each FunctionLiteral that you compile.
532 } 537 }
533 538
534 539
535 void AstNumberingVisitor::Renumber(FunctionLiteral* node) { 540 void AstNumberingVisitor::Renumber(FunctionLiteral* node) {
536 if (node->scope()->HasIllegalRedeclaration()) { 541 if (node->scope()->HasIllegalRedeclaration()) {
537 node->scope()->VisitIllegalRedeclaration(this); 542 node->scope()->VisitIllegalRedeclaration(this);
543 node->set_ast_properties(&properties_);
538 return; 544 return;
539 } 545 }
540 546
541 Scope* scope = node->scope(); 547 Scope* scope = node->scope();
542 VisitDeclarations(scope->declarations()); 548 VisitDeclarations(scope->declarations());
543 if (scope->is_function_scope() && scope->function() != NULL) { 549 if (scope->is_function_scope() && scope->function() != NULL) {
544 // Visit the name of the named function expression. 550 // Visit the name of the named function expression.
545 Visit(scope->function()); 551 Visit(scope->function());
546 } 552 }
547 VisitStatements(node->body()); 553 VisitStatements(node->body());
548 554
549 node->set_ast_properties(&properties_); 555 node->set_ast_properties(&properties_);
550 node->set_dont_optimize_reason(dont_optimize_reason()); 556 node->set_dont_optimize_reason(dont_optimize_reason());
551 } 557 }
552 558
553 559
554 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { 560 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) {
555 AstNumberingVisitor visitor(zone); 561 AstNumberingVisitor visitor(zone);
556 visitor.Renumber(function); 562 visitor.Renumber(function);
557 return !visitor.HasStackOverflow(); 563 return !visitor.HasStackOverflow();
558 } 564 }
559 } 565 }
560 } // namespace v8::internal 566 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698