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

Side by Side Diff: src/heap/heap.cc

Issue 1483003002: Revert of Introduce instance type for transition arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/heap/heap.h ('k') | src/heap/mark-compact.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 #endif 173 #endif
174 174
175 // Ensure old_generation_size_ is a multiple of kPageSize. 175 // Ensure old_generation_size_ is a multiple of kPageSize.
176 DCHECK((max_old_generation_size_ & (Page::kPageSize - 1)) == 0); 176 DCHECK((max_old_generation_size_ & (Page::kPageSize - 1)) == 0);
177 177
178 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); 178 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
179 set_native_contexts_list(NULL); 179 set_native_contexts_list(NULL);
180 set_allocation_sites_list(Smi::FromInt(0)); 180 set_allocation_sites_list(Smi::FromInt(0));
181 set_encountered_weak_collections(Smi::FromInt(0)); 181 set_encountered_weak_collections(Smi::FromInt(0));
182 set_encountered_weak_cells(Smi::FromInt(0)); 182 set_encountered_weak_cells(Smi::FromInt(0));
183 set_encountered_transition_arrays(Smi::FromInt(0));
184 // Put a dummy entry in the remembered pages so we can find the list the 183 // Put a dummy entry in the remembered pages so we can find the list the
185 // minidump even if there are no real unmapped pages. 184 // minidump even if there are no real unmapped pages.
186 RememberUnmappedPage(NULL, false); 185 RememberUnmappedPage(NULL, false);
187 } 186 }
188 187
189 188
190 intptr_t Heap::Capacity() { 189 intptr_t Heap::Capacity() {
191 if (!HasBeenSetUp()) return 0; 190 if (!HasBeenSetUp()) return 0;
192 191
193 return new_space_.Capacity() + old_space_->Capacity() + 192 return new_space_.Capacity() + old_space_->Capacity() +
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements) 2326 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements)
2328 2327
2329 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code) 2328 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code)
2330 2329
2331 ALLOCATE_MAP(CELL_TYPE, Cell::kSize, cell) 2330 ALLOCATE_MAP(CELL_TYPE, Cell::kSize, cell)
2332 ALLOCATE_MAP(PROPERTY_CELL_TYPE, PropertyCell::kSize, global_property_cell) 2331 ALLOCATE_MAP(PROPERTY_CELL_TYPE, PropertyCell::kSize, global_property_cell)
2333 ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, weak_cell) 2332 ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, weak_cell)
2334 ALLOCATE_MAP(FILLER_TYPE, kPointerSize, one_pointer_filler) 2333 ALLOCATE_MAP(FILLER_TYPE, kPointerSize, one_pointer_filler)
2335 ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler) 2334 ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler)
2336 2335
2337 ALLOCATE_VARSIZE_MAP(TRANSITION_ARRAY_TYPE, transition_array)
2338 2336
2339 for (unsigned i = 0; i < arraysize(struct_table); i++) { 2337 for (unsigned i = 0; i < arraysize(struct_table); i++) {
2340 const StructTable& entry = struct_table[i]; 2338 const StructTable& entry = struct_table[i];
2341 Map* map; 2339 Map* map;
2342 if (!AllocateMap(entry.type, entry.size).To(&map)) return false; 2340 if (!AllocateMap(entry.type, entry.size).To(&map)) return false;
2343 roots_[entry.index] = map; 2341 roots_[entry.index] = map;
2344 } 2342 }
2345 2343
2346 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, hash_table) 2344 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, hash_table)
2347 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, ordered_hash_table) 2345 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, ordered_hash_table)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); 2487 AllocationResult allocation = AllocateRaw(size, OLD_SPACE);
2490 if (!allocation.To(&result)) return allocation; 2488 if (!allocation.To(&result)) return allocation;
2491 } 2489 }
2492 result->set_map_no_write_barrier(weak_cell_map()); 2490 result->set_map_no_write_barrier(weak_cell_map());
2493 WeakCell::cast(result)->initialize(value); 2491 WeakCell::cast(result)->initialize(value);
2494 WeakCell::cast(result)->clear_next(this); 2492 WeakCell::cast(result)->clear_next(this);
2495 return result; 2493 return result;
2496 } 2494 }
2497 2495
2498 2496
2499 AllocationResult Heap::AllocateTransitionArray(int capacity) {
2500 DCHECK(capacity > 0);
2501 HeapObject* raw_array = nullptr;
2502 {
2503 AllocationResult allocation = AllocateRawFixedArray(capacity, TENURED);
2504 if (!allocation.To(&raw_array)) return allocation;
2505 }
2506 raw_array->set_map_no_write_barrier(transition_array_map());
2507 TransitionArray* array = TransitionArray::cast(raw_array);
2508 array->set_length(capacity);
2509 MemsetPointer(array->data_start(), undefined_value(), capacity);
2510 return array;
2511 }
2512
2513
2514 void Heap::CreateApiObjects() { 2497 void Heap::CreateApiObjects() {
2515 HandleScope scope(isolate()); 2498 HandleScope scope(isolate());
2516 Factory* factory = isolate()->factory(); 2499 Factory* factory = isolate()->factory();
2517 Handle<Map> new_neander_map = 2500 Handle<Map> new_neander_map =
2518 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 2501 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
2519 2502
2520 // Don't use Smi-only elements optimizations for objects with the neander 2503 // Don't use Smi-only elements optimizations for objects with the neander
2521 // map. There are too many cases where element values are set directly with a 2504 // map. There are too many cases where element values are set directly with a
2522 // bottleneck to trap the Smi-only -> fast elements transition, and there 2505 // bottleneck to trap the Smi-only -> fast elements transition, and there
2523 // appears to be no benefit for optimize this case. 2506 // appears to be no benefit for optimize this case.
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after
6120 } 6103 }
6121 6104
6122 6105
6123 // static 6106 // static
6124 int Heap::GetStaticVisitorIdForMap(Map* map) { 6107 int Heap::GetStaticVisitorIdForMap(Map* map) {
6125 return StaticVisitorBase::GetVisitorId(map); 6108 return StaticVisitorBase::GetVisitorId(map);
6126 } 6109 }
6127 6110
6128 } // namespace internal 6111 } // namespace internal
6129 } // namespace v8 6112 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698