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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 } | 720 } |
721 | 721 |
722 virtual bool IsMatch(Object* string) { | 722 virtual bool IsMatch(Object* string) { |
723 // We know that all entries in a hash table had their hash keys created. | 723 // We know that all entries in a hash table had their hash keys created. |
724 // Use that knowledge to have fast failure. | 724 // Use that knowledge to have fast failure. |
725 if (hash_ != HashForObject(string)) return false; | 725 if (hash_ != HashForObject(string)) return false; |
726 // We want to compare the content of two internalized strings here. | 726 // We want to compare the content of two internalized strings here. |
727 return string_->SlowEquals(String::cast(string)); | 727 return string_->SlowEquals(String::cast(string)); |
728 } | 728 } |
729 | 729 |
730 virtual uint32_t Hash() V8_OVERRIDE { return hash_; } | 730 virtual uint32_t Hash() OVERRIDE { return hash_; } |
731 | 731 |
732 virtual uint32_t HashForObject(Object* key) V8_OVERRIDE { | 732 virtual uint32_t HashForObject(Object* key) OVERRIDE { |
733 return String::cast(key)->Hash(); | 733 return String::cast(key)->Hash(); |
734 } | 734 } |
735 | 735 |
736 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) | 736 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) |
737 V8_OVERRIDE { | 737 OVERRIDE { |
738 return handle(string_, isolate); | 738 return handle(string_, isolate); |
739 } | 739 } |
740 | 740 |
741 String* string_; | 741 String* string_; |
742 uint32_t hash_; | 742 uint32_t hash_; |
743 }; | 743 }; |
744 | 744 |
745 | 745 |
746 HeapObject* Deserializer::ProcessNewObjectFromSerializedCode(HeapObject* obj) { | 746 HeapObject* Deserializer::ProcessNewObjectFromSerializedCode(HeapObject* obj) { |
747 if (obj->IsString()) { | 747 if (obj->IsString()) { |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 | 1951 |
1952 int SerializedCodeData::CheckSum(String* string) { | 1952 int SerializedCodeData::CheckSum(String* string) { |
1953 int checksum = Version::Hash(); | 1953 int checksum = Version::Hash(); |
1954 #ifdef DEBUG | 1954 #ifdef DEBUG |
1955 uint32_t seed = static_cast<uint32_t>(checksum); | 1955 uint32_t seed = static_cast<uint32_t>(checksum); |
1956 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); | 1956 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); |
1957 #endif // DEBUG | 1957 #endif // DEBUG |
1958 return checksum; | 1958 return checksum; |
1959 } | 1959 } |
1960 } } // namespace v8::internal | 1960 } } // namespace v8::internal |
OLD | NEW |