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

Unified Diff: src/objects-inl.h

Issue 209473006: Ensure that we don't mark weak heap references in the constant pool array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: replace with CHECK Created 6 years, 8 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
« no previous file with comments | « src/objects.h ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 3939921bf7304378b13540fc4a1fda3f426216b3..f632a2d1176e78d1f69936591805929af24b4fb0 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2284,12 +2284,18 @@ void FixedDoubleArray::FillWithHoles(int from, int to) {
}
-SMI_ACCESSORS(
- ConstantPoolArray, first_code_ptr_index, kFirstCodePointerIndexOffset)
-SMI_ACCESSORS(
- ConstantPoolArray, first_heap_ptr_index, kFirstHeapPointerIndexOffset)
-SMI_ACCESSORS(
- ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset)
+void ConstantPoolArray::set_weak_object_state(
+ ConstantPoolArray::WeakObjectState state) {
+ int old_layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
+ int new_layout_field = WeakObjectStateField::update(old_layout_field, state);
+ WRITE_INT_FIELD(this, kArrayLayoutOffset, new_layout_field);
+}
+
+
+ConstantPoolArray::WeakObjectState ConstantPoolArray::get_weak_object_state() {
+ int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
+ return WeakObjectStateField::decode(layout_field);
+}
int ConstantPoolArray::first_int64_index() {
@@ -2297,6 +2303,27 @@ int ConstantPoolArray::first_int64_index() {
}
+int ConstantPoolArray::first_code_ptr_index() {
+ int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
+ return first_int64_index() +
+ NumberOfInt64EntriesField::decode(layout_field);
+}
+
+
+int ConstantPoolArray::first_heap_ptr_index() {
+ int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
+ return first_code_ptr_index() +
+ NumberOfCodePtrEntriesField::decode(layout_field);
+}
+
+
+int ConstantPoolArray::first_int32_index() {
+ int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
+ return first_heap_ptr_index() +
+ NumberOfHeapPtrEntriesField::decode(layout_field);
+}
+
+
int ConstantPoolArray::count_of_int64_entries() {
return first_code_ptr_index();
}
@@ -2317,18 +2344,20 @@ int ConstantPoolArray::count_of_int32_entries() {
}
-void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries,
- int number_of_code_ptr_entries,
- int number_of_heap_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_int32_index(current_index);
- current_index += number_of_int32_entries;
- set_length(current_index);
+void ConstantPoolArray::Init(int number_of_int64_entries,
+ int number_of_code_ptr_entries,
+ int number_of_heap_ptr_entries,
+ int number_of_int32_entries) {
+ set_length(number_of_int64_entries +
+ number_of_code_ptr_entries +
+ number_of_heap_ptr_entries +
+ number_of_int32_entries);
+ int layout_field =
+ NumberOfInt64EntriesField::encode(number_of_int64_entries) |
+ NumberOfCodePtrEntriesField::encode(number_of_code_ptr_entries) |
+ NumberOfHeapPtrEntriesField::encode(number_of_heap_ptr_entries) |
+ WeakObjectStateField::encode(NO_WEAK_OBJECTS);
+ WRITE_INT_FIELD(this, kArrayLayoutOffset, layout_field);
}
@@ -4733,7 +4762,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.h ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698