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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 669 |
670 | 670 |
671 // Used to insert a deserialized internalized string into the string table. | 671 // Used to insert a deserialized internalized string into the string table. |
672 class StringTableInsertionKey : public HashTableKey { | 672 class StringTableInsertionKey : public HashTableKey { |
673 public: | 673 public: |
674 explicit StringTableInsertionKey(String* string) | 674 explicit StringTableInsertionKey(String* string) |
675 : string_(string), hash_(HashForObject(string)) { | 675 : string_(string), hash_(HashForObject(string)) { |
676 DCHECK(string->IsInternalizedString()); | 676 DCHECK(string->IsInternalizedString()); |
677 } | 677 } |
678 | 678 |
679 bool IsMatch(Object* string) OVERRIDE { | 679 bool IsMatch(Object* string) override { |
680 // We know that all entries in a hash table had their hash keys created. | 680 // We know that all entries in a hash table had their hash keys created. |
681 // Use that knowledge to have fast failure. | 681 // Use that knowledge to have fast failure. |
682 if (hash_ != HashForObject(string)) return false; | 682 if (hash_ != HashForObject(string)) return false; |
683 // We want to compare the content of two internalized strings here. | 683 // We want to compare the content of two internalized strings here. |
684 return string_->SlowEquals(String::cast(string)); | 684 return string_->SlowEquals(String::cast(string)); |
685 } | 685 } |
686 | 686 |
687 uint32_t Hash() OVERRIDE { return hash_; } | 687 uint32_t Hash() override { return hash_; } |
688 | 688 |
689 uint32_t HashForObject(Object* key) OVERRIDE { | 689 uint32_t HashForObject(Object* key) override { |
690 return String::cast(key)->Hash(); | 690 return String::cast(key)->Hash(); |
691 } | 691 } |
692 | 692 |
693 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) | 693 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) override { |
694 OVERRIDE { | |
695 return handle(string_, isolate); | 694 return handle(string_, isolate); |
696 } | 695 } |
697 | 696 |
698 String* string_; | 697 String* string_; |
699 uint32_t hash_; | 698 uint32_t hash_; |
700 }; | 699 }; |
701 | 700 |
702 | 701 |
703 HeapObject* Deserializer::ProcessNewObjectFromSerializedCode(HeapObject* obj) { | 702 HeapObject* Deserializer::ProcessNewObjectFromSerializedCode(HeapObject* obj) { |
704 if (obj->IsString()) { | 703 if (obj->IsString()) { |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 DisallowHeapAllocation no_gc; | 2591 DisallowHeapAllocation no_gc; |
2593 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2592 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2594 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2593 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2595 if (r == CHECK_SUCCESS) return scd; | 2594 if (r == CHECK_SUCCESS) return scd; |
2596 cached_data->Reject(); | 2595 cached_data->Reject(); |
2597 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2596 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2598 delete scd; | 2597 delete scd; |
2599 return NULL; | 2598 return NULL; |
2600 } | 2599 } |
2601 } } // namespace v8::internal | 2600 } } // namespace v8::internal |
OLD | NEW |