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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3630 if (isolate->initial_object_prototype()->map() == this) { 3630 if (isolate->initial_object_prototype()->map() == this) {
3631 return true; 3631 return true;
3632 } 3632 }
3633 3633
3634 return false; 3634 return false;
3635 } 3635 }
3636 3636
3637 3637
3638 Handle<WeakCell> Map::WeakCellForMap(Handle<Map> map) { 3638 Handle<WeakCell> Map::WeakCellForMap(Handle<Map> map) {
3639 Isolate* isolate = map->GetIsolate(); 3639 Isolate* isolate = map->GetIsolate();
3640 if (map->code_cache()->IsFixedArray()) { 3640 if (map->weak_cell_cache()->IsWeakCell()) {
3641 return isolate->factory()->NewWeakCell(map); 3641 return Handle<WeakCell>(WeakCell::cast(map->weak_cell_cache()));
3642 }
3643 Handle<CodeCache> code_cache(CodeCache::cast(map->code_cache()), isolate);
3644 if (code_cache->weak_cell_cache()->IsWeakCell()) {
3645 return Handle<WeakCell>(WeakCell::cast(code_cache->weak_cell_cache()));
3646 } 3642 }
3647 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(map); 3643 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(map);
3648 code_cache->set_weak_cell_cache(*weak_cell); 3644 map->set_weak_cell_cache(*weak_cell);
3649 return weak_cell; 3645 return weak_cell;
3650 } 3646 }
3651 3647
3652 3648
3653 static Handle<Map> AddMissingElementsTransitions(Handle<Map> map, 3649 static Handle<Map> AddMissingElementsTransitions(Handle<Map> map,
3654 ElementsKind to_kind) { 3650 ElementsKind to_kind) {
3655 DCHECK(IsTransitionElementsKind(map->elements_kind())); 3651 DCHECK(IsTransitionElementsKind(map->elements_kind()));
3656 3652
3657 Handle<Map> current_map = map; 3653 Handle<Map> current_map = map;
3658 3654
(...skipping 3201 matching lines...) Expand 10 before | Expand all | Expand 10 after
6860 6856
6861 Handle<Map> new_map; 6857 Handle<Map> new_map;
6862 if (use_cache && cache->Get(fast_map, mode).ToHandle(&new_map)) { 6858 if (use_cache && cache->Get(fast_map, mode).ToHandle(&new_map)) {
6863 #ifdef VERIFY_HEAP 6859 #ifdef VERIFY_HEAP
6864 if (FLAG_verify_heap) new_map->DictionaryMapVerify(); 6860 if (FLAG_verify_heap) new_map->DictionaryMapVerify();
6865 #endif 6861 #endif
6866 #ifdef ENABLE_SLOW_DCHECKS 6862 #ifdef ENABLE_SLOW_DCHECKS
6867 if (FLAG_enable_slow_asserts) { 6863 if (FLAG_enable_slow_asserts) {
6868 // The cached map should match newly created normalized map bit-by-bit, 6864 // The cached map should match newly created normalized map bit-by-bit,
6869 // except for the code cache, which can contain some ics which can be 6865 // except for the code cache, which can contain some ics which can be
6870 // applied to the shared map. 6866 // applied to the shared map, dependent code and weak cell cache.
6871 Handle<Map> fresh = Map::CopyNormalized(fast_map, mode); 6867 Handle<Map> fresh = Map::CopyNormalized(fast_map, mode);
6872 6868
6873 DCHECK(memcmp(fresh->address(), 6869 DCHECK(memcmp(fresh->address(),
6874 new_map->address(), 6870 new_map->address(),
6875 Map::kCodeCacheOffset) == 0); 6871 Map::kCodeCacheOffset) == 0);
6876 STATIC_ASSERT(Map::kDependentCodeOffset == 6872 STATIC_ASSERT(Map::kDependentCodeOffset ==
6877 Map::kCodeCacheOffset + kPointerSize); 6873 Map::kCodeCacheOffset + kPointerSize);
6878 int offset = Map::kDependentCodeOffset + kPointerSize; 6874 STATIC_ASSERT(Map::kWeakCellCacheOffset ==
6875 Map::kDependentCodeOffset + kPointerSize);
6876 int offset = Map::kWeakCellCacheOffset + kPointerSize;
6879 DCHECK(memcmp(fresh->address() + offset, 6877 DCHECK(memcmp(fresh->address() + offset,
6880 new_map->address() + offset, 6878 new_map->address() + offset,
6881 Map::kSize - offset) == 0); 6879 Map::kSize - offset) == 0);
6882 } 6880 }
6883 #endif 6881 #endif
6884 } else { 6882 } else {
6885 new_map = Map::CopyNormalized(fast_map, mode); 6883 new_map = Map::CopyNormalized(fast_map, mode);
6886 if (use_cache) { 6884 if (use_cache) {
6887 cache->Set(fast_map, new_map); 6885 cache->Set(fast_map, new_map);
6888 isolate->counters()->normalized_maps()->Increment(); 6886 isolate->counters()->normalized_maps()->Increment();
(...skipping 10247 matching lines...) Expand 10 before | Expand all | Expand 10 after
17136 CompilationInfo* info) { 17134 CompilationInfo* info) {
17137 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17135 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17138 handle(cell->dependent_code(), info->isolate()), 17136 handle(cell->dependent_code(), info->isolate()),
17139 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17137 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17140 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17138 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17141 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17139 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17142 cell, info->zone()); 17140 cell, info->zone());
17143 } 17141 }
17144 17142
17145 } } // namespace v8::internal 17143 } } // namespace v8::internal
OLDNEW
« 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