| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 } | 448 } |
| 449 | 449 |
| 450 | 450 |
| 451 void AstTyper::VisitAssignment(Assignment* expr) { | 451 void AstTyper::VisitAssignment(Assignment* expr) { |
| 452 // Collect type feedback. | 452 // Collect type feedback. |
| 453 Property* prop = expr->target()->AsProperty(); | 453 Property* prop = expr->target()->AsProperty(); |
| 454 if (prop != NULL) { | 454 if (prop != NULL) { |
| 455 TypeFeedbackId id = expr->AssignmentFeedbackId(); | 455 TypeFeedbackId id = expr->AssignmentFeedbackId(); |
| 456 expr->set_is_uninitialized(oracle()->StoreIsUninitialized(id)); | 456 expr->set_is_uninitialized(oracle()->StoreIsUninitialized(id)); |
| 457 if (!expr->IsUninitialized()) { | 457 if (!expr->IsUninitialized()) { |
| 458 expr->set_is_pre_monomorphic(oracle()->StoreIsPreMonomorphic(id)); | |
| 459 if (prop->key()->IsPropertyName()) { | 458 if (prop->key()->IsPropertyName()) { |
| 460 Literal* lit_key = prop->key()->AsLiteral(); | 459 Literal* lit_key = prop->key()->AsLiteral(); |
| 461 ASSERT(lit_key != NULL && lit_key->value()->IsString()); | 460 ASSERT(lit_key != NULL && lit_key->value()->IsString()); |
| 462 Handle<String> name = Handle<String>::cast(lit_key->value()); | 461 Handle<String> name = Handle<String>::cast(lit_key->value()); |
| 463 oracle()->AssignmentReceiverTypes(id, name, expr->GetReceiverTypes()); | 462 oracle()->AssignmentReceiverTypes(id, name, expr->GetReceiverTypes()); |
| 464 } else { | 463 } else { |
| 465 KeyedAccessStoreMode store_mode; | 464 KeyedAccessStoreMode store_mode; |
| 466 oracle()->KeyedAssignmentReceiverTypes( | 465 oracle()->KeyedAssignmentReceiverTypes( |
| 467 id, expr->GetReceiverTypes(), &store_mode); | 466 id, expr->GetReceiverTypes(), &store_mode); |
| 468 expr->set_store_mode(store_mode); | 467 expr->set_store_mode(store_mode); |
| 469 } | 468 } |
| 470 ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic()); | |
| 471 } | 469 } |
| 472 } | 470 } |
| 473 | 471 |
| 474 Expression* rhs = | 472 Expression* rhs = |
| 475 expr->is_compound() ? expr->binary_operation() : expr->value(); | 473 expr->is_compound() ? expr->binary_operation() : expr->value(); |
| 476 RECURSE(Visit(expr->target())); | 474 RECURSE(Visit(expr->target())); |
| 477 RECURSE(Visit(rhs)); | 475 RECURSE(Visit(rhs)); |
| 478 NarrowType(expr, rhs->bounds()); | 476 NarrowType(expr, rhs->bounds()); |
| 479 | 477 |
| 480 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 478 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 498 | 496 |
| 499 NarrowType(expr, Bounds(Type::None(zone()))); | 497 NarrowType(expr, Bounds(Type::None(zone()))); |
| 500 } | 498 } |
| 501 | 499 |
| 502 | 500 |
| 503 void AstTyper::VisitProperty(Property* expr) { | 501 void AstTyper::VisitProperty(Property* expr) { |
| 504 // Collect type feedback. | 502 // Collect type feedback. |
| 505 TypeFeedbackId id = expr->PropertyFeedbackId(); | 503 TypeFeedbackId id = expr->PropertyFeedbackId(); |
| 506 expr->set_is_uninitialized(oracle()->LoadIsUninitialized(id)); | 504 expr->set_is_uninitialized(oracle()->LoadIsUninitialized(id)); |
| 507 if (!expr->IsUninitialized()) { | 505 if (!expr->IsUninitialized()) { |
| 508 expr->set_is_pre_monomorphic(oracle()->LoadIsPreMonomorphic(id)); | |
| 509 if (expr->key()->IsPropertyName()) { | 506 if (expr->key()->IsPropertyName()) { |
| 510 Literal* lit_key = expr->key()->AsLiteral(); | 507 Literal* lit_key = expr->key()->AsLiteral(); |
| 511 ASSERT(lit_key != NULL && lit_key->value()->IsString()); | 508 ASSERT(lit_key != NULL && lit_key->value()->IsString()); |
| 512 Handle<String> name = Handle<String>::cast(lit_key->value()); | 509 Handle<String> name = Handle<String>::cast(lit_key->value()); |
| 513 bool is_prototype; | 510 bool is_prototype; |
| 514 oracle()->PropertyReceiverTypes( | 511 oracle()->PropertyReceiverTypes( |
| 515 id, name, expr->GetReceiverTypes(), &is_prototype); | 512 id, name, expr->GetReceiverTypes(), &is_prototype); |
| 516 expr->set_is_function_prototype(is_prototype); | 513 expr->set_is_function_prototype(is_prototype); |
| 517 } else { | 514 } else { |
| 518 bool is_string; | 515 bool is_string; |
| 519 oracle()->KeyedPropertyReceiverTypes( | 516 oracle()->KeyedPropertyReceiverTypes( |
| 520 id, expr->GetReceiverTypes(), &is_string); | 517 id, expr->GetReceiverTypes(), &is_string); |
| 521 expr->set_is_string_access(is_string); | 518 expr->set_is_string_access(is_string); |
| 522 } | 519 } |
| 523 ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic()); | |
| 524 } | 520 } |
| 525 | 521 |
| 526 RECURSE(Visit(expr->obj())); | 522 RECURSE(Visit(expr->obj())); |
| 527 RECURSE(Visit(expr->key())); | 523 RECURSE(Visit(expr->key())); |
| 528 | 524 |
| 529 // We don't know anything about the result type. | 525 // We don't know anything about the result type. |
| 530 } | 526 } |
| 531 | 527 |
| 532 | 528 |
| 533 void AstTyper::VisitCall(Call* expr) { | 529 void AstTyper::VisitCall(Call* expr) { |
| 534 // Collect type feedback. | 530 // Collect type feedback. |
| 535 expr->RecordTypeFeedback(oracle()); | 531 RECURSE(Visit(expr->expression())); |
| 532 if (!expr->expression()->IsProperty() && |
| 533 oracle()->CallIsMonomorphic(expr->CallFeedbackId())) { |
| 534 expr->set_target(oracle()->GetCallTarget(expr->CallFeedbackId())); |
| 535 } |
| 536 | 536 |
| 537 RECURSE(Visit(expr->expression())); | |
| 538 ZoneList<Expression*>* args = expr->arguments(); | 537 ZoneList<Expression*>* args = expr->arguments(); |
| 539 for (int i = 0; i < args->length(); ++i) { | 538 for (int i = 0; i < args->length(); ++i) { |
| 540 Expression* arg = args->at(i); | 539 Expression* arg = args->at(i); |
| 541 RECURSE(Visit(arg)); | 540 RECURSE(Visit(arg)); |
| 542 } | 541 } |
| 543 | 542 |
| 544 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 543 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| 545 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { | 544 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { |
| 546 store_.Forget(); // Eval could do whatever to local variables. | 545 store_.Forget(); // Eval could do whatever to local variables. |
| 547 } | 546 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 790 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
| 792 } | 791 } |
| 793 | 792 |
| 794 | 793 |
| 795 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 794 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
| 796 RECURSE(Visit(stmt->body())); | 795 RECURSE(Visit(stmt->body())); |
| 797 } | 796 } |
| 798 | 797 |
| 799 | 798 |
| 800 } } // namespace v8::internal | 799 } } // namespace v8::internal |
| OLD | NEW |