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 6664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6675 result->set_prototype(prototype()); | 6675 result->set_prototype(prototype()); |
6676 result->set_constructor(constructor()); | 6676 result->set_constructor(constructor()); |
6677 result->set_bit_field(bit_field()); | 6677 result->set_bit_field(bit_field()); |
6678 result->set_bit_field2(bit_field2()); | 6678 result->set_bit_field2(bit_field2()); |
6679 int new_bit_field3 = bit_field3(); | 6679 int new_bit_field3 = bit_field3(); |
6680 new_bit_field3 = OwnsDescriptors::update(new_bit_field3, true); | 6680 new_bit_field3 = OwnsDescriptors::update(new_bit_field3, true); |
6681 new_bit_field3 = NumberOfOwnDescriptorsBits::update(new_bit_field3, 0); | 6681 new_bit_field3 = NumberOfOwnDescriptorsBits::update(new_bit_field3, 0); |
6682 new_bit_field3 = EnumLengthBits::update(new_bit_field3, | 6682 new_bit_field3 = EnumLengthBits::update(new_bit_field3, |
6683 kInvalidEnumCacheSentinel); | 6683 kInvalidEnumCacheSentinel); |
6684 new_bit_field3 = Deprecated::update(new_bit_field3, false); | 6684 new_bit_field3 = Deprecated::update(new_bit_field3, false); |
6685 new_bit_field3 = IsUnstable::update(new_bit_field3, false); | 6685 if (!is_dictionary_map()) { |
| 6686 new_bit_field3 = IsUnstable::update(new_bit_field3, false); |
| 6687 } |
6686 result->set_bit_field3(new_bit_field3); | 6688 result->set_bit_field3(new_bit_field3); |
6687 return result; | 6689 return result; |
6688 } | 6690 } |
6689 | 6691 |
6690 | 6692 |
6691 Handle<Map> Map::CopyNormalized(Handle<Map> map, | 6693 Handle<Map> Map::CopyNormalized(Handle<Map> map, |
6692 PropertyNormalizationMode mode, | 6694 PropertyNormalizationMode mode, |
6693 NormalizedMapSharingMode sharing) { | 6695 NormalizedMapSharingMode sharing) { |
6694 int new_instance_size = map->instance_size(); | 6696 int new_instance_size = map->instance_size(); |
6695 if (mode == CLEAR_INOBJECT_PROPERTIES) { | 6697 if (mode == CLEAR_INOBJECT_PROPERTIES) { |
(...skipping 4371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11067 PrintF(out, "major_key = %s\n", | 11069 PrintF(out, "major_key = %s\n", |
11068 CodeStub::MajorName(CodeStub::GetMajorKey(this), true)); | 11070 CodeStub::MajorName(CodeStub::GetMajorKey(this), true)); |
11069 } | 11071 } |
11070 if (is_inline_cache_stub()) { | 11072 if (is_inline_cache_stub()) { |
11071 PrintF(out, "ic_state = %s\n", ICState2String(ic_state())); | 11073 PrintF(out, "ic_state = %s\n", ICState2String(ic_state())); |
11072 PrintExtraICState(out, kind(), needs_extended_extra_ic_state(kind()) ? | 11074 PrintExtraICState(out, kind(), needs_extended_extra_ic_state(kind()) ? |
11073 extended_extra_ic_state() : extra_ic_state()); | 11075 extended_extra_ic_state() : extra_ic_state()); |
11074 if (ic_state() == MONOMORPHIC) { | 11076 if (ic_state() == MONOMORPHIC) { |
11075 PrintF(out, "type = %s\n", StubType2String(type())); | 11077 PrintF(out, "type = %s\n", StubType2String(type())); |
11076 } | 11078 } |
11077 if (is_call_stub() || is_keyed_call_stub()) { | |
11078 PrintF(out, "argc = %d\n", arguments_count()); | |
11079 } | |
11080 if (is_compare_ic_stub()) { | 11079 if (is_compare_ic_stub()) { |
11081 ASSERT(major_key() == CodeStub::CompareIC); | 11080 ASSERT(major_key() == CodeStub::CompareIC); |
11082 CompareIC::State left_state, right_state, handler_state; | 11081 CompareIC::State left_state, right_state, handler_state; |
11083 Token::Value op; | 11082 Token::Value op; |
11084 ICCompareStub::DecodeMinorKey(stub_info(), &left_state, &right_state, | 11083 ICCompareStub::DecodeMinorKey(stub_info(), &left_state, &right_state, |
11085 &handler_state, &op); | 11084 &handler_state, &op); |
11086 PrintF(out, "compare_state = %s*%s -> %s\n", | 11085 PrintF(out, "compare_state = %s*%s -> %s\n", |
11087 CompareIC::GetStateName(left_state), | 11086 CompareIC::GetStateName(left_state), |
11088 CompareIC::GetStateName(right_state), | 11087 CompareIC::GetStateName(right_state), |
11089 CompareIC::GetStateName(handler_state)); | 11088 CompareIC::GetStateName(handler_state)); |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11738 DisallowHeapAllocation no_allocation_scope; | 11737 DisallowHeapAllocation no_allocation_scope; |
11739 DependentCode::GroupStartIndexes starts(this); | 11738 DependentCode::GroupStartIndexes starts(this); |
11740 int start = starts.at(group); | 11739 int start = starts.at(group); |
11741 int end = starts.at(group + 1); | 11740 int end = starts.at(group + 1); |
11742 int code_entries = starts.number_of_entries(); | 11741 int code_entries = starts.number_of_entries(); |
11743 if (start == end) return false; | 11742 if (start == end) return false; |
11744 | 11743 |
11745 // Mark all the code that needs to be deoptimized. | 11744 // Mark all the code that needs to be deoptimized. |
11746 bool marked = false; | 11745 bool marked = false; |
11747 for (int i = start; i < end; i++) { | 11746 for (int i = start; i < end; i++) { |
11748 if (is_code_at(i)) { | 11747 Object* object = object_at(i); |
11749 Code* code = code_at(i); | 11748 // TODO(hpayer): This is a temporary hack. Foreign objects move after |
| 11749 // new space evacuation. Since pretenuring may mark these objects as aborted |
| 11750 // we have to follow the forwarding pointer in that case. |
| 11751 MapWord map_word = HeapObject::cast(object)->map_word(); |
| 11752 if (map_word.IsForwardingAddress()) { |
| 11753 object = map_word.ToForwardingAddress(); |
| 11754 } |
| 11755 if (object->IsCode()) { |
| 11756 Code* code = Code::cast(object); |
11750 if (!code->marked_for_deoptimization()) { | 11757 if (!code->marked_for_deoptimization()) { |
11751 code->set_marked_for_deoptimization(true); | 11758 code->set_marked_for_deoptimization(true); |
11752 marked = true; | 11759 marked = true; |
11753 } | 11760 } |
11754 } else { | 11761 } else { |
11755 CompilationInfo* info = compilation_info_at(i); | 11762 CompilationInfo* info = reinterpret_cast<CompilationInfo*>( |
| 11763 Foreign::cast(object)->foreign_address()); |
11756 info->AbortDueToDependencyChange(); | 11764 info->AbortDueToDependencyChange(); |
11757 } | 11765 } |
11758 } | 11766 } |
11759 // Compact the array by moving all subsequent groups to fill in the new holes. | 11767 // Compact the array by moving all subsequent groups to fill in the new holes. |
11760 for (int src = end, dst = start; src < code_entries; src++, dst++) { | 11768 for (int src = end, dst = start; src < code_entries; src++, dst++) { |
11761 copy(src, dst); | 11769 copy(src, dst); |
11762 } | 11770 } |
11763 // Now the holes are at the end of the array, zap them for heap-verifier. | 11771 // Now the holes are at the end of the array, zap them for heap-verifier. |
11764 int removed = end - start; | 11772 int removed = end - start; |
11765 for (int i = code_entries - removed; i < code_entries; i++) { | 11773 for (int i = code_entries - removed; i < code_entries; i++) { |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12726 void AllocationSite::ResetPretenureDecision() { | 12734 void AllocationSite::ResetPretenureDecision() { |
12727 set_pretenure_decision(kUndecided); | 12735 set_pretenure_decision(kUndecided); |
12728 set_memento_found_count(0); | 12736 set_memento_found_count(0); |
12729 set_memento_create_count(0); | 12737 set_memento_create_count(0); |
12730 } | 12738 } |
12731 | 12739 |
12732 | 12740 |
12733 PretenureFlag AllocationSite::GetPretenureMode() { | 12741 PretenureFlag AllocationSite::GetPretenureMode() { |
12734 PretenureDecision mode = pretenure_decision(); | 12742 PretenureDecision mode = pretenure_decision(); |
12735 // Zombie objects "decide" to be untenured. | 12743 // Zombie objects "decide" to be untenured. |
12736 return (mode == kTenure && GetHeap()->GetPretenureMode() == TENURED) | 12744 return mode == kTenure ? TENURED : NOT_TENURED; |
12737 ? TENURED : NOT_TENURED; | |
12738 } | 12745 } |
12739 | 12746 |
12740 | 12747 |
12741 bool AllocationSite::IsNestedSite() { | 12748 bool AllocationSite::IsNestedSite() { |
12742 ASSERT(FLAG_trace_track_allocation_sites); | 12749 ASSERT(FLAG_trace_track_allocation_sites); |
12743 Object* current = GetHeap()->allocation_sites_list(); | 12750 Object* current = GetHeap()->allocation_sites_list(); |
12744 while (current->IsAllocationSite()) { | 12751 while (current->IsAllocationSite()) { |
12745 AllocationSite* current_site = AllocationSite::cast(current); | 12752 AllocationSite* current_site = AllocationSite::cast(current); |
12746 if (current_site->nested_site() == this) { | 12753 if (current_site->nested_site() == this) { |
12747 return true; | 12754 return true; |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13825 Smi* flags_; | 13832 Smi* flags_; |
13826 }; | 13833 }; |
13827 | 13834 |
13828 | 13835 |
13829 MaybeObject* OneByteStringKey::AsObject(Heap* heap) { | 13836 MaybeObject* OneByteStringKey::AsObject(Heap* heap) { |
13830 if (hash_field_ == 0) Hash(); | 13837 if (hash_field_ == 0) Hash(); |
13831 return heap->AllocateOneByteInternalizedString(string_, hash_field_); | 13838 return heap->AllocateOneByteInternalizedString(string_, hash_field_); |
13832 } | 13839 } |
13833 | 13840 |
13834 | 13841 |
13835 MaybeObject* SubStringOneByteStringKey::AsObject(Heap* heap) { | |
13836 if (hash_field_ == 0) Hash(); | |
13837 Vector<const uint8_t> chars(string_->GetChars() + from_, length_); | |
13838 return heap->AllocateOneByteInternalizedString(chars, hash_field_); | |
13839 } | |
13840 | |
13841 | |
13842 MaybeObject* TwoByteStringKey::AsObject(Heap* heap) { | 13842 MaybeObject* TwoByteStringKey::AsObject(Heap* heap) { |
13843 if (hash_field_ == 0) Hash(); | 13843 if (hash_field_ == 0) Hash(); |
13844 return heap->AllocateTwoByteInternalizedString(string_, hash_field_); | 13844 return heap->AllocateTwoByteInternalizedString(string_, hash_field_); |
13845 } | 13845 } |
13846 | 13846 |
13847 | 13847 |
| 13848 template<> |
| 13849 const uint8_t* SubStringKey<uint8_t>::GetChars() { |
| 13850 return string_->IsSeqOneByteString() |
| 13851 ? SeqOneByteString::cast(*string_)->GetChars() |
| 13852 : ExternalAsciiString::cast(*string_)->GetChars(); |
| 13853 } |
| 13854 |
| 13855 |
| 13856 template<> |
| 13857 const uint16_t* SubStringKey<uint16_t>::GetChars() { |
| 13858 return string_->IsSeqTwoByteString() |
| 13859 ? SeqTwoByteString::cast(*string_)->GetChars() |
| 13860 : ExternalTwoByteString::cast(*string_)->GetChars(); |
| 13861 } |
| 13862 |
| 13863 |
| 13864 template<> |
| 13865 MaybeObject* SubStringKey<uint8_t>::AsObject(Heap* heap) { |
| 13866 if (hash_field_ == 0) Hash(); |
| 13867 Vector<const uint8_t> chars(GetChars() + from_, length_); |
| 13868 return heap->AllocateOneByteInternalizedString(chars, hash_field_); |
| 13869 } |
| 13870 |
| 13871 |
| 13872 template<> |
| 13873 MaybeObject* SubStringKey<uint16_t>::AsObject( |
| 13874 Heap* heap) { |
| 13875 if (hash_field_ == 0) Hash(); |
| 13876 Vector<const uint16_t> chars(GetChars() + from_, length_); |
| 13877 return heap->AllocateTwoByteInternalizedString(chars, hash_field_); |
| 13878 } |
| 13879 |
| 13880 |
| 13881 template<> |
| 13882 bool SubStringKey<uint8_t>::IsMatch(Object* string) { |
| 13883 Vector<const uint8_t> chars(GetChars() + from_, length_); |
| 13884 return String::cast(string)->IsOneByteEqualTo(chars); |
| 13885 } |
| 13886 |
| 13887 |
| 13888 template<> |
| 13889 bool SubStringKey<uint16_t>::IsMatch(Object* string) { |
| 13890 Vector<const uint16_t> chars(GetChars() + from_, length_); |
| 13891 return String::cast(string)->IsTwoByteEqualTo(chars); |
| 13892 } |
| 13893 |
| 13894 |
| 13895 template class SubStringKey<uint8_t>; |
| 13896 template class SubStringKey<uint16_t>; |
| 13897 |
| 13898 |
13848 // InternalizedStringKey carries a string/internalized-string object as key. | 13899 // InternalizedStringKey carries a string/internalized-string object as key. |
13849 class InternalizedStringKey : public HashTableKey { | 13900 class InternalizedStringKey : public HashTableKey { |
13850 public: | 13901 public: |
13851 explicit InternalizedStringKey(String* string) | 13902 explicit InternalizedStringKey(String* string) |
13852 : string_(string) { } | 13903 : string_(string) { } |
13853 | 13904 |
13854 bool IsMatch(Object* string) { | 13905 bool IsMatch(Object* string) { |
13855 return String::cast(string)->Equals(string_); | 13906 return String::cast(string)->Equals(string_); |
13856 } | 13907 } |
13857 | 13908 |
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16424 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16475 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16425 static const char* error_messages_[] = { | 16476 static const char* error_messages_[] = { |
16426 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16477 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16427 }; | 16478 }; |
16428 #undef ERROR_MESSAGES_TEXTS | 16479 #undef ERROR_MESSAGES_TEXTS |
16429 return error_messages_[reason]; | 16480 return error_messages_[reason]; |
16430 } | 16481 } |
16431 | 16482 |
16432 | 16483 |
16433 } } // namespace v8::internal | 16484 } } // namespace v8::internal |
OLD | NEW |