OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/external-reference-table.h" | 5 #include "src/external-reference-table.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/builtins/builtins.h" | 9 #include "src/builtins/builtins.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) { | 39 ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) { |
40 // nullptr is preserved through serialization/deserialization. | 40 // nullptr is preserved through serialization/deserialization. |
41 Add(nullptr, "nullptr"); | 41 Add(nullptr, "nullptr"); |
42 AddReferences(isolate); | 42 AddReferences(isolate); |
43 AddBuiltins(isolate); | 43 AddBuiltins(isolate); |
44 AddRuntimeFunctions(isolate); | 44 AddRuntimeFunctions(isolate); |
45 AddIsolateAddresses(isolate); | 45 AddIsolateAddresses(isolate); |
46 AddAccessors(isolate); | 46 AddAccessors(isolate); |
47 AddStubCache(isolate); | 47 AddStubCache(isolate); |
48 AddDeoptEntries(isolate); | |
49 // API references must be added last. | 48 // API references must be added last. |
50 AddApiReferences(isolate); | 49 AddApiReferences(isolate); |
51 } | 50 } |
52 | 51 |
53 #ifdef DEBUG | 52 #ifdef DEBUG |
54 void ExternalReferenceTable::ResetCount() { | 53 void ExternalReferenceTable::ResetCount() { |
55 for (ExternalReferenceEntry& entry : refs_) entry.count = 0; | 54 for (ExternalReferenceEntry& entry : refs_) entry.count = 0; |
56 } | 55 } |
57 | 56 |
58 void ExternalReferenceTable::PrintCount() { | 57 void ExternalReferenceTable::PrintCount() { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 Add(store_stub_cache->map_reference(StubCache::kPrimary).address(), | 423 Add(store_stub_cache->map_reference(StubCache::kPrimary).address(), |
425 "Store StubCache::primary_->map"); | 424 "Store StubCache::primary_->map"); |
426 Add(store_stub_cache->key_reference(StubCache::kSecondary).address(), | 425 Add(store_stub_cache->key_reference(StubCache::kSecondary).address(), |
427 "Store StubCache::secondary_->key"); | 426 "Store StubCache::secondary_->key"); |
428 Add(store_stub_cache->value_reference(StubCache::kSecondary).address(), | 427 Add(store_stub_cache->value_reference(StubCache::kSecondary).address(), |
429 "Store StubCache::secondary_->value"); | 428 "Store StubCache::secondary_->value"); |
430 Add(store_stub_cache->map_reference(StubCache::kSecondary).address(), | 429 Add(store_stub_cache->map_reference(StubCache::kSecondary).address(), |
431 "Store StubCache::secondary_->map"); | 430 "Store StubCache::secondary_->map"); |
432 } | 431 } |
433 | 432 |
434 void ExternalReferenceTable::AddDeoptEntries(Isolate* isolate) { | |
435 // Add a small set of deopt entry addresses to encoder without generating | |
436 // the | |
437 // deopt table code, which isn't possible at deserialization time. | |
438 HandleScope scope(isolate); | |
439 for (int entry = 0; entry < kDeoptTableSerializeEntryCount; ++entry) { | |
440 Address address = Deoptimizer::GetDeoptimizationEntry( | |
441 isolate, entry, Deoptimizer::LAZY, | |
442 Deoptimizer::CALCULATE_ENTRY_ADDRESS); | |
443 Add(address, "lazy_deopt"); | |
444 } | |
445 } | |
446 | |
447 void ExternalReferenceTable::AddApiReferences(Isolate* isolate) { | 433 void ExternalReferenceTable::AddApiReferences(Isolate* isolate) { |
448 // Add external references provided by the embedder (a null-terminated | 434 // Add external references provided by the embedder (a null-terminated |
449 // array). | 435 // array). |
450 api_refs_start_ = size(); | 436 api_refs_start_ = size(); |
451 intptr_t* api_external_references = isolate->api_external_references(); | 437 intptr_t* api_external_references = isolate->api_external_references(); |
452 if (api_external_references != nullptr) { | 438 if (api_external_references != nullptr) { |
453 while (*api_external_references != 0) { | 439 while (*api_external_references != 0) { |
454 Address address = reinterpret_cast<Address>(*api_external_references); | 440 Address address = reinterpret_cast<Address>(*api_external_references); |
455 Add(address, ResolveSymbol(address)); | 441 Add(address, ResolveSymbol(address)); |
456 api_external_references++; | 442 api_external_references++; |
457 } | 443 } |
458 } | 444 } |
459 } | 445 } |
460 | 446 |
461 } // namespace internal | 447 } // namespace internal |
462 } // namespace v8 | 448 } // namespace v8 |
OLD | NEW |