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/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3568 DCHECK(!allocation.To(&obj) || !obj->IsJSGlobalObject()); | 3568 DCHECK(!allocation.To(&obj) || !obj->IsJSGlobalObject()); |
3569 #endif | 3569 #endif |
3570 return allocation; | 3570 return allocation; |
3571 } | 3571 } |
3572 | 3572 |
3573 | 3573 |
3574 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) { | 3574 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) { |
3575 // Make the clone. | 3575 // Make the clone. |
3576 Map* map = source->map(); | 3576 Map* map = source->map(); |
3577 | 3577 |
3578 // We can only clone regexps, normal objects or arrays. Copying anything else | 3578 // We can only clone regexps, normal objects, api objects or arrays. Copying |
3579 // will break invariants. | 3579 // anything else will break invariants. |
3580 CHECK(map->instance_type() == JS_REGEXP_TYPE || | 3580 CHECK(map->instance_type() == JS_REGEXP_TYPE || |
3581 map->instance_type() == JS_OBJECT_TYPE || | 3581 map->instance_type() == JS_OBJECT_TYPE || |
3582 map->instance_type() == JS_ARRAY_TYPE); | 3582 map->instance_type() == JS_ARRAY_TYPE || |
| 3583 map->instance_type() == JS_SPECIAL_API_OBJECT_TYPE); |
3583 | 3584 |
3584 int object_size = map->instance_size(); | 3585 int object_size = map->instance_size(); |
3585 HeapObject* clone = nullptr; | 3586 HeapObject* clone = nullptr; |
3586 | 3587 |
3587 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); | 3588 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); |
3588 | 3589 |
3589 int adjusted_object_size = | 3590 int adjusted_object_size = |
3590 site != NULL ? object_size + AllocationMemento::kSize : object_size; | 3591 site != NULL ? object_size + AllocationMemento::kSize : object_size; |
3591 AllocationResult allocation = AllocateRaw(adjusted_object_size, NEW_SPACE); | 3592 AllocationResult allocation = AllocateRaw(adjusted_object_size, NEW_SPACE); |
3592 if (!allocation.To(&clone)) return allocation; | 3593 if (!allocation.To(&clone)) return allocation; |
(...skipping 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6343 } | 6344 } |
6344 | 6345 |
6345 | 6346 |
6346 // static | 6347 // static |
6347 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6348 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6348 return StaticVisitorBase::GetVisitorId(map); | 6349 return StaticVisitorBase::GetVisitorId(map); |
6349 } | 6350 } |
6350 | 6351 |
6351 } // namespace internal | 6352 } // namespace internal |
6352 } // namespace v8 | 6353 } // namespace v8 |
OLD | NEW |