Commit 3e59faef authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Microoptimizations to the way we get the current heap.

Review URL: http://codereview.chromium.org/6759030

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7455 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 107d9dc5
......@@ -1158,12 +1158,9 @@ void HeapObject::VerifySmiField(int offset) {
Heap* HeapObject::GetHeap() {
// During GC, the map pointer in HeapObject is used in various ways that
// prevent us from retrieving Heap from the map.
// Assert that we are not in GC, implement GC code in a way that it doesn't
// pull heap from the map.
ASSERT(HEAP->is_safe_to_read_maps());
return map()->heap();
uintptr_t addr = reinterpret_cast<uintptr_t>(this);
addr >>= kHeapDescriptorGranularityBits;
return heap_descriptors[addr].heap;
}
......@@ -2862,6 +2859,34 @@ Heap* Map::heap() {
}
Heap* Code::heap() {
// NOTE: address() helper is not used to save one instruction.
Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_;
ASSERT(heap != NULL);
ASSERT(heap->isolate() == Isolate::Current());
return heap;
}
Isolate* Code::isolate() {
return heap()->isolate();
}
Heap* JSGlobalPropertyCell::heap() {
// NOTE: address() helper is not used to save one instruction.
Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_;
ASSERT(heap != NULL);
ASSERT(heap->isolate() == Isolate::Current());
return heap;
}
Isolate* JSGlobalPropertyCell::isolate() {
return heap()->isolate();
}
Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
return HeapObject::
FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize);
......
This diff is collapsed.
......@@ -3487,6 +3487,10 @@ class Code: public HeapObject {
void CodeVerify();
#endif
// Returns the isolate/heap this code object belongs to.
inline Isolate* isolate();
inline Heap* heap();
// Max loop nesting marker used to postpose OSR. We don't take loop
// nesting that is deeper than 5 levels into account.
static const int kMaxLoopNestingMarker = 6;
......@@ -6009,6 +6013,10 @@ class JSGlobalPropertyCell: public HeapObject {
kValueOffset + kPointerSize,
kSize> BodyDescriptor;
// Returns the isolate/heap this cell object belongs to.
inline Isolate* isolate();
inline Heap* heap();
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment