| 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/scopes.h" | 9 #include "src/scopes.h" |
| 10 | 10 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 Visit(node->obj()); | 305 Visit(node->obj()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 void AstNumberingVisitor::VisitAssignment(Assignment* node) { | 309 void AstNumberingVisitor::VisitAssignment(Assignment* node) { |
| 310 IncrementNodeCount(); | 310 IncrementNodeCount(); |
| 311 node->set_base_id(ReserveIdRange(Assignment::num_ids())); | 311 node->set_base_id(ReserveIdRange(Assignment::num_ids())); |
| 312 if (node->is_compound()) VisitBinaryOperation(node->binary_operation()); | 312 if (node->is_compound()) VisitBinaryOperation(node->binary_operation()); |
| 313 Visit(node->target()); | 313 Visit(node->target()); |
| 314 Visit(node->value()); | 314 Visit(node->value()); |
| 315 ReserveFeedbackSlots(node); |
| 315 } | 316 } |
| 316 | 317 |
| 317 | 318 |
| 318 void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) { | 319 void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) { |
| 319 IncrementNodeCount(); | 320 IncrementNodeCount(); |
| 320 node->set_base_id(ReserveIdRange(BinaryOperation::num_ids())); | 321 node->set_base_id(ReserveIdRange(BinaryOperation::num_ids())); |
| 321 Visit(node->left()); | 322 Visit(node->left()); |
| 322 Visit(node->right()); | 323 Visit(node->right()); |
| 323 } | 324 } |
| 324 | 325 |
| 325 | 326 |
| 326 void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) { | 327 void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) { |
| 327 IncrementNodeCount(); | 328 IncrementNodeCount(); |
| 328 node->set_base_id(ReserveIdRange(CompareOperation::num_ids())); | 329 node->set_base_id(ReserveIdRange(CompareOperation::num_ids())); |
| 329 Visit(node->left()); | 330 Visit(node->left()); |
| 330 Visit(node->right()); | 331 Visit(node->right()); |
| 331 } | 332 } |
| 332 | 333 |
| 333 | 334 |
| 334 void AstNumberingVisitor::VisitSpread(Spread* node) { | 335 void AstNumberingVisitor::VisitSpread(Spread* node) { |
| 335 IncrementNodeCount(); | 336 IncrementNodeCount(); |
| 336 DisableOptimization(kSpread); | 337 DisableOptimization(kSpread); |
| 337 Visit(node->expression()); | 338 Visit(node->expression()); |
| 338 } | 339 } |
| 339 | 340 |
| 340 | 341 |
| 341 void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) { | 342 void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) { |
| 342 IncrementNodeCount(); | 343 IncrementNodeCount(); |
| 343 DisableSelfOptimization(); | 344 DisableSelfOptimization(); |
| 344 ReserveFeedbackSlots(node); | |
| 345 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); | 345 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); |
| 346 Visit(node->each()); | 346 Visit(node->each()); |
| 347 Visit(node->enumerable()); | 347 Visit(node->enumerable()); |
| 348 Visit(node->body()); | 348 Visit(node->body()); |
| 349 ReserveFeedbackSlots(node); |
| 349 } | 350 } |
| 350 | 351 |
| 351 | 352 |
| 352 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { | 353 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { |
| 353 IncrementNodeCount(); | 354 IncrementNodeCount(); |
| 354 DisableCrankshaft(kForOfStatement); | 355 DisableCrankshaft(kForOfStatement); |
| 355 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); | 356 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); |
| 356 Visit(node->assign_iterator()); | 357 Visit(node->assign_iterator()); |
| 357 Visit(node->next_result()); | 358 Visit(node->next_result()); |
| 358 Visit(node->result_done()); | 359 Visit(node->result_done()); |
| 359 Visit(node->assign_each()); | 360 Visit(node->assign_each()); |
| 360 Visit(node->body()); | 361 Visit(node->body()); |
| 362 ReserveFeedbackSlots(node); |
| 361 } | 363 } |
| 362 | 364 |
| 363 | 365 |
| 364 void AstNumberingVisitor::VisitConditional(Conditional* node) { | 366 void AstNumberingVisitor::VisitConditional(Conditional* node) { |
| 365 IncrementNodeCount(); | 367 IncrementNodeCount(); |
| 366 node->set_base_id(ReserveIdRange(Conditional::num_ids())); | 368 node->set_base_id(ReserveIdRange(Conditional::num_ids())); |
| 367 Visit(node->condition()); | 369 Visit(node->condition()); |
| 368 Visit(node->then_expression()); | 370 Visit(node->then_expression()); |
| 369 Visit(node->else_expression()); | 371 Visit(node->else_expression()); |
| 370 } | 372 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { | 431 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { |
| 430 IncrementNodeCount(); | 432 IncrementNodeCount(); |
| 431 node->set_base_id(ReserveIdRange(node->num_ids())); | 433 node->set_base_id(ReserveIdRange(node->num_ids())); |
| 432 for (int i = 0; i < node->properties()->length(); i++) { | 434 for (int i = 0; i < node->properties()->length(); i++) { |
| 433 VisitObjectLiteralProperty(node->properties()->at(i)); | 435 VisitObjectLiteralProperty(node->properties()->at(i)); |
| 434 } | 436 } |
| 435 // Mark all computed expressions that are bound to a key that | 437 // Mark all computed expressions that are bound to a key that |
| 436 // is shadowed by a later occurrence of the same key. For the | 438 // is shadowed by a later occurrence of the same key. For the |
| 437 // marked expressions, no store code will be is emitted. | 439 // marked expressions, no store code will be is emitted. |
| 438 node->CalculateEmitStore(zone()); | 440 node->CalculateEmitStore(zone()); |
| 441 ReserveFeedbackSlots(node); |
| 439 } | 442 } |
| 440 | 443 |
| 441 | 444 |
| 442 void AstNumberingVisitor::VisitObjectLiteralProperty( | 445 void AstNumberingVisitor::VisitObjectLiteralProperty( |
| 443 ObjectLiteralProperty* node) { | 446 ObjectLiteralProperty* node) { |
| 444 if (node->is_computed_name()) DisableOptimization(kComputedPropertyName); | 447 if (node->is_computed_name()) DisableOptimization(kComputedPropertyName); |
| 445 Visit(node->key()); | 448 Visit(node->key()); |
| 446 Visit(node->value()); | 449 Visit(node->value()); |
| 447 } | 450 } |
| 448 | 451 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 } | 539 } |
| 537 | 540 |
| 538 | 541 |
| 539 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 542 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
| 540 FunctionLiteral* function) { | 543 FunctionLiteral* function) { |
| 541 AstNumberingVisitor visitor(isolate, zone); | 544 AstNumberingVisitor visitor(isolate, zone); |
| 542 return visitor.Renumber(function); | 545 return visitor.Renumber(function); |
| 543 } | 546 } |
| 544 } | 547 } |
| 545 } // namespace v8::internal | 548 } // namespace v8::internal |
| OLD | NEW |