| 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/snapshot/serialize.h" | 5 #include "src/snapshot/serialize.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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 | 356 |
| 357 class CodeAddressMap: public CodeEventLogger { | 357 class CodeAddressMap: public CodeEventLogger { |
| 358 public: | 358 public: |
| 359 explicit CodeAddressMap(Isolate* isolate) | 359 explicit CodeAddressMap(Isolate* isolate) |
| 360 : isolate_(isolate) { | 360 : isolate_(isolate) { |
| 361 isolate->logger()->addCodeEventListener(this); | 361 isolate->logger()->addCodeEventListener(this); |
| 362 } | 362 } |
| 363 | 363 |
| 364 virtual ~CodeAddressMap() { | 364 ~CodeAddressMap() override { |
| 365 isolate_->logger()->removeCodeEventListener(this); | 365 isolate_->logger()->removeCodeEventListener(this); |
| 366 } | 366 } |
| 367 | 367 |
| 368 virtual void CodeMoveEvent(Address from, Address to) { | 368 void CodeMoveEvent(Address from, Address to) override { |
| 369 address_to_name_map_.Move(from, to); | 369 address_to_name_map_.Move(from, to); |
| 370 } | 370 } |
| 371 | 371 |
| 372 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { | 372 void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) override {} |
| 373 } | |
| 374 | 373 |
| 375 virtual void CodeDeleteEvent(Address from) { | 374 void CodeDeleteEvent(Address from) override { |
| 376 address_to_name_map_.Remove(from); | 375 address_to_name_map_.Remove(from); |
| 377 } | 376 } |
| 378 | 377 |
| 379 const char* Lookup(Address address) { | 378 const char* Lookup(Address address) { |
| 380 return address_to_name_map_.Lookup(address); | 379 return address_to_name_map_.Lookup(address); |
| 381 } | 380 } |
| 382 | 381 |
| 383 private: | 382 private: |
| 384 class NameMap { | 383 class NameMap { |
| 385 public: | 384 public: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 444 |
| 446 void RemoveEntry(HashMap::Entry* entry) { | 445 void RemoveEntry(HashMap::Entry* entry) { |
| 447 impl_.Remove(entry->key, entry->hash); | 446 impl_.Remove(entry->key, entry->hash); |
| 448 } | 447 } |
| 449 | 448 |
| 450 HashMap impl_; | 449 HashMap impl_; |
| 451 | 450 |
| 452 DISALLOW_COPY_AND_ASSIGN(NameMap); | 451 DISALLOW_COPY_AND_ASSIGN(NameMap); |
| 453 }; | 452 }; |
| 454 | 453 |
| 455 virtual void LogRecordedBuffer(Code* code, | 454 void LogRecordedBuffer(Code* code, SharedFunctionInfo*, const char* name, |
| 456 SharedFunctionInfo*, | 455 int length) override { |
| 457 const char* name, | |
| 458 int length) { | |
| 459 address_to_name_map_.Insert(code->address(), name, length); | 456 address_to_name_map_.Insert(code->address(), name, length); |
| 460 } | 457 } |
| 461 | 458 |
| 462 NameMap address_to_name_map_; | 459 NameMap address_to_name_map_; |
| 463 Isolate* isolate_; | 460 Isolate* isolate_; |
| 464 }; | 461 }; |
| 465 | 462 |
| 466 | 463 |
| 467 void Deserializer::DecodeReservation( | 464 void Deserializer::DecodeReservation( |
| 468 Vector<const SerializedData::Reservation> res) { | 465 Vector<const SerializedData::Reservation> res) { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // We want to compare the content of two internalized strings here. | 667 // We want to compare the content of two internalized strings here. |
| 671 return string_->SlowEquals(String::cast(string)); | 668 return string_->SlowEquals(String::cast(string)); |
| 672 } | 669 } |
| 673 | 670 |
| 674 uint32_t Hash() override { return hash_; } | 671 uint32_t Hash() override { return hash_; } |
| 675 | 672 |
| 676 uint32_t HashForObject(Object* key) override { | 673 uint32_t HashForObject(Object* key) override { |
| 677 return String::cast(key)->Hash(); | 674 return String::cast(key)->Hash(); |
| 678 } | 675 } |
| 679 | 676 |
| 680 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) override { | 677 MUST_USE_RESULT Handle<Object> AsHandle(Isolate* isolate) override { |
| 681 return handle(string_, isolate); | 678 return handle(string_, isolate); |
| 682 } | 679 } |
| 683 | 680 |
| 684 private: | 681 private: |
| 685 String* string_; | 682 String* string_; |
| 686 uint32_t hash_; | 683 uint32_t hash_; |
| 687 DisallowHeapAllocation no_gc; | 684 DisallowHeapAllocation no_gc; |
| 688 }; | 685 }; |
| 689 | 686 |
| 690 | 687 |
| (...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2849 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
| 2853 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2850 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 2854 if (r == CHECK_SUCCESS) return scd; | 2851 if (r == CHECK_SUCCESS) return scd; |
| 2855 cached_data->Reject(); | 2852 cached_data->Reject(); |
| 2856 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2853 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 2857 delete scd; | 2854 delete scd; |
| 2858 return NULL; | 2855 return NULL; |
| 2859 } | 2856 } |
| 2860 } // namespace internal | 2857 } // namespace internal |
| 2861 } // namespace v8 | 2858 } // namespace v8 |
| OLD | NEW |