Reviewers: mvstanton,
Message:
Hey Michael,
Here's the SkipWriteBarrier() goodness we're talking about. :-)
PTAL
-- Benedikt
Description:
Get rid of HStoreNamedField::SkipWriteBarrier().
The write barrier elimination does the right thing now, so
we can get rid of this hack.
Please review this at https://codereview.chromium.org/296023002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+24, -44 lines):
M src/code-stubs-hydrogen.cc
M src/hydrogen.h
M src/hydrogen.cc
M src/hydrogen-instructions.h
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index
addc83d0f4cac9c0ac9847b809a2d4df6593dcdf..bb50d9264b71f6abbc0e475fea8e08911a838552
100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -500,7 +500,7 @@ HValue*
CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
// Store an empty fixed array for the code dependency.
HConstant* empty_fixed_array =
Add<HConstant>(isolate()->factory()->empty_fixed_array());
- HStoreNamedField* store = Add<HStoreNamedField>(
+ Add<HStoreNamedField>(
object,
HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kDependentCodeOffset),
@@ -512,10 +512,15 @@ HValue*
CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
HValue* site = Add<HLoadNamedField>(
site_list, static_cast<HValue*>(NULL),
HObjectAccess::ForAllocationSiteList());
- store = Add<HStoreNamedField>(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<HStoreNamedField>(
+ object,
HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset),
site);
- store->SkipWriteBarrier();
Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
object);
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
f1c5e49da0d6a0c8f4f8d5d7c56009bf81cb9aef..37f735a1a883c31a7f6ab99844f521b8833721c4
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;
};
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
964db8bdcc0af450eafe73d541871abb1e4e9c0e..c7b8eea46cc9dd3d5587d1291effc250041ea368
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1560,7 +1560,9 @@ HValue*
HGraphBuilder::BuildRegExpConstructResult(HValue* length,
HValue* native_context = Add<HLoadNamedField>(
global_object, static_cast<HValue*>(NULL),
HObjectAccess::ForGlobalObjectNativeContext());
- AddStoreMapNoWriteBarrier(result, Add<HLoadNamedField>(
+ Add<HStoreNamedField>(
+ result, HObjectAccess::ForMap(),
+ Add<HLoadNamedField>(
native_context, static_cast<HValue*>(NULL),
HObjectAccess::ForContextSlot(Context::REGEXP_RESULT_MAP_INDEX)));
Add<HStoreNamedField>(
@@ -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<HStoreNamedField>(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> map = isolate()->factory()->cons_ascii_string_map();
- AddStoreMapConstantNoWriteBarrier(result, map);
+ Add<HStoreNamedField>(
+ result, HObjectAccess::ForMap(),
+ Add<HConstant>(isolate()->factory()->cons_ascii_string_map()));
}
if_onebyte.Else();
{
// We can safely skip the write barrier for storing the map here.
- Handle<Map> map = isolate()->factory()->cons_string_map();
- AddStoreMapConstantNoWriteBarrier(result, map);
+ Add<HStoreNamedField>(
+ result, HObjectAccess::ForMap(),
+ Add<HConstant>(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<HStoreNamedField>(result, HObjectAccess::ForMap(), map);
// Initialize the string fields.
Add<HStoreNamedField>(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<HStoreNamedField>(elements, HObjectAccess::ForMap(),
Add<HConstant>(map));
Add<HStoreNamedField>(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<HStoreNamedField>(
+ Add<HStoreNamedField>(
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> map) {
- return Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
- Add<HConstant>(map));
-}
-
-
HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) {
HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL),
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index
fd013f96b5a3889dc1faa3d9f09ee3f6fa3724cf..17cb7d1aa156edfc660f1e0ce1236d054d536d35
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<HStoreNamedField>(
- object, HObjectAccess::ForMap(), map);
- store_map->SkipWriteBarrier();
- return store_map;
- }
- HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map);
- HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object,
- Handle<Map> map) {
- HStoreNamedField* store_map = AddStoreMapConstant(object, map);
- store_map->SkipWriteBarrier();
- return store_map;
+ HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map) {
+ return Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
+ Add<HConstant>(map));
}
HLoadNamedField* AddLoadElements(HValue* object,
HValue* dependency = NULL);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.