Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 1c966b350d2aee49a480e56c4f1c53b8619f25bf..cd61c17d71caa1d0fe071c67ddacc523492d6608 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -3684,12 +3684,14 @@ AllocationResult Heap::AllocateJSObject(JSFunction* constructor, |
AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) { |
- // Never used to copy functions. If functions need to be copied we |
- // have to be careful to clear the literals array. |
- SLOW_DCHECK(!source->IsJSFunction()); |
- |
// Make the clone. |
Map* map = source->map(); |
+ |
+ // We can only clone normal objects or arrays. Copying anything else |
+ // will break invariants. |
+ CHECK(map->instance_type() == JS_OBJECT_TYPE || |
+ map->instance_type() == JS_ARRAY_TYPE); |
+ |
int object_size = map->instance_size(); |
HeapObject* clone; |