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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 387 |
388 | 388 |
389 void AstTyper::VisitAssignment(Assignment* expr) { | 389 void AstTyper::VisitAssignment(Assignment* expr) { |
390 // Collect type feedback. | 390 // Collect type feedback. |
391 Property* prop = expr->target()->AsProperty(); | 391 Property* prop = expr->target()->AsProperty(); |
392 if (prop != NULL) { | 392 if (prop != NULL) { |
393 TypeFeedbackId id = expr->AssignmentFeedbackId(); | 393 TypeFeedbackId id = expr->AssignmentFeedbackId(); |
394 expr->set_is_uninitialized(oracle()->StoreIsUninitialized(id)); | 394 expr->set_is_uninitialized(oracle()->StoreIsUninitialized(id)); |
395 if (!expr->IsUninitialized()) { | 395 if (!expr->IsUninitialized()) { |
396 expr->set_is_pre_monomorphic(oracle()->StoreIsPreMonomorphic(id)); | 396 expr->set_is_pre_monomorphic(oracle()->StoreIsPreMonomorphic(id)); |
397 expr->set_is_monomorphic(oracle()->StoreIsMonomorphicNormal(id)); | |
398 ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic()); | |
399 if (prop->key()->IsPropertyName()) { | 397 if (prop->key()->IsPropertyName()) { |
400 Literal* lit_key = prop->key()->AsLiteral(); | 398 Literal* lit_key = prop->key()->AsLiteral(); |
401 ASSERT(lit_key != NULL && lit_key->value()->IsString()); | 399 ASSERT(lit_key != NULL && lit_key->value()->IsString()); |
402 Handle<String> name = Handle<String>::cast(lit_key->value()); | 400 Handle<String> name = Handle<String>::cast(lit_key->value()); |
403 oracle()->AssignmentReceiverTypes(id, name, expr->GetReceiverTypes()); | 401 oracle()->AssignmentReceiverTypes(id, name, expr->GetReceiverTypes()); |
404 } else { | 402 } else { |
405 KeyedAccessStoreMode store_mode; | 403 KeyedAccessStoreMode store_mode; |
406 oracle()->KeyedAssignmentReceiverTypes( | 404 oracle()->KeyedAssignmentReceiverTypes( |
407 id, expr->GetReceiverTypes(), &store_mode); | 405 id, expr->GetReceiverTypes(), &store_mode); |
408 expr->set_store_mode(store_mode); | 406 expr->set_store_mode(store_mode); |
409 } | 407 } |
| 408 ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic()); |
410 } | 409 } |
411 } | 410 } |
412 | 411 |
413 Expression* rhs = | 412 Expression* rhs = |
414 expr->is_compound() ? expr->binary_operation() : expr->value(); | 413 expr->is_compound() ? expr->binary_operation() : expr->value(); |
415 RECURSE(Visit(expr->target())); | 414 RECURSE(Visit(expr->target())); |
416 RECURSE(Visit(rhs)); | 415 RECURSE(Visit(rhs)); |
417 NarrowType(expr, rhs->bounds()); | 416 NarrowType(expr, rhs->bounds()); |
418 | 417 |
419 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 418 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
(...skipping 18 matching lines...) Expand all Loading... |
438 NarrowType(expr, Bounds(Type::None(), isolate_)); | 437 NarrowType(expr, Bounds(Type::None(), isolate_)); |
439 } | 438 } |
440 | 439 |
441 | 440 |
442 void AstTyper::VisitProperty(Property* expr) { | 441 void AstTyper::VisitProperty(Property* expr) { |
443 // Collect type feedback. | 442 // Collect type feedback. |
444 TypeFeedbackId id = expr->PropertyFeedbackId(); | 443 TypeFeedbackId id = expr->PropertyFeedbackId(); |
445 expr->set_is_uninitialized(oracle()->LoadIsUninitialized(id)); | 444 expr->set_is_uninitialized(oracle()->LoadIsUninitialized(id)); |
446 if (!expr->IsUninitialized()) { | 445 if (!expr->IsUninitialized()) { |
447 expr->set_is_pre_monomorphic(oracle()->LoadIsPreMonomorphic(id)); | 446 expr->set_is_pre_monomorphic(oracle()->LoadIsPreMonomorphic(id)); |
448 expr->set_is_monomorphic(oracle()->LoadIsMonomorphicNormal(id)); | |
449 ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic()); | |
450 if (expr->key()->IsPropertyName()) { | 447 if (expr->key()->IsPropertyName()) { |
451 Literal* lit_key = expr->key()->AsLiteral(); | 448 Literal* lit_key = expr->key()->AsLiteral(); |
452 ASSERT(lit_key != NULL && lit_key->value()->IsString()); | 449 ASSERT(lit_key != NULL && lit_key->value()->IsString()); |
453 Handle<String> name = Handle<String>::cast(lit_key->value()); | 450 Handle<String> name = Handle<String>::cast(lit_key->value()); |
454 bool is_prototype; | 451 bool is_prototype; |
455 oracle()->PropertyReceiverTypes( | 452 oracle()->PropertyReceiverTypes( |
456 id, name, expr->GetReceiverTypes(), &is_prototype); | 453 id, name, expr->GetReceiverTypes(), &is_prototype); |
457 expr->set_is_function_prototype(is_prototype); | 454 expr->set_is_function_prototype(is_prototype); |
458 } else { | 455 } else { |
459 bool is_string; | 456 bool is_string; |
460 oracle()->KeyedPropertyReceiverTypes( | 457 oracle()->KeyedPropertyReceiverTypes( |
461 id, expr->GetReceiverTypes(), &is_string); | 458 id, expr->GetReceiverTypes(), &is_string); |
462 expr->set_is_string_access(is_string); | 459 expr->set_is_string_access(is_string); |
463 } | 460 } |
| 461 ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic()); |
464 } | 462 } |
465 | 463 |
466 RECURSE(Visit(expr->obj())); | 464 RECURSE(Visit(expr->obj())); |
467 RECURSE(Visit(expr->key())); | 465 RECURSE(Visit(expr->key())); |
468 | 466 |
469 // We don't know anything about the result type. | 467 // We don't know anything about the result type. |
470 } | 468 } |
471 | 469 |
472 | 470 |
473 void AstTyper::VisitCall(Call* expr) { | 471 void AstTyper::VisitCall(Call* expr) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 break; | 542 break; |
545 default: | 543 default: |
546 UNREACHABLE(); | 544 UNREACHABLE(); |
547 } | 545 } |
548 } | 546 } |
549 | 547 |
550 | 548 |
551 void AstTyper::VisitCountOperation(CountOperation* expr) { | 549 void AstTyper::VisitCountOperation(CountOperation* expr) { |
552 // Collect type feedback. | 550 // Collect type feedback. |
553 TypeFeedbackId store_id = expr->CountStoreFeedbackId(); | 551 TypeFeedbackId store_id = expr->CountStoreFeedbackId(); |
554 expr->set_is_monomorphic(oracle()->StoreIsMonomorphicNormal(store_id)); | |
555 expr->set_store_mode(oracle()->GetStoreMode(store_id)); | 552 expr->set_store_mode(oracle()->GetStoreMode(store_id)); |
556 oracle()->CountReceiverTypes(store_id, expr->GetReceiverTypes()); | 553 oracle()->CountReceiverTypes(store_id, expr->GetReceiverTypes()); |
557 expr->set_type(oracle()->CountType(expr->CountBinOpFeedbackId())); | 554 expr->set_type(oracle()->CountType(expr->CountBinOpFeedbackId())); |
558 // TODO(rossberg): merge the count type with the generic expression type. | 555 // TODO(rossberg): merge the count type with the generic expression type. |
559 | 556 |
560 RECURSE(Visit(expr->expression())); | 557 RECURSE(Visit(expr->expression())); |
561 | 558 |
562 NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_)); | 559 NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_)); |
563 | 560 |
564 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 561 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 732 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
736 } | 733 } |
737 | 734 |
738 | 735 |
739 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 736 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
740 RECURSE(Visit(stmt->body())); | 737 RECURSE(Visit(stmt->body())); |
741 } | 738 } |
742 | 739 |
743 | 740 |
744 } } // namespace v8::internal | 741 } } // namespace v8::internal |
OLD | NEW |