Revision: 6861
Author: [email protected]
Date: Mon Feb 21 03:27:25 2011
Log: [Isolates] Get the current heap from page header instead of Map field.
Review URL: http://codereview.chromium.org/6469079
http://code.google.com/p/v8/source/detail?r=6861
Modified:
/branches/experimental/isolates/include/v8.h
/branches/experimental/isolates/src/heap.cc
/branches/experimental/isolates/src/objects-inl.h
/branches/experimental/isolates/src/objects.h
/branches/experimental/isolates/src/serialize.cc
=======================================
--- /branches/experimental/isolates/include/v8.h Wed Jan 12 08:46:47 2011
+++ /branches/experimental/isolates/include/v8.h Mon Feb 21 03:27:25 2011
@@ -3447,7 +3447,7 @@
// These values match non-compiler-dependent values defined within
// the implementation of v8.
static const int kHeapObjectMapOffset = 0;
- static const int kMapInstanceTypeOffset = 2 * kApiPointerSize +
kApiIntSize;
+ static const int kMapInstanceTypeOffset = 1 * kApiPointerSize +
kApiIntSize;
static const int kStringResourceOffset =
InternalConstants<kApiPointerSize>::kStringResourceOffset;
=======================================
--- /branches/experimental/isolates/src/heap.cc Fri Feb 18 04:13:28 2011
+++ /branches/experimental/isolates/src/heap.cc Mon Feb 21 03:27:25 2011
@@ -1498,7 +1498,6 @@
// Map::cast cannot be used due to uninitialized map field.
reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map());
- reinterpret_cast<Map*>(result)->set_heap(this);
reinterpret_cast<Map*>(result)->set_instance_type(instance_type);
reinterpret_cast<Map*>(result)->set_instance_size(instance_size);
reinterpret_cast<Map*>(result)->set_visitor_id(
@@ -1520,7 +1519,6 @@
Map* map = reinterpret_cast<Map*>(result);
map->set_map(meta_map());
- map->set_heap(this);
map->set_instance_type(instance_type);
map->set_visitor_id(
StaticVisitorBase::GetVisitorId(instance_type, instance_size));
=======================================
--- /branches/experimental/isolates/src/objects-inl.h Fri Feb 18 04:13:28
2011
+++ /branches/experimental/isolates/src/objects-inl.h Mon Feb 21 03:27:25
2011
@@ -2738,19 +2738,12 @@
Heap* Map::heap() {
- Heap* heap = reinterpret_cast<Heap*>(READ_INTPTR_FIELD(this,
kHeapOffset));
+ // 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;
}
-
-
-void Map::set_heap(Heap* heap) {
- ASSERT(heap != NULL);
- ASSERT(heap->isolate() == Isolate::Current());
- // WRITE_FIELD does not invoke write barrier, but there is no need here.
- WRITE_INTPTR_FIELD(this, kHeapOffset, reinterpret_cast<intptr_t>(heap));
-}
Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
=======================================
--- /branches/experimental/isolates/src/objects.h Fri Feb 18 04:13:28 2011
+++ /branches/experimental/isolates/src/objects.h Mon Feb 21 03:27:25 2011
@@ -3557,9 +3557,8 @@
inline int visitor_id();
inline void set_visitor_id(int visitor_id);
- // Meta map has a heap pointer for fast access to Heap and Isolate.
+ // Returns the heap this map belongs to.
inline Heap* heap();
- inline void set_heap(Heap* heap);
typedef void (*TraverseCallback)(Map* map, void* data);
@@ -3568,8 +3567,7 @@
static const int kMaxPreAllocatedPropertyFields = 255;
// Layout description.
- static const int kHeapOffset = HeapObject::kHeaderSize;
- static const int kInstanceSizesOffset = kHeapOffset + kPointerSize;
+ static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
static const int kInstanceAttributesOffset = kInstanceSizesOffset +
kIntSize;
static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
=======================================
--- /branches/experimental/isolates/src/serialize.cc Fri Feb 18 04:13:28
2011
+++ /branches/experimental/isolates/src/serialize.cc Mon Feb 21 03:27:25
2011
@@ -713,13 +713,6 @@
LOG(SnapshotPositionEvent(address, source_->position()));
}
ReadChunk(current, limit, space_number, address);
-
- if (space_number == MAP_SPACE) {
- ASSERT(size == Map::kSize);
- HeapObject* obj = HeapObject::FromAddress(address);
- Map* map = reinterpret_cast<Map*>(obj);
- map->set_heap(isolate_->heap());
- }
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev