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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 } | 769 } |
770 | 770 |
771 | 771 |
772 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 772 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, |
773 CallKind call_kind) { | 773 CallKind call_kind) { |
774 is_monomorphic_ = oracle->CallIsMonomorphic(this); | 774 is_monomorphic_ = oracle->CallIsMonomorphic(this); |
775 Property* property = expression()->AsProperty(); | 775 Property* property = expression()->AsProperty(); |
776 if (property == NULL) { | 776 if (property == NULL) { |
777 // Function call. Specialize for monomorphic calls. | 777 // Function call. Specialize for monomorphic calls. |
778 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); | 778 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); |
779 } else if (property->key()->IsPropertyName()) { | 779 } else { |
780 // Method call. Specialize for the receiver types seen at runtime. | 780 // Method call. Specialize for the receiver types seen at runtime. |
781 Literal* key = property->key()->AsLiteral(); | 781 Literal* key = property->key()->AsLiteral(); |
782 ASSERT(key != NULL && key->value()->IsString()); | 782 ASSERT(key != NULL && key->value()->IsString()); |
783 Handle<String> name = Handle<String>::cast(key->value()); | 783 Handle<String> name = Handle<String>::cast(key->value()); |
784 check_type_ = oracle->GetCallCheckType(this); | 784 check_type_ = oracle->GetCallCheckType(this); |
785 receiver_types_.Clear(); | 785 receiver_types_.Clear(); |
786 if (check_type_ == RECEIVER_MAP_CHECK) { | 786 if (check_type_ == RECEIVER_MAP_CHECK) { |
787 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); | 787 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); |
788 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; | 788 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; |
789 } else { | 789 } else { |
790 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); | 790 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); |
791 receiver_types_.Add(handle(holder_->map()), oracle->zone()); | 791 receiver_types_.Add(handle(holder_->map()), oracle->zone()); |
792 } | 792 } |
793 #ifdef ENABLE_SLOW_ASSERTS | 793 #ifdef ENABLE_SLOW_ASSERTS |
794 if (FLAG_enable_slow_asserts) { | 794 if (FLAG_enable_slow_asserts) { |
795 int length = receiver_types_.length(); | 795 int length = receiver_types_.length(); |
796 for (int i = 0; i < length; i++) { | 796 for (int i = 0; i < length; i++) { |
797 Handle<Map> map = receiver_types_.at(i); | 797 Handle<Map> map = receiver_types_.at(i); |
798 ASSERT(!map.is_null() && *map != NULL); | 798 ASSERT(!map.is_null() && *map != NULL); |
799 } | 799 } |
800 } | 800 } |
801 #endif | 801 #endif |
802 if (is_monomorphic_) { | 802 if (is_monomorphic_) { |
803 Handle<Map> map = receiver_types_.first(); | 803 Handle<Map> map = receiver_types_.first(); |
804 is_monomorphic_ = ComputeTarget(map, name); | 804 is_monomorphic_ = ComputeTarget(map, name); |
805 } | 805 } |
806 } else { | |
807 if (is_monomorphic_) { | |
808 keyed_array_call_is_holey_ = oracle->KeyedArrayCallIsHoley(this); | |
809 } | |
810 } | 806 } |
811 } | 807 } |
812 | 808 |
813 | 809 |
814 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 810 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
815 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); | 811 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); |
816 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); | 812 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); |
817 if (is_monomorphic_) { | 813 if (is_monomorphic_) { |
818 target_ = oracle->GetCallNewTarget(this); | 814 target_ = oracle->GetCallNewTarget(this); |
819 Object* value = allocation_info_cell_->value(); | 815 Object* value = allocation_info_cell_->value(); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1326 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
1331 str = arr; | 1327 str = arr; |
1332 } else { | 1328 } else { |
1333 str = DoubleToCString(value_->Number(), buffer); | 1329 str = DoubleToCString(value_->Number(), buffer); |
1334 } | 1330 } |
1335 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1331 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
1336 } | 1332 } |
1337 | 1333 |
1338 | 1334 |
1339 } } // namespace v8::internal | 1335 } } // namespace v8::internal |
OLD | NEW |