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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 } | 425 } |
426 } | 426 } |
427 | 427 |
428 | 428 |
429 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { | 429 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { |
430 IncrementNodeCount(); | 430 IncrementNodeCount(); |
431 node->set_base_id(ReserveIdRange(node->num_ids())); | 431 node->set_base_id(ReserveIdRange(node->num_ids())); |
432 for (int i = 0; i < node->properties()->length(); i++) { | 432 for (int i = 0; i < node->properties()->length(); i++) { |
433 VisitObjectLiteralProperty(node->properties()->at(i)); | 433 VisitObjectLiteralProperty(node->properties()->at(i)); |
434 } | 434 } |
| 435 // Mark all computed expressions that are bound to a key that |
| 436 // is shadowed by a later occurrence of the same key. For the |
| 437 // marked expressions, no store code will be is emitted. |
| 438 node->CalculateEmitStore(zone()); |
435 } | 439 } |
436 | 440 |
437 | 441 |
438 void AstNumberingVisitor::VisitObjectLiteralProperty( | 442 void AstNumberingVisitor::VisitObjectLiteralProperty( |
439 ObjectLiteralProperty* node) { | 443 ObjectLiteralProperty* node) { |
440 if (node->is_computed_name()) DisableOptimization(kComputedPropertyName); | 444 if (node->is_computed_name()) DisableOptimization(kComputedPropertyName); |
441 Visit(node->key()); | 445 Visit(node->key()); |
442 Visit(node->value()); | 446 Visit(node->value()); |
443 } | 447 } |
444 | 448 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 536 } |
533 | 537 |
534 | 538 |
535 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 539 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
536 FunctionLiteral* function) { | 540 FunctionLiteral* function) { |
537 AstNumberingVisitor visitor(isolate, zone); | 541 AstNumberingVisitor visitor(isolate, zone); |
538 return visitor.Renumber(function); | 542 return visitor.Renumber(function); |
539 } | 543 } |
540 } | 544 } |
541 } // namespace v8::internal | 545 } // namespace v8::internal |
OLD | NEW |