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

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

Issue 1155503002: [turbofan] Prepare mechanism to enable TF on language subset. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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.cc » ('j') | src/compiler.cc » ('J')
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/scopes.h" 9 #include "src/scopes.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 void IncrementNodeCount() { properties_.add_node_count(1); } 47 void IncrementNodeCount() { properties_.add_node_count(1); }
48 void DisableSelfOptimization() { 48 void DisableSelfOptimization() {
49 properties_.flags()->Add(kDontSelfOptimize); 49 properties_.flags()->Add(kDontSelfOptimize);
50 } 50 }
51 void DisableOptimization(BailoutReason reason) { 51 void DisableOptimization(BailoutReason reason) {
52 dont_optimize_reason_ = reason; 52 dont_optimize_reason_ = reason;
53 DisableSelfOptimization(); 53 DisableSelfOptimization();
54 } 54 }
55 void DisableCrankshaft(BailoutReason reason) {
56 properties_.flags()->Add(kDontCrankshaft);
57 if (FLAG_turbo_shipping) return;
58 dont_optimize_reason_ = reason;
59 DisableSelfOptimization();
60 }
55 void DisableCaching(BailoutReason reason) { 61 void DisableCaching(BailoutReason reason) {
56 dont_optimize_reason_ = reason; 62 dont_optimize_reason_ = reason;
57 DisableSelfOptimization(); 63 DisableSelfOptimization();
58 properties_.flags()->Add(kDontCache); 64 properties_.flags()->Add(kDontCache);
59 } 65 }
60 66
61 template <typename Node> 67 template <typename Node>
62 void ReserveFeedbackSlots(Node* node) { 68 void ReserveFeedbackSlots(Node* node) {
63 FeedbackVectorRequirements reqs = 69 FeedbackVectorRequirements reqs =
64 node->ComputeFeedbackRequirements(isolate(), &ic_slot_cache_); 70 node->ComputeFeedbackRequirements(isolate(), &ic_slot_cache_);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 147
142 void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) { 148 void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) {
143 IncrementNodeCount(); 149 IncrementNodeCount();
144 node->set_base_id(ReserveIdRange(RegExpLiteral::num_ids())); 150 node->set_base_id(ReserveIdRange(RegExpLiteral::num_ids()));
145 } 151 }
146 152
147 153
148 void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) { 154 void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) {
149 IncrementNodeCount(); 155 IncrementNodeCount();
150 if (node->var()->IsLookupSlot()) { 156 if (node->var()->IsLookupSlot()) {
151 DisableOptimization(kReferenceToAVariableWhichRequiresDynamicLookup); 157 DisableCrankshaft(kReferenceToAVariableWhichRequiresDynamicLookup);
152 } 158 }
153 ReserveFeedbackSlots(node); 159 ReserveFeedbackSlots(node);
154 node->set_base_id(ReserveIdRange(VariableProxy::num_ids())); 160 node->set_base_id(ReserveIdRange(VariableProxy::num_ids()));
155 } 161 }
156 162
157 163
158 void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) { 164 void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) {
159 IncrementNodeCount(); 165 IncrementNodeCount();
160 node->set_base_id(ReserveIdRange(ThisFunction::num_ids())); 166 node->set_base_id(ReserveIdRange(ThisFunction::num_ids()));
161 } 167 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Don't try to optimize JS runtime calls because we bailout on them. 248 // Don't try to optimize JS runtime calls because we bailout on them.
243 DisableOptimization(kCallToAJavaScriptRuntimeFunction); 249 DisableOptimization(kCallToAJavaScriptRuntimeFunction);
244 } 250 }
245 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); 251 node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
246 VisitArguments(node->arguments()); 252 VisitArguments(node->arguments());
247 } 253 }
248 254
249 255
250 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { 256 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) {
251 IncrementNodeCount(); 257 IncrementNodeCount();
252 DisableOptimization(kWithStatement); 258 DisableCrankshaft(kWithStatement);
253 node->set_base_id(ReserveIdRange(WithStatement::num_ids())); 259 node->set_base_id(ReserveIdRange(WithStatement::num_ids()));
254 Visit(node->expression()); 260 Visit(node->expression());
255 Visit(node->statement()); 261 Visit(node->statement());
256 } 262 }
257 263
258 264
259 void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) { 265 void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
260 IncrementNodeCount(); 266 IncrementNodeCount();
261 DisableSelfOptimization(); 267 DisableSelfOptimization();
262 node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids())); 268 node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids()));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ReserveFeedbackSlots(node); 343 ReserveFeedbackSlots(node);
338 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); 344 node->set_base_id(ReserveIdRange(ForInStatement::num_ids()));
339 Visit(node->each()); 345 Visit(node->each());
340 Visit(node->enumerable()); 346 Visit(node->enumerable());
341 Visit(node->body()); 347 Visit(node->body());
342 } 348 }
343 349
344 350
345 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { 351 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) {
346 IncrementNodeCount(); 352 IncrementNodeCount();
347 DisableOptimization(kForOfStatement); 353 DisableCrankshaft(kForOfStatement);
348 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); 354 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids()));
349 Visit(node->assign_iterator()); 355 Visit(node->assign_iterator());
350 Visit(node->next_result()); 356 Visit(node->next_result());
351 Visit(node->result_done()); 357 Visit(node->result_done());
352 Visit(node->assign_each()); 358 Visit(node->assign_each());
353 Visit(node->body()); 359 Visit(node->body());
354 } 360 }
355 361
356 362
357 void AstNumberingVisitor::VisitConditional(Conditional* node) { 363 void AstNumberingVisitor::VisitConditional(Conditional* node) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 bool AstNumberingVisitor::Renumber(FunctionLiteral* node) { 510 bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
505 Scope* scope = node->scope(); 511 Scope* scope = node->scope();
506 512
507 if (scope->HasIllegalRedeclaration()) { 513 if (scope->HasIllegalRedeclaration()) {
508 scope->VisitIllegalRedeclaration(this); 514 scope->VisitIllegalRedeclaration(this);
509 DisableOptimization(kFunctionWithIllegalRedeclaration); 515 DisableOptimization(kFunctionWithIllegalRedeclaration);
510 return Finish(node); 516 return Finish(node);
511 } 517 }
512 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); 518 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval);
513 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { 519 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) {
514 DisableOptimization(kContextAllocatedArguments); 520 DisableCrankshaft(kContextAllocatedArguments);
515 } 521 }
516 522
517 VisitDeclarations(scope->declarations()); 523 VisitDeclarations(scope->declarations());
518 if (scope->is_function_scope() && scope->function() != NULL) { 524 if (scope->is_function_scope() && scope->function() != NULL) {
519 // Visit the name of the named function expression. 525 // Visit the name of the named function expression.
520 Visit(scope->function()); 526 Visit(scope->function());
521 } 527 }
522 VisitStatements(node->body()); 528 VisitStatements(node->body());
523 529
524 return Finish(node); 530 return Finish(node);
525 } 531 }
526 532
527 533
528 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, 534 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone,
529 FunctionLiteral* function) { 535 FunctionLiteral* function) {
530 AstNumberingVisitor visitor(isolate, zone); 536 AstNumberingVisitor visitor(isolate, zone);
531 return visitor.Renumber(function); 537 return visitor.Renumber(function);
532 } 538 }
533 } 539 }
534 } // namespace v8::internal 540 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/compiler.cc » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698