Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: src/objects-inl.h

Issue 203583007: Support weak heap references in the ConstantPool to support IsWeakObjectInOptimizedCode objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 75ff8393e06c3dcb02608c1e2c35ff1e39f00454..d616ff406c5e08939bed8389fb01a6018d4ed767 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2203,6 +2203,8 @@ SMI_ACCESSORS(
SMI_ACCESSORS(
ConstantPoolArray, first_heap_ptr_index, kFirstHeapPointerIndexOffset)
SMI_ACCESSORS(
+ ConstantPoolArray, first_weak_ptr_index, kFirstWeakPointerIndexOffset)
+SMI_ACCESSORS(
ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset)
@@ -2211,6 +2213,11 @@ int ConstantPoolArray::first_int64_index() {
}
+int ConstantPoolArray::first_ptr_index() {
+ return first_code_ptr_index();
+}
+
+
int ConstantPoolArray::count_of_int64_entries() {
return first_code_ptr_index();
}
@@ -2222,7 +2229,12 @@ int ConstantPoolArray::count_of_code_ptr_entries() {
int ConstantPoolArray::count_of_heap_ptr_entries() {
- return first_int32_index() - first_heap_ptr_index();
+ return first_weak_ptr_index() - first_heap_ptr_index();
+}
+
+
+int ConstantPoolArray::count_of_weak_ptr_entries() {
+ return first_int32_index() - first_weak_ptr_index();
}
@@ -2231,15 +2243,24 @@ int ConstantPoolArray::count_of_int32_entries() {
}
+int ConstantPoolArray::count_of_ptr_entries() {
+ return count_of_code_ptr_entries() + count_of_heap_ptr_entries() +
+ count_of_weak_ptr_entries();
+}
+
+
void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries,
int number_of_code_ptr_entries,
int number_of_heap_ptr_entries,
+ int number_of_weak_ptr_entries,
int number_of_int32_entries) {
int current_index = number_of_int64_entries;
set_first_code_ptr_index(current_index);
current_index += number_of_code_ptr_entries;
set_first_heap_ptr_index(current_index);
current_index += number_of_heap_ptr_entries;
+ set_first_weak_ptr_index(current_index);
+ current_index += number_of_weak_ptr_entries;
set_first_int32_index(current_index);
current_index += number_of_int32_entries;
set_length(current_index);
@@ -2269,7 +2290,14 @@ Address ConstantPoolArray::get_code_ptr_entry(int index) {
Object* ConstantPoolArray::get_heap_ptr_entry(int index) {
ASSERT(map() == GetHeap()->constant_pool_array_map());
- ASSERT(index >= first_heap_ptr_index() && index < first_int32_index());
+ ASSERT(index >= first_heap_ptr_index() && index < first_weak_ptr_index());
+ return READ_FIELD(this, OffsetOfElementAt(index));
+}
+
+
+Object* ConstantPoolArray::get_weak_ptr_entry(int index) {
+ ASSERT(map() == GetHeap()->constant_pool_array_map());
+ ASSERT(index >= first_weak_ptr_index() && index < first_int32_index());
return READ_FIELD(this, OffsetOfElementAt(index));
}
@@ -2290,7 +2318,7 @@ void ConstantPoolArray::set(int index, Address value) {
void ConstantPoolArray::set(int index, Object* value) {
ASSERT(map() == GetHeap()->constant_pool_array_map());
- ASSERT(index >= first_code_ptr_index() && index < first_int32_index());
+ ASSERT(index >= first_heap_ptr_index() && index < first_int32_index());
WRITE_FIELD(this, OffsetOfElementAt(index), value);
WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value);
}
@@ -3874,8 +3902,7 @@ int HeapObject::SizeFromMap(Map* map) {
if (instance_type == CONSTANT_POOL_ARRAY_TYPE) {
return ConstantPoolArray::SizeFor(
reinterpret_cast<ConstantPoolArray*>(this)->count_of_int64_entries(),
- reinterpret_cast<ConstantPoolArray*>(this)->count_of_code_ptr_entries(),
- reinterpret_cast<ConstantPoolArray*>(this)->count_of_heap_ptr_entries(),
+ reinterpret_cast<ConstantPoolArray*>(this)->count_of_ptr_entries(),
reinterpret_cast<ConstantPoolArray*>(this)->count_of_int32_entries());
}
if (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE &&
@@ -4577,7 +4604,6 @@ Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
bool Code::IsWeakObjectInOptimizedCode(Object* object) {
- ASSERT(is_optimized_code());
if (object->IsMap()) {
return Map::cast(object)->CanTransition() &&
FLAG_collect_maps &&
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | src/objects-visiting-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698