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