From: bmeurer@chromium.org Date: Tue, 20 May 2014 11:25:47 +0000 (+0000) Subject: Get rid of HStoreNamedField::SkipWriteBarrier(). X-Git-Tag: upstream/4.7.83~9068 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd4da6bfe7a674cb48db8dcc13e8fabaf5ba9bb6;p=platform%2Fupstream%2Fv8.git Get rid of HStoreNamedField::SkipWriteBarrier(). The write barrier elimination does the right thing now, so we can get rid of this hack. R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/296023002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21384 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index addc83d..bb50d92 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -500,7 +500,7 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { // Store an empty fixed array for the code dependency. HConstant* empty_fixed_array = Add(isolate()->factory()->empty_fixed_array()); - HStoreNamedField* store = Add( + Add( object, HObjectAccess::ForAllocationSiteOffset( AllocationSite::kDependentCodeOffset), @@ -512,10 +512,15 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { HValue* site = Add( site_list, static_cast(NULL), HObjectAccess::ForAllocationSiteList()); - store = Add(object, + // TODO(mvstanton): This is a store to a weak pointer, which we may want to + // mark as such in order to skip the write barrier, once we have a unified + // system for weakness. For now we decided to keep it like this because having + // an initial write barrier backed store makes this pointer strong until the + // next GC, and allocation sites are designed to survive several GCs anyway. + Add( + object, HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), site); - store->SkipWriteBarrier(); Add(site_list, HObjectAccess::ForAllocationSiteList(), object); diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index f1c5e49..37f735a 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -6704,11 +6704,6 @@ class HStoreNamedField V8_FINAL : public HTemplateInstruction<2> { } virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; - void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } - bool IsSkipWriteBarrier() const { - return write_barrier_mode_ == SKIP_WRITE_BARRIER; - } - HValue* object() const { return OperandAt(0); } HValue* value() const { return OperandAt(1); } @@ -6717,7 +6712,6 @@ class HStoreNamedField V8_FINAL : public HTemplateInstruction<2> { StoreFieldOrKeyedMode store_mode() const { return store_mode_; } bool NeedsWriteBarrier() { - if (IsSkipWriteBarrier()) return false; if (field_representation().IsDouble()) return false; if (field_representation().IsSmi()) return false; if (field_representation().IsInteger32()) return false; @@ -6742,7 +6736,6 @@ class HStoreNamedField V8_FINAL : public HTemplateInstruction<2> { StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) : access_(access), new_space_dominator_(NULL), - write_barrier_mode_(UPDATE_WRITE_BARRIER), store_mode_(store_mode) { // Stores to a non existing in-object property are allowed only to the // newly allocated objects (via HAllocate or HInnerAllocatedObject). @@ -6755,7 +6748,6 @@ class HStoreNamedField V8_FINAL : public HTemplateInstruction<2> { HObjectAccess access_; HValue* new_space_dominator_; - WriteBarrierMode write_barrier_mode_ : 1; StoreFieldOrKeyedMode store_mode_ : 1; }; diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 964db8b..c7b8eea 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -1560,7 +1560,9 @@ HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, HValue* native_context = Add( global_object, static_cast(NULL), HObjectAccess::ForGlobalObjectNativeContext()); - AddStoreMapNoWriteBarrier(result, Add( + Add( + result, HObjectAccess::ForMap(), + Add( native_context, static_cast(NULL), HObjectAccess::ForContextSlot(Context::REGEXP_RESULT_MAP_INDEX))); Add( @@ -1581,8 +1583,7 @@ HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, input); // Initialize the elements header. - AddStoreMapConstantNoWriteBarrier(elements, - isolate()->factory()->fixed_array_map()); + AddStoreMapConstant(elements, isolate()->factory()->fixed_array_map()); Add(elements, HObjectAccess::ForFixedArrayLength(), length); // Initialize the elements contents with undefined. @@ -1832,14 +1833,16 @@ HValue* HGraphBuilder::BuildCreateConsString( if_onebyte.Then(); { // We can safely skip the write barrier for storing the map here. - Handle map = isolate()->factory()->cons_ascii_string_map(); - AddStoreMapConstantNoWriteBarrier(result, map); + Add( + result, HObjectAccess::ForMap(), + Add(isolate()->factory()->cons_ascii_string_map())); } if_onebyte.Else(); { // We can safely skip the write barrier for storing the map here. - Handle map = isolate()->factory()->cons_string_map(); - AddStoreMapConstantNoWriteBarrier(result, map); + Add( + result, HObjectAccess::ForMap(), + Add(isolate()->factory()->cons_string_map())); } if_onebyte.End(); @@ -1998,9 +2001,7 @@ HValue* HGraphBuilder::BuildUncheckedStringAdd( // STRING_TYPE or ASCII_STRING_TYPE here, so we just use STRING_TYPE here. HAllocate* result = BuildAllocate( size, HType::String(), STRING_TYPE, allocation_mode); - - // We can safely skip the write barrier for storing map here. - AddStoreMapNoWriteBarrier(result, map); + Add(result, HObjectAccess::ForMap(), map); // Initialize the string fields. Add(result, HObjectAccess::ForStringHashField(), @@ -2307,7 +2308,7 @@ void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, ? factory->fixed_double_array_map() : factory->fixed_array_map(); - AddStoreMapConstant(elements, map); + Add(elements, HObjectAccess::ForMap(), Add(map)); Add(elements, HObjectAccess::ForFixedArrayLength(), capacity); } @@ -2812,11 +2813,9 @@ void HGraphBuilder::BuildCreateAllocationMemento( // This smi value is reset to zero after every gc, overflow isn't a problem // since the counter is bounded by the new space size. memento_create_count->ClearFlag(HValue::kCanOverflow); - HStoreNamedField* store = Add( + Add( allocation_site, HObjectAccess::ForAllocationSiteOffset( AllocationSite::kPretenureCreateCountOffset), memento_create_count); - // No write barrier needed to store a smi. - store->SkipWriteBarrier(); } } @@ -3034,13 +3033,6 @@ HValue* HGraphBuilder::JSArrayBuilder::AllocateArray(HValue* size_in_bytes, } -HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, - Handle map) { - return Add(object, HObjectAccess::ForMap(), - Add(map)); -} - - HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) { HValue* global_object = Add( context(), static_cast(NULL), diff --git a/src/hydrogen.h b/src/hydrogen.h index fd013f9..17cb7d1 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -1388,18 +1388,9 @@ class HGraphBuilder { HInstruction* AddLoadStringInstanceType(HValue* string); HInstruction* AddLoadStringLength(HValue* string); - HStoreNamedField* AddStoreMapNoWriteBarrier(HValue* object, HValue* map) { - HStoreNamedField* store_map = Add( - object, HObjectAccess::ForMap(), map); - store_map->SkipWriteBarrier(); - return store_map; - } - HStoreNamedField* AddStoreMapConstant(HValue* object, Handle map); - HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, - Handle map) { - HStoreNamedField* store_map = AddStoreMapConstant(object, map); - store_map->SkipWriteBarrier(); - return store_map; + HStoreNamedField* AddStoreMapConstant(HValue* object, Handle map) { + return Add(object, HObjectAccess::ForMap(), + Add(map)); } HLoadNamedField* AddLoadElements(HValue* object, HValue* dependency = NULL);