Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1186)

Side by Side Diff: src/snapshot/serializer-common.cc

Issue 2707903002: [serializer] allow duplicate API external references. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/external-reference-table.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/snapshot/serializer-common.h" 5 #include "src/snapshot/serializer-common.h"
6 6
7 #include "src/external-reference-table.h" 7 #include "src/external-reference-table.h"
8 #include "src/ic/stub-cache.h" 8 #include "src/ic/stub-cache.h"
9 #include "src/list-inl.h" 9 #include "src/list-inl.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) { 14 ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) {
15 map_ = isolate->external_reference_map(); 15 map_ = isolate->external_reference_map();
16 #ifdef DEBUG 16 #ifdef DEBUG
17 table_ = ExternalReferenceTable::instance(isolate); 17 table_ = ExternalReferenceTable::instance(isolate);
18 #endif // DEBUG 18 #endif // DEBUG
19 if (map_ != nullptr) return; 19 if (map_ != nullptr) return;
20 map_ = new AddressToIndexHashMap(); 20 map_ = new AddressToIndexHashMap();
21 ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate); 21 ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate);
22 for (uint32_t i = 0; i < table->size(); ++i) { 22 for (uint32_t i = 0; i < table->size(); ++i) {
23 Address addr = table->address(i); 23 Address addr = table->address(i);
24 // Ignore duplicate API references.
25 if (table->is_api_reference(i) && !map_->Get(addr).IsNothing()) continue;
24 DCHECK(map_->Get(addr).IsNothing()); 26 DCHECK(map_->Get(addr).IsNothing());
25 map_->Set(addr, i); 27 map_->Set(addr, i);
26 DCHECK(map_->Get(addr).IsJust()); 28 DCHECK(map_->Get(addr).IsJust());
27 } 29 }
28 isolate->set_external_reference_map(map_); 30 isolate->set_external_reference_map(map_);
29 } 31 }
30 32
31 uint32_t ExternalReferenceEncoder::Encode(Address address) const { 33 uint32_t ExternalReferenceEncoder::Encode(Address address) const {
32 Maybe<uint32_t> maybe_index = map_->Get(address); 34 Maybe<uint32_t> maybe_index = map_->Get(address);
33 if (maybe_index.IsNothing()) { 35 if (maybe_index.IsNothing()) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 List<AccessorInfo*>* accessor_infos) { 86 List<AccessorInfo*>* accessor_infos) {
85 // Restore wiped accessor infos. 87 // Restore wiped accessor infos.
86 for (AccessorInfo* info : *accessor_infos) { 88 for (AccessorInfo* info : *accessor_infos) {
87 Foreign::cast(info->js_getter()) 89 Foreign::cast(info->js_getter())
88 ->set_foreign_address(info->redirected_getter()); 90 ->set_foreign_address(info->redirected_getter());
89 } 91 }
90 } 92 }
91 93
92 } // namespace internal 94 } // namespace internal
93 } // namespace v8 95 } // namespace v8
OLDNEW
« no previous file with comments | « src/external-reference-table.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698