| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 | 751 |
| 752 | 752 |
| 753 // Used to insert a deserialized internalized string into the string table. | 753 // Used to insert a deserialized internalized string into the string table. |
| 754 class StringTableInsertionKey : public HashTableKey { | 754 class StringTableInsertionKey : public HashTableKey { |
| 755 public: | 755 public: |
| 756 explicit StringTableInsertionKey(String* string) | 756 explicit StringTableInsertionKey(String* string) |
| 757 : string_(string), hash_(HashForObject(string)) { | 757 : string_(string), hash_(HashForObject(string)) { |
| 758 DCHECK(string->IsInternalizedString()); | 758 DCHECK(string->IsInternalizedString()); |
| 759 } | 759 } |
| 760 | 760 |
| 761 virtual bool IsMatch(Object* string) OVERRIDE { | 761 bool IsMatch(Object* string) OVERRIDE { |
| 762 // We know that all entries in a hash table had their hash keys created. | 762 // We know that all entries in a hash table had their hash keys created. |
| 763 // Use that knowledge to have fast failure. | 763 // Use that knowledge to have fast failure. |
| 764 if (hash_ != HashForObject(string)) return false; | 764 if (hash_ != HashForObject(string)) return false; |
| 765 // We want to compare the content of two internalized strings here. | 765 // We want to compare the content of two internalized strings here. |
| 766 return string_->SlowEquals(String::cast(string)); | 766 return string_->SlowEquals(String::cast(string)); |
| 767 } | 767 } |
| 768 | 768 |
| 769 virtual uint32_t Hash() OVERRIDE { return hash_; } | 769 uint32_t Hash() OVERRIDE { return hash_; } |
| 770 | 770 |
| 771 virtual uint32_t HashForObject(Object* key) OVERRIDE { | 771 uint32_t HashForObject(Object* key) OVERRIDE { |
| 772 return String::cast(key)->Hash(); | 772 return String::cast(key)->Hash(); |
| 773 } | 773 } |
| 774 | 774 |
| 775 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) | 775 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) |
| 776 OVERRIDE { | 776 OVERRIDE { |
| 777 return handle(string_, isolate); | 777 return handle(string_, isolate); |
| 778 } | 778 } |
| 779 | 779 |
| 780 String* string_; | 780 String* string_; |
| 781 uint32_t hash_; | 781 uint32_t hash_; |
| (...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 return GetHeaderValue(kNumInternalizedStringsOffset); | 2481 return GetHeaderValue(kNumInternalizedStringsOffset); |
| 2482 } | 2482 } |
| 2483 | 2483 |
| 2484 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { | 2484 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { |
| 2485 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; | 2485 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; |
| 2486 const byte* start = data_ + kHeaderSize + reservations_size; | 2486 const byte* start = data_ + kHeaderSize + reservations_size; |
| 2487 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), | 2487 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), |
| 2488 GetHeaderValue(kNumCodeStubKeysOffset)); | 2488 GetHeaderValue(kNumCodeStubKeysOffset)); |
| 2489 } | 2489 } |
| 2490 } } // namespace v8::internal | 2490 } } // namespace v8::internal |
| OLD | NEW |