From 728614daf92c8a4f3ea91451d9341c2731957273 Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Wed, 9 Apr 2014 09:50:25 +0000 Subject: [PATCH] Allow race-full access of map instance size when sweeping concurrently. BUG= R=jarin@chromium.org, mstarzinger@chromium.org Review URL: https://codereview.chromium.org/227133007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20604 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects-inl.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/objects-inl.h b/src/objects-inl.h index d6665d6f01..4c9f160c4a 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -1232,9 +1232,16 @@ MaybeObject* Object::GetProperty(Name* key, PropertyAttributes* attributes) { #define READ_BYTE_FIELD(p, offset) \ (*reinterpret_cast(FIELD_ADDR(p, offset))) +#define NOBARRIER_READ_BYTE_FIELD(p, offset) \ + static_cast(NoBarrier_Load( \ + reinterpret_cast(FIELD_ADDR(p, offset))) ) + #define WRITE_BYTE_FIELD(p, offset, value) \ (*reinterpret_cast(FIELD_ADDR(p, offset)) = value) +#define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value) \ + NoBarrier_Store(reinterpret_cast(FIELD_ADDR(p, offset)), \ + static_cast(value)); Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { return &READ_FIELD(obj, byte_offset); @@ -4151,7 +4158,8 @@ void Map::set_visitor_id(int id) { int Map::instance_size() { - return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2; + return NOBARRIER_READ_BYTE_FIELD( + this, kInstanceSizeOffset) << kPointerSizeLog2; } @@ -4221,7 +4229,8 @@ void Map::set_instance_size(int value) { ASSERT_EQ(0, value & (kPointerSize - 1)); value >>= kPointerSizeLog2; ASSERT(0 <= value && value < 256); - WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast(value)); + NOBARRIER_WRITE_BYTE_FIELD( + this, kInstanceSizeOffset, static_cast(value)); } @@ -7075,11 +7084,15 @@ void FlexibleBodyDescriptor::IterateBody(HeapObject* obj, #undef ACCESSORS #undef ACCESSORS_TO_SMI #undef SMI_ACCESSORS +#undef SYNCHRONIZED_SMI_ACCESSORS +#undef NOBARRIER_SMI_ACCESSORS #undef BOOL_GETTER #undef BOOL_ACCESSORS #undef FIELD_ADDR #undef READ_FIELD +#undef NOBARRIER_READ_FIELD #undef WRITE_FIELD +#undef NOBARRIER_WRITE_FIELD #undef WRITE_BARRIER #undef CONDITIONAL_WRITE_BARRIER #undef READ_DOUBLE_FIELD @@ -7094,6 +7107,8 @@ void FlexibleBodyDescriptor::IterateBody(HeapObject* obj, #undef WRITE_SHORT_FIELD #undef READ_BYTE_FIELD #undef WRITE_BYTE_FIELD +#undef NOBARRIER_READ_BYTE_FIELD +#undef NOBARRIER_WRITE_BYTE_FIELD } } // namespace v8::internal