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

Unified Diff: src/external-reference-table.cc

Issue 1812853002: Moved the ExternalReferenceTable class to src/external-reference-table.cc/.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/external-reference-table.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/external-reference-table.cc
diff --git a/src/snapshot/serializer-common.cc b/src/external-reference-table.cc
similarity index 85%
copy from src/snapshot/serializer-common.cc
copy to src/external-reference-table.cc
index e7178a7e0c1c7b4bee8b20d02f600c5b2a0976f6..b68b5f5e9d445de7ed388c9e6f0ee08f50d94140 100644
--- a/src/snapshot/serializer-common.cc
+++ b/src/external-reference-table.cc
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/snapshot/serializer-common.h"
+#include "src/external-reference-table.h"
#include "src/accessors.h"
#include "src/assembler.h"
#include "src/counters.h"
#include "src/deoptimizer.h"
#include "src/ic/stub-cache.h"
-#include "src/list-inl.h"
namespace v8 {
namespace internal {
@@ -350,66 +349,5 @@ ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
}
}
-ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) {
- map_ = isolate->external_reference_map();
- if (map_ != NULL) return;
- map_ = new HashMap(HashMap::PointersMatch);
- ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate);
- for (int i = 0; i < table->size(); ++i) {
- Address addr = table->address(i);
- if (addr == ExternalReferenceTable::NotAvailable()) continue;
- // We expect no duplicate external references entries in the table.
- DCHECK_NULL(map_->Lookup(addr, Hash(addr)));
- map_->LookupOrInsert(addr, Hash(addr))->value = reinterpret_cast<void*>(i);
- }
- isolate->set_external_reference_map(map_);
-}
-
-uint32_t ExternalReferenceEncoder::Encode(Address address) const {
- DCHECK_NOT_NULL(address);
- HashMap::Entry* entry =
- const_cast<HashMap*>(map_)->Lookup(address, Hash(address));
- DCHECK_NOT_NULL(entry);
- return static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value));
-}
-
-const char* ExternalReferenceEncoder::NameOfAddress(Isolate* isolate,
- Address address) const {
- HashMap::Entry* entry =
- const_cast<HashMap*>(map_)->Lookup(address, Hash(address));
- if (entry == NULL) return "<unknown>";
- uint32_t i = static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value));
- return ExternalReferenceTable::instance(isolate)->name(i);
-}
-
-void SerializedData::AllocateData(int size) {
- DCHECK(!owns_data_);
- data_ = NewArray<byte>(size);
- size_ = size;
- owns_data_ = true;
- DCHECK(IsAligned(reinterpret_cast<intptr_t>(data_), kPointerAlignment));
-}
-
-// The partial snapshot cache is terminated by undefined. We visit the
-// partial snapshot...
-// - during deserialization to populate it.
-// - during normal GC to keep its content alive.
-// - not during serialization. The partial serializer adds to it explicitly.
-void SerializerDeserializer::Iterate(Isolate* isolate, ObjectVisitor* visitor) {
- List<Object*>* cache = isolate->partial_snapshot_cache();
- for (int i = 0;; ++i) {
- // Extend the array ready to get a value when deserializing.
- if (cache->length() <= i) cache->Add(Smi::FromInt(0));
- // During deserialization, the visitor populates the partial snapshot cache
- // and eventually terminates the cache with undefined.
- visitor->VisitPointer(&cache->at(i));
- if (cache->at(i)->IsUndefined()) break;
- }
-}
-
-bool SerializerDeserializer::CanBeDeferred(HeapObject* o) {
- return !o->IsString() && !o->IsScript();
-}
-
} // namespace internal
} // namespace v8
« no previous file with comments | « src/external-reference-table.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698