OLD | NEW |
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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 3420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3431 // We cannot always fill with one_pointer_filler_map because objects | 3431 // We cannot always fill with one_pointer_filler_map because objects |
3432 // created from API functions expect their internal fields to be initialized | 3432 // created from API functions expect their internal fields to be initialized |
3433 // with undefined_value. | 3433 // with undefined_value. |
3434 // Pre-allocated fields need to be initialized with undefined_value as well | 3434 // Pre-allocated fields need to be initialized with undefined_value as well |
3435 // so that object accesses before the constructor completes (e.g. in the | 3435 // so that object accesses before the constructor completes (e.g. in the |
3436 // debugger) will not cause a crash. | 3436 // debugger) will not cause a crash. |
3437 Object* constructor = map->GetConstructor(); | 3437 Object* constructor = map->GetConstructor(); |
3438 if (constructor->IsJSFunction() && | 3438 if (constructor->IsJSFunction() && |
3439 JSFunction::cast(constructor)->IsInobjectSlackTrackingInProgress()) { | 3439 JSFunction::cast(constructor)->IsInobjectSlackTrackingInProgress()) { |
3440 // We might want to shrink the object later. | 3440 // We might want to shrink the object later. |
3441 DCHECK(obj->GetInternalFieldCount() == 0); | 3441 DCHECK_EQ(0, obj->GetInternalFieldCount()); |
3442 filler = Heap::one_pointer_filler_map(); | 3442 filler = Heap::one_pointer_filler_map(); |
3443 } else { | 3443 } else { |
3444 filler = Heap::undefined_value(); | 3444 filler = Heap::undefined_value(); |
3445 } | 3445 } |
3446 obj->InitializeBody(map, Heap::undefined_value(), filler); | 3446 obj->InitializeBody(map, Heap::undefined_value(), filler); |
3447 } | 3447 } |
3448 | 3448 |
3449 | 3449 |
3450 AllocationResult Heap::AllocateJSObjectFromMap( | 3450 AllocationResult Heap::AllocateJSObjectFromMap( |
3451 Map* map, PretenureFlag pretenure, AllocationSite* allocation_site) { | 3451 Map* map, PretenureFlag pretenure, AllocationSite* allocation_site) { |
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6172 } | 6172 } |
6173 | 6173 |
6174 | 6174 |
6175 // static | 6175 // static |
6176 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6176 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6177 return StaticVisitorBase::GetVisitorId(map); | 6177 return StaticVisitorBase::GetVisitorId(map); |
6178 } | 6178 } |
6179 | 6179 |
6180 } // namespace internal | 6180 } // namespace internal |
6181 } // namespace v8 | 6181 } // namespace v8 |
OLD | NEW |