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 3535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3546 DCHECK(!allocation.To(&obj) || !obj->IsJSGlobalObject()); | 3546 DCHECK(!allocation.To(&obj) || !obj->IsJSGlobalObject()); |
3547 #endif | 3547 #endif |
3548 return allocation; | 3548 return allocation; |
3549 } | 3549 } |
3550 | 3550 |
3551 | 3551 |
3552 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) { | 3552 AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) { |
3553 // Make the clone. | 3553 // Make the clone. |
3554 Map* map = source->map(); | 3554 Map* map = source->map(); |
3555 | 3555 |
3556 // We can only clone regexps, normal objects, api objects or arrays. Copying | 3556 // We can only clone regexps, normal objects, api objects, errors or arrays. |
3557 // anything else will break invariants. | 3557 // Copying anything else will break invariants. |
3558 CHECK(map->instance_type() == JS_REGEXP_TYPE || | 3558 CHECK(map->instance_type() == JS_REGEXP_TYPE || |
3559 map->instance_type() == JS_OBJECT_TYPE || | 3559 map->instance_type() == JS_OBJECT_TYPE || |
| 3560 map->instance_type() == JS_ERROR_TYPE || |
3560 map->instance_type() == JS_ARRAY_TYPE || | 3561 map->instance_type() == JS_ARRAY_TYPE || |
3561 map->instance_type() == JS_API_OBJECT_TYPE || | 3562 map->instance_type() == JS_API_OBJECT_TYPE || |
3562 map->instance_type() == JS_SPECIAL_API_OBJECT_TYPE); | 3563 map->instance_type() == JS_SPECIAL_API_OBJECT_TYPE); |
3563 | 3564 |
3564 int object_size = map->instance_size(); | 3565 int object_size = map->instance_size(); |
3565 HeapObject* clone = nullptr; | 3566 HeapObject* clone = nullptr; |
3566 | 3567 |
3567 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); | 3568 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); |
3568 | 3569 |
3569 int adjusted_object_size = | 3570 int adjusted_object_size = |
(...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6379 } | 6380 } |
6380 | 6381 |
6381 | 6382 |
6382 // static | 6383 // static |
6383 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6384 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6384 return StaticVisitorBase::GetVisitorId(map); | 6385 return StaticVisitorBase::GetVisitorId(map); |
6385 } | 6386 } |
6386 | 6387 |
6387 } // namespace internal | 6388 } // namespace internal |
6388 } // namespace v8 | 6389 } // namespace v8 |
OLD | NEW |