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 13854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13865 return String::cast(string)->Equals(string_); | 13865 return String::cast(string)->Equals(string_); |
13866 } | 13866 } |
13867 | 13867 |
13868 uint32_t Hash() { return string_->Hash(); } | 13868 uint32_t Hash() { return string_->Hash(); } |
13869 | 13869 |
13870 uint32_t HashForObject(Object* other) { | 13870 uint32_t HashForObject(Object* other) { |
13871 return String::cast(other)->Hash(); | 13871 return String::cast(other)->Hash(); |
13872 } | 13872 } |
13873 | 13873 |
13874 MaybeObject* AsObject(Heap* heap) { | 13874 MaybeObject* AsObject(Heap* heap) { |
13875 // Attempt to flatten the string, so that internalized strings will most | |
13876 // often be flat strings. | |
13877 string_ = string_->TryFlattenGetString(); | |
Michael Starzinger
2014/04/01 10:55:18
I am not an expert on this, but doesn't it still m
| |
13878 // Internalize the string if possible. | 13875 // Internalize the string if possible. |
13879 Map* map = heap->InternalizedStringMapForString(string_); | 13876 Map* map = heap->InternalizedStringMapForString(string_); |
13880 if (map != NULL) { | 13877 if (map != NULL) { |
13881 string_->set_map_no_write_barrier(map); | 13878 string_->set_map_no_write_barrier(map); |
13882 ASSERT(string_->IsInternalizedString()); | 13879 ASSERT(string_->IsInternalizedString()); |
13883 return string_; | 13880 return string_; |
13884 } | 13881 } |
13885 // Otherwise allocate a new internalized string. | 13882 // Otherwise allocate a new internalized string. |
13886 return heap->AllocateInternalizedStringImpl( | 13883 return heap->AllocateInternalizedStringImpl( |
13887 string_, string_->length(), string_->hash_field()); | 13884 string_, string_->length(), string_->hash_field()); |
(...skipping 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16479 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16476 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16480 static const char* error_messages_[] = { | 16477 static const char* error_messages_[] = { |
16481 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16478 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16482 }; | 16479 }; |
16483 #undef ERROR_MESSAGES_TEXTS | 16480 #undef ERROR_MESSAGES_TEXTS |
16484 return error_messages_[reason]; | 16481 return error_messages_[reason]; |
16485 } | 16482 } |
16486 | 16483 |
16487 | 16484 |
16488 } } // namespace v8::internal | 16485 } } // namespace v8::internal |
OLD | NEW |