| 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/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 if (map_ != NULL) return; | 16 if (map_ != NULL) return; |
| 17 map_ = new base::HashMap(base::HashMap::PointersMatch); | 17 map_ = new base::HashMap(); |
| 18 ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate); | 18 ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate); |
| 19 for (int i = 0; i < table->size(); ++i) { | 19 for (int i = 0; i < table->size(); ++i) { |
| 20 Address addr = table->address(i); | 20 Address addr = table->address(i); |
| 21 if (addr == ExternalReferenceTable::NotAvailable()) continue; | 21 if (addr == ExternalReferenceTable::NotAvailable()) continue; |
| 22 // We expect no duplicate external references entries in the table. | 22 // We expect no duplicate external references entries in the table. |
| 23 // AccessorRefTable getter may have duplicates, indicated by an empty string | 23 // AccessorRefTable getter may have duplicates, indicated by an empty string |
| 24 // as name. | 24 // as name. |
| 25 DCHECK(table->name(i)[0] == '\0' || | 25 DCHECK(table->name(i)[0] == '\0' || |
| 26 map_->Lookup(addr, Hash(addr)) == nullptr); | 26 map_->Lookup(addr, Hash(addr)) == nullptr); |
| 27 map_->LookupOrInsert(addr, Hash(addr))->value = reinterpret_cast<void*>(i); | 27 map_->LookupOrInsert(addr, Hash(addr))->value = reinterpret_cast<void*>(i); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if (cache->at(i)->IsUndefined(isolate)) break; | 71 if (cache->at(i)->IsUndefined(isolate)) break; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) { | 75 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) { |
| 76 return !o->IsString() && !o->IsScript(); | 76 return !o->IsString() && !o->IsScript(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace internal | 79 } // namespace internal |
| 80 } // namespace v8 | 80 } // namespace v8 |
| OLD | NEW |