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

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

Issue 1480873003: Introduce instance type for transition arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix zapping 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));
183 // Put a dummy entry in the remembered pages so we can find the list the 184 // Put a dummy entry in the remembered pages so we can find the list the
184 // minidump even if there are no real unmapped pages. 185 // minidump even if there are no real unmapped pages.
185 RememberUnmappedPage(NULL, false); 186 RememberUnmappedPage(NULL, false);
186 } 187 }
187 188
188 189
189 intptr_t Heap::Capacity() { 190 intptr_t Heap::Capacity() {
190 if (!HasBeenSetUp()) return 0; 191 if (!HasBeenSetUp()) return 0;
191 192
192 return new_space_.Capacity() + old_space_->Capacity() + 193 return new_space_.Capacity() + old_space_->Capacity() +
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements) 2327 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements)
2327 2328
2328 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code) 2329 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code)
2329 2330
2330 ALLOCATE_MAP(CELL_TYPE, Cell::kSize, cell) 2331 ALLOCATE_MAP(CELL_TYPE, Cell::kSize, cell)
2331 ALLOCATE_MAP(PROPERTY_CELL_TYPE, PropertyCell::kSize, global_property_cell) 2332 ALLOCATE_MAP(PROPERTY_CELL_TYPE, PropertyCell::kSize, global_property_cell)
2332 ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, weak_cell) 2333 ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, weak_cell)
2333 ALLOCATE_MAP(FILLER_TYPE, kPointerSize, one_pointer_filler) 2334 ALLOCATE_MAP(FILLER_TYPE, kPointerSize, one_pointer_filler)
2334 ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler) 2335 ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler)
2335 2336
2337 ALLOCATE_VARSIZE_MAP(TRANSITION_ARRAY_TYPE, transition_array)
2336 2338
2337 for (unsigned i = 0; i < arraysize(struct_table); i++) { 2339 for (unsigned i = 0; i < arraysize(struct_table); i++) {
2338 const StructTable& entry = struct_table[i]; 2340 const StructTable& entry = struct_table[i];
2339 Map* map; 2341 Map* map;
2340 if (!AllocateMap(entry.type, entry.size).To(&map)) return false; 2342 if (!AllocateMap(entry.type, entry.size).To(&map)) return false;
2341 roots_[entry.index] = map; 2343 roots_[entry.index] = map;
2342 } 2344 }
2343 2345
2344 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, hash_table) 2346 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, hash_table)
2345 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, ordered_hash_table) 2347 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, ordered_hash_table)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); 2489 AllocationResult allocation = AllocateRaw(size, OLD_SPACE);
2488 if (!allocation.To(&result)) return allocation; 2490 if (!allocation.To(&result)) return allocation;
2489 } 2491 }
2490 result->set_map_no_write_barrier(weak_cell_map()); 2492 result->set_map_no_write_barrier(weak_cell_map());
2491 WeakCell::cast(result)->initialize(value); 2493 WeakCell::cast(result)->initialize(value);
2492 WeakCell::cast(result)->clear_next(this); 2494 WeakCell::cast(result)->clear_next(this);
2493 return result; 2495 return result;
2494 } 2496 }
2495 2497
2496 2498
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
2497 void Heap::CreateApiObjects() { 2514 void Heap::CreateApiObjects() {
2498 HandleScope scope(isolate()); 2515 HandleScope scope(isolate());
2499 Factory* factory = isolate()->factory(); 2516 Factory* factory = isolate()->factory();
2500 Handle<Map> new_neander_map = 2517 Handle<Map> new_neander_map =
2501 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 2518 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
2502 2519
2503 // Don't use Smi-only elements optimizations for objects with the neander 2520 // Don't use Smi-only elements optimizations for objects with the neander
2504 // map. There are too many cases where element values are set directly with a 2521 // map. There are too many cases where element values are set directly with a
2505 // bottleneck to trap the Smi-only -> fast elements transition, and there 2522 // bottleneck to trap the Smi-only -> fast elements transition, and there
2506 // appears to be no benefit for optimize this case. 2523 // appears to be no benefit for optimize this case.
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after
6103 } 6120 }
6104 6121
6105 6122
6106 // static 6123 // static
6107 int Heap::GetStaticVisitorIdForMap(Map* map) { 6124 int Heap::GetStaticVisitorIdForMap(Map* map) {
6108 return StaticVisitorBase::GetVisitorId(map); 6125 return StaticVisitorBase::GetVisitorId(map);
6109 } 6126 }
6110 6127
6111 } // namespace internal 6128 } // namespace internal
6112 } // namespace v8 6129 } // 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