| 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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 return heap->InNewSpace(*p) && | 1550 return heap->InNewSpace(*p) && |
| 1551 !HeapObject::cast(*p)->map_word().IsForwardingAddress(); | 1551 !HeapObject::cast(*p)->map_word().IsForwardingAddress(); |
| 1552 } | 1552 } |
| 1553 | 1553 |
| 1554 | 1554 |
| 1555 static bool IsUnmodifiedHeapObject(Object** p) { | 1555 static bool IsUnmodifiedHeapObject(Object** p) { |
| 1556 Object* object = *p; | 1556 Object* object = *p; |
| 1557 if (object->IsSmi()) return false; | 1557 if (object->IsSmi()) return false; |
| 1558 HeapObject* heap_object = HeapObject::cast(object); | 1558 HeapObject* heap_object = HeapObject::cast(object); |
| 1559 if (!object->IsJSObject()) return false; | 1559 if (!object->IsJSObject()) return false; |
| 1560 Object* obj_constructor = (JSObject::cast(object))->map()->GetConstructor(); | 1560 JSObject* js_object = JSObject::cast(object); |
| 1561 if (!obj_constructor->IsJSFunction()) return false; | 1561 if (!js_object->WasConstructedFromApiFunction()) return false; |
| 1562 JSFunction* constructor = JSFunction::cast(obj_constructor); | 1562 JSFunction* constructor = |
| 1563 if (!constructor->shared()->IsApiFunction()) return false; | 1563 JSFunction::cast(js_object->map()->GetConstructor()); |
| 1564 if (constructor != nullptr && | 1564 |
| 1565 constructor->initial_map() == heap_object->map()) { | 1565 return constructor->initial_map() == heap_object->map(); |
| 1566 return true; | |
| 1567 } | |
| 1568 return false; | |
| 1569 } | 1566 } |
| 1570 | 1567 |
| 1571 | 1568 |
| 1572 void PromotionQueue::Initialize() { | 1569 void PromotionQueue::Initialize() { |
| 1573 // The last to-space page may be used for promotion queue. On promotion | 1570 // The last to-space page may be used for promotion queue. On promotion |
| 1574 // conflict, we use the emergency stack. | 1571 // conflict, we use the emergency stack. |
| 1575 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) == | 1572 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) == |
| 1576 0); | 1573 0); |
| 1577 front_ = rear_ = | 1574 front_ = rear_ = |
| 1578 reinterpret_cast<struct Entry*>(heap_->new_space()->ToSpaceEnd()); | 1575 reinterpret_cast<struct Entry*>(heap_->new_space()->ToSpaceEnd()); |
| (...skipping 4905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6484 } | 6481 } |
| 6485 | 6482 |
| 6486 | 6483 |
| 6487 // static | 6484 // static |
| 6488 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6485 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6489 return StaticVisitorBase::GetVisitorId(map); | 6486 return StaticVisitorBase::GetVisitorId(map); |
| 6490 } | 6487 } |
| 6491 | 6488 |
| 6492 } // namespace internal | 6489 } // namespace internal |
| 6493 } // namespace v8 | 6490 } // namespace v8 |
| OLD | NEW |