OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 for (int i = 0; i < values->length(); ++i) { | 380 for (int i = 0; i < values->length(); ++i) { |
381 Expression* value = values->at(i); | 381 Expression* value = values->at(i); |
382 RECURSE(Visit(value)); | 382 RECURSE(Visit(value)); |
383 } | 383 } |
384 | 384 |
385 NarrowType(expr, Bounds(Type::Array(), isolate_)); | 385 NarrowType(expr, Bounds(Type::Array(), isolate_)); |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 void AstTyper::VisitAssignment(Assignment* expr) { | 389 void AstTyper::VisitAssignment(Assignment* expr) { |
390 // TODO(rossberg): Can we clean this up? | 390 // Collect type feedback. |
391 if (expr->is_compound()) { | 391 Property* prop = expr->target()->AsProperty(); |
392 // Collect type feedback. | 392 if (prop != NULL) { |
393 Expression* target = expr->target(); | 393 TypeFeedbackId id = expr->AssignmentFeedbackId(); |
394 Property* prop = target->AsProperty(); | 394 expr->set_is_uninitialized(oracle()->StoreIsUninitialized(id)); |
395 if (prop != NULL) { | 395 if (!expr->IsUninitialized()) { |
396 RECURSE(Visit(expr->target())); | 396 expr->set_is_pre_monomorphic(oracle()->StoreIsPreMonomorphic(id)); |
397 expr->RecordTypeFeedback(oracle(), zone()); | 397 expr->set_is_monomorphic(oracle()->StoreIsMonomorphicNormal(id)); |
| 398 ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic()); |
| 399 if (prop->key()->IsPropertyName()) { |
| 400 Literal* lit_key = prop->key()->AsLiteral(); |
| 401 ASSERT(lit_key != NULL && lit_key->value()->IsString()); |
| 402 Handle<String> name = Handle<String>::cast(lit_key->value()); |
| 403 oracle()->AssignmentReceiverTypes(id, name, expr->GetReceiverTypes()); |
| 404 } else { |
| 405 KeyedAccessStoreMode store_mode; |
| 406 oracle()->KeyedAssignmentReceiverTypes( |
| 407 id, expr->GetReceiverTypes(), &store_mode); |
| 408 expr->set_store_mode(store_mode); |
| 409 } |
398 } | 410 } |
| 411 } |
399 | 412 |
400 RECURSE(Visit(expr->binary_operation())); | 413 Expression* rhs = |
401 | 414 expr->is_compound() ? expr->binary_operation() : expr->value(); |
402 NarrowType(expr, expr->binary_operation()->bounds()); | 415 RECURSE(Visit(expr->target())); |
403 } else { | 416 RECURSE(Visit(rhs)); |
404 // Collect type feedback. | 417 NarrowType(expr, rhs->bounds()); |
405 if (expr->target()->IsProperty()) { | |
406 expr->RecordTypeFeedback(oracle(), zone()); | |
407 } | |
408 | |
409 RECURSE(Visit(expr->target())); | |
410 RECURSE(Visit(expr->value())); | |
411 | |
412 NarrowType(expr, expr->value()->bounds()); | |
413 } | |
414 | 418 |
415 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 419 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
416 if (proxy != NULL && proxy->var()->IsStackAllocated()) { | 420 if (proxy != NULL && proxy->var()->IsStackAllocated()) { |
417 store_.Seq(variable_index(proxy->var()), Effect(expr->bounds())); | 421 store_.Seq(variable_index(proxy->var()), Effect(expr->bounds())); |
418 } | 422 } |
419 } | 423 } |
420 | 424 |
421 | 425 |
422 void AstTyper::VisitYield(Yield* expr) { | 426 void AstTyper::VisitYield(Yield* expr) { |
423 RECURSE(Visit(expr->generator_object())); | 427 RECURSE(Visit(expr->generator_object())); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 735 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
732 } | 736 } |
733 | 737 |
734 | 738 |
735 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 739 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
736 RECURSE(Visit(stmt->body())); | 740 RECURSE(Visit(stmt->body())); |
737 } | 741 } |
738 | 742 |
739 | 743 |
740 } } // namespace v8::internal | 744 } } // namespace v8::internal |
OLD | NEW |