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 3424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 // We cannot always fill with one_pointer_filler_map because objects | 3435 // We cannot always fill with one_pointer_filler_map because objects |
3436 // created from API functions expect their internal fields to be initialized | 3436 // created from API functions expect their internal fields to be initialized |
3437 // with undefined_value. | 3437 // with undefined_value. |
3438 // Pre-allocated fields need to be initialized with undefined_value as well | 3438 // Pre-allocated fields need to be initialized with undefined_value as well |
3439 // so that object accesses before the constructor completes (e.g. in the | 3439 // so that object accesses before the constructor completes (e.g. in the |
3440 // debugger) will not cause a crash. | 3440 // debugger) will not cause a crash. |
3441 Object* constructor = map->GetConstructor(); | 3441 Object* constructor = map->GetConstructor(); |
3442 if (constructor->IsJSFunction() && | 3442 if (constructor->IsJSFunction() && |
3443 JSFunction::cast(constructor)->IsInobjectSlackTrackingInProgress()) { | 3443 JSFunction::cast(constructor)->IsInobjectSlackTrackingInProgress()) { |
3444 // We might want to shrink the object later. | 3444 // We might want to shrink the object later. |
3445 DCHECK_EQ(0, obj->GetInternalFieldCount()); | 3445 DCHECK(obj->GetInternalFieldCount() == 0); |
3446 filler = Heap::one_pointer_filler_map(); | 3446 filler = Heap::one_pointer_filler_map(); |
3447 } else { | 3447 } else { |
3448 filler = Heap::undefined_value(); | 3448 filler = Heap::undefined_value(); |
3449 } | 3449 } |
3450 obj->InitializeBody(map, Heap::undefined_value(), filler); | 3450 obj->InitializeBody(map, Heap::undefined_value(), filler); |
3451 } | 3451 } |
3452 | 3452 |
3453 | 3453 |
3454 AllocationResult Heap::AllocateJSObjectFromMap( | 3454 AllocationResult Heap::AllocateJSObjectFromMap( |
3455 Map* map, PretenureFlag pretenure, AllocationSite* allocation_site) { | 3455 Map* map, PretenureFlag pretenure, AllocationSite* allocation_site) { |
(...skipping 2671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6127 } | 6127 } |
6128 | 6128 |
6129 | 6129 |
6130 // static | 6130 // static |
6131 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6131 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6132 return StaticVisitorBase::GetVisitorId(map); | 6132 return StaticVisitorBase::GetVisitorId(map); |
6133 } | 6133 } |
6134 | 6134 |
6135 } // namespace internal | 6135 } // namespace internal |
6136 } // namespace v8 | 6136 } // namespace v8 |
OLD | NEW |