OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 } | 631 } |
632 | 632 |
633 | 633 |
634 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 634 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, |
635 CallKind call_kind) { | 635 CallKind call_kind) { |
636 is_monomorphic_ = oracle->CallIsMonomorphic(this); | 636 is_monomorphic_ = oracle->CallIsMonomorphic(this); |
637 Property* property = expression()->AsProperty(); | 637 Property* property = expression()->AsProperty(); |
638 if (property == NULL) { | 638 if (property == NULL) { |
639 // Function call. Specialize for monomorphic calls. | 639 // Function call. Specialize for monomorphic calls. |
640 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); | 640 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); |
641 } else { | 641 } else if (property->key()->IsPropertyName()) { |
642 // Method call. Specialize for the receiver types seen at runtime. | 642 // Method call. Specialize for the receiver types seen at runtime. |
643 Literal* key = property->key()->AsLiteral(); | 643 Literal* key = property->key()->AsLiteral(); |
644 ASSERT(key != NULL && key->value()->IsString()); | 644 ASSERT(key != NULL && key->value()->IsString()); |
645 Handle<String> name = Handle<String>::cast(key->value()); | 645 Handle<String> name = Handle<String>::cast(key->value()); |
646 check_type_ = oracle->GetCallCheckType(this); | 646 check_type_ = oracle->GetCallCheckType(this); |
647 receiver_types_.Clear(); | 647 receiver_types_.Clear(); |
648 if (check_type_ == RECEIVER_MAP_CHECK) { | 648 if (check_type_ == RECEIVER_MAP_CHECK) { |
649 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); | 649 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); |
650 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; | 650 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; |
651 } else { | 651 } else { |
652 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); | 652 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); |
653 receiver_types_.Add(handle(holder_->map()), oracle->zone()); | 653 receiver_types_.Add(handle(holder_->map()), oracle->zone()); |
654 } | 654 } |
655 #ifdef DEBUG | 655 #ifdef DEBUG |
656 if (FLAG_enable_slow_asserts) { | 656 if (FLAG_enable_slow_asserts) { |
657 int length = receiver_types_.length(); | 657 int length = receiver_types_.length(); |
658 for (int i = 0; i < length; i++) { | 658 for (int i = 0; i < length; i++) { |
659 Handle<Map> map = receiver_types_.at(i); | 659 Handle<Map> map = receiver_types_.at(i); |
660 ASSERT(!map.is_null() && *map != NULL); | 660 ASSERT(!map.is_null() && *map != NULL); |
661 } | 661 } |
662 } | 662 } |
663 #endif | 663 #endif |
664 if (is_monomorphic_) { | 664 if (is_monomorphic_) { |
665 Handle<Map> map = receiver_types_.first(); | 665 Handle<Map> map = receiver_types_.first(); |
666 is_monomorphic_ = ComputeTarget(map, name); | 666 is_monomorphic_ = ComputeTarget(map, name); |
667 } | 667 } |
| 668 } else { |
| 669 if (is_monomorphic_) { |
| 670 keyed_array_call_is_holey_ = oracle->KeyedArrayCallIsHoley(this); |
| 671 } |
668 } | 672 } |
669 } | 673 } |
670 | 674 |
671 | 675 |
672 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 676 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
673 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); | 677 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); |
674 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); | 678 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); |
675 if (is_monomorphic_) { | 679 if (is_monomorphic_) { |
676 target_ = oracle->GetCallNewTarget(this); | 680 target_ = oracle->GetCallNewTarget(this); |
677 Object* value = allocation_info_cell_->value(); | 681 Object* value = allocation_info_cell_->value(); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1191 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
1188 str = arr; | 1192 str = arr; |
1189 } else { | 1193 } else { |
1190 str = DoubleToCString(value_->Number(), buffer); | 1194 str = DoubleToCString(value_->Number(), buffer); |
1191 } | 1195 } |
1192 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1196 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
1193 } | 1197 } |
1194 | 1198 |
1195 | 1199 |
1196 } } // namespace v8::internal | 1200 } } // namespace v8::internal |
OLD | NEW |