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