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

Unified Diff: src/objects-inl.h

Issue 227133007: Allow race-full access of map instance size when sweeping concurrently. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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') | no next file » | 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 978704ac54286aff224e370390121e305cd45100..fbd7af2a036d13a6287ed4c14ae3a8e42ae9f5e0 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4000,7 +4000,7 @@ int Map::GetInObjectPropertyOffset(int index) {
int HeapObject::SizeFromMap(Map* map) {
- int instance_size = map->instance_size();
+ int instance_size = map->nobarrier_instance_size();
if (instance_size != kVariableSizeSentinel) return instance_size;
// Only inline the most frequent cases.
int instance_type = static_cast<int>(map->instance_type());
@@ -4051,6 +4051,35 @@ void Map::set_instance_size(int value) {
}
+int Map::nobarrier_instance_size() {
+ // Our atomics API does not support byte accessors. Hence, we have to manually
+ // read out atomically the whole word and mask out the upper bytes.
+ ASSERT(kInstanceSizeOffset % kPointerSize == 0);
+ AtomicWord value = reinterpret_cast<AtomicWord>(
+ NO_BARRIER_READ_FIELD(this, kInstanceSizeOffset));
+ return (value & 0xff) << kPointerSizeLog2;
+}
+
+
+void Map::nobarrier_set_instance_size(int value) {
+ ASSERT_EQ(0, value & (kPointerSize - 1));
+ value >>= kPointerSizeLog2;
+ ASSERT(0 <= value && value < 256);
+
+ // Our atomics API does not support byte accessors. Hence, we have to manually
+ // read out atomically the whole word, update the last byte and write back the
+ // modified word.
+ ASSERT(kInstanceSizeOffset % kPointerSize == 0);
+ AtomicWord size_field = reinterpret_cast<AtomicWord>(
+ NO_BARRIER_READ_FIELD(this, kInstanceSizeOffset));
+ size_field >>= 8;
Hannes Payer (out of office) 2014/04/07 12:31:13 Do you prefer masking ifdef style?
+ size_field <<= 8;
+ size_field |= value;
+ NO_BARRIER_WRITE_FIELD(
+ this, kInstanceSizeOffset, reinterpret_cast<Object*>(size_field));
+}
+
+
void Map::set_inobject_properties(int value) {
ASSERT(0 <= value && value < 256);
WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value));
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698