Generalize AllocationSite field access in HObjectAccess.

There are simply becoming too many individual field accessors, and
more are coming.

R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/43563002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17408 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mvstanton@chromium.org 2013-10-28 09:36:49 +00:00
parent 6c2233fbaa
commit 93fa1939ce
2 changed files with 15 additions and 21 deletions

View File

@ -371,7 +371,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
undefined); undefined);
checker.Then(); checker.Then();
HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo(); HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access);
HValue* push_value; HValue* push_value;
if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
@ -440,7 +441,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
undefined); undefined);
checker.And(); checker.And();
HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo(); HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access);
int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize;
@ -500,12 +502,14 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
// Store the payload (smi elements kind) // Store the payload (smi elements kind)
HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind());
Add<HStoreNamedField>(object, Add<HStoreNamedField>(object,
HObjectAccess::ForAllocationSiteTransitionInfo(), HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kTransitionInfoOffset),
initial_elements_kind); initial_elements_kind);
// Unlike literals, constructed arrays don't have nested sites // Unlike literals, constructed arrays don't have nested sites
Add<HStoreNamedField>(object, Add<HStoreNamedField>(object,
HObjectAccess::ForAllocationSiteNestedSite(), HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kNestedSiteOffset),
graph()->GetConstant0()); graph()->GetConstant0());
// Store an empty fixed array for the code dependency. // Store an empty fixed array for the code dependency.
@ -513,7 +517,8 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
Add<HConstant>(isolate()->factory()->empty_fixed_array()); Add<HConstant>(isolate()->factory()->empty_fixed_array());
HStoreNamedField* store = Add<HStoreNamedField>( HStoreNamedField* store = Add<HStoreNamedField>(
object, object,
HObjectAccess::ForAllocationSiteDependentCode(), HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kDependentCodeOffset),
empty_fixed_array); empty_fixed_array);
// Link the object to the allocation site list // Link the object to the allocation site list
@ -522,8 +527,8 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
HValue* site = Add<HLoadNamedField>(site_list, HValue* site = Add<HLoadNamedField>(site_list,
HObjectAccess::ForAllocationSiteList()); HObjectAccess::ForAllocationSiteList());
store = Add<HStoreNamedField>(object, store = Add<HStoreNamedField>(object,
HObjectAccess::ForAllocationSiteWeakNext(), HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset),
site); site);
store->SkipWriteBarrier(); store->SkipWriteBarrier();
Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
object); object);

View File

@ -5786,20 +5786,9 @@ class HObjectAccess V8_FINAL {
? Representation::Smi() : Representation::Tagged()); ? Representation::Smi() : Representation::Tagged());
} }
static HObjectAccess ForAllocationSiteTransitionInfo() { static HObjectAccess ForAllocationSiteOffset(int offset) {
return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); ASSERT(offset >= HeapObject::kHeaderSize && offset < AllocationSite::kSize);
} return HObjectAccess(kInobject, offset);
static HObjectAccess ForAllocationSiteNestedSite() {
return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset);
}
static HObjectAccess ForAllocationSiteDependentCode() {
return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset);
}
static HObjectAccess ForAllocationSiteWeakNext() {
return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset);
} }
static HObjectAccess ForAllocationSiteList() { static HObjectAccess ForAllocationSiteList() {