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

Unified Diff: src/objects.cc

Issue 958023002: Store weak cell cache for map in the map itself. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix verification of normalized map Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index bef1881acb1ecd73556dec4796bf350dbe0745bd..a001f70be4515cdcdeae80d01f6510b20e208d62 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3637,15 +3637,11 @@ bool Map::IsMapInArrayPrototypeChain() {
Handle<WeakCell> Map::WeakCellForMap(Handle<Map> map) {
Isolate* isolate = map->GetIsolate();
- if (map->code_cache()->IsFixedArray()) {
- return isolate->factory()->NewWeakCell(map);
- }
- Handle<CodeCache> code_cache(CodeCache::cast(map->code_cache()), isolate);
- if (code_cache->weak_cell_cache()->IsWeakCell()) {
- return Handle<WeakCell>(WeakCell::cast(code_cache->weak_cell_cache()));
+ if (map->weak_cell_cache()->IsWeakCell()) {
+ return Handle<WeakCell>(WeakCell::cast(map->weak_cell_cache()));
}
Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(map);
- code_cache->set_weak_cell_cache(*weak_cell);
+ map->set_weak_cell_cache(*weak_cell);
return weak_cell;
}
@@ -6867,7 +6863,7 @@ Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode,
if (FLAG_enable_slow_asserts) {
// The cached map should match newly created normalized map bit-by-bit,
// except for the code cache, which can contain some ics which can be
- // applied to the shared map.
+ // applied to the shared map, dependent code and weak cell cache.
Handle<Map> fresh = Map::CopyNormalized(fast_map, mode);
DCHECK(memcmp(fresh->address(),
@@ -6875,7 +6871,9 @@ Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode,
Map::kCodeCacheOffset) == 0);
STATIC_ASSERT(Map::kDependentCodeOffset ==
Map::kCodeCacheOffset + kPointerSize);
- int offset = Map::kDependentCodeOffset + kPointerSize;
+ STATIC_ASSERT(Map::kWeakCellCacheOffset ==
+ Map::kDependentCodeOffset + kPointerSize);
+ int offset = Map::kWeakCellCacheOffset + kPointerSize;
DCHECK(memcmp(fresh->address() + offset,
new_map->address() + offset,
Map::kSize - offset) == 0);
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698