OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/typing.h" | 5 #include "src/typing.h" |
6 | 6 |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 #include "src/frames-inl.h" | 8 #include "src/frames-inl.h" |
9 #include "src/parser.h" // for CompileTimeValue; TODO(rossberg): should move | 9 #include "src/parser.h" // for CompileTimeValue; TODO(rossberg): should move |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 NarrowType(expr, Bounds(Type::RegExp(zone()))); | 393 NarrowType(expr, Bounds(Type::RegExp(zone()))); |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) { | 397 void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) { |
398 ZoneList<ObjectLiteral::Property*>* properties = expr->properties(); | 398 ZoneList<ObjectLiteral::Property*>* properties = expr->properties(); |
399 for (int i = 0; i < properties->length(); ++i) { | 399 for (int i = 0; i < properties->length(); ++i) { |
400 ObjectLiteral::Property* prop = properties->at(i); | 400 ObjectLiteral::Property* prop = properties->at(i); |
401 | 401 |
402 // Collect type feedback. | 402 // Collect type feedback. |
403 if ((prop->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL && | 403 switch (prop->kind()) { |
404 !CompileTimeValue::IsCompileTimeValue(prop->value())) || | 404 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
405 prop->kind() == ObjectLiteral::Property::COMPUTED) { | 405 if (CompileTimeValue::IsCompileTimeValue(prop->value())) break; |
406 if (prop->key()->value()->IsInternalizedString() && prop->emit_store()) { | 406 // Fall through. |
407 prop->RecordTypeFeedback(oracle()); | 407 case ObjectLiteral::Property::COMPUTED: |
408 } | 408 if (prop->key()->AsLiteral()->value()->IsInternalizedString() && |
| 409 prop->emit_store()) { |
| 410 prop->RecordTypeFeedback(oracle()); |
| 411 } |
| 412 break; |
| 413 |
| 414 case ObjectLiteral::Property::COMPUTED_NAME: |
| 415 RECURSE(Visit(prop->key())); |
| 416 break; |
| 417 |
| 418 case ObjectLiteral::Property::CONSTANT: |
| 419 case ObjectLiteral::Property::PROTOTYPE: |
| 420 case ObjectLiteral::Property::GETTER: |
| 421 case ObjectLiteral::Property::SETTER: |
| 422 break; |
409 } | 423 } |
410 | 424 |
411 RECURSE(Visit(prop->value())); | 425 RECURSE(Visit(prop->value())); |
412 } | 426 } |
413 | 427 |
414 NarrowType(expr, Bounds(Type::Object(zone()))); | 428 NarrowType(expr, Bounds(Type::Object(zone()))); |
415 } | 429 } |
416 | 430 |
417 | 431 |
418 void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) { | 432 void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 787 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
774 } | 788 } |
775 | 789 |
776 | 790 |
777 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 791 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
778 RECURSE(Visit(stmt->body())); | 792 RECURSE(Visit(stmt->body())); |
779 } | 793 } |
780 | 794 |
781 | 795 |
782 } } // namespace v8::internal | 796 } } // namespace v8::internal |
OLD | NEW |