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

Unified Diff: src/code-stubs-hydrogen.cc

Issue 15094018: Create AllocationSite objects, pointed to by AllocationSiteInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment response Created 7 years, 5 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/code-stubs.cc ('k') | src/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 97920967a27a3189a817f8835389958ddd63a66f..4d1c27c0e685cd0e8d7713a6c36026d1032cc448 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -315,16 +315,17 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
int length = casted_stub()->length();
- HInstruction* boilerplate =
+ HInstruction* allocation_site =
AddInstruction(new(zone) HLoadKeyed(GetParameter(0),
GetParameter(1),
NULL,
FAST_ELEMENTS));
-
IfBuilder checker(this);
- checker.IfNot<HCompareObjectEqAndBranch, HValue*>(boilerplate, undefined);
+ checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, undefined);
checker.Then();
+ HObjectAccess access = HObjectAccess::ForAllocationSiteInfoSite();
+ HInstruction* boilerplate = AddLoad(allocation_site, access);
if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
HValue* elements = AddLoadElements(boilerplate);
@@ -333,6 +334,7 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
if_fixed_cow.Then();
environment()->Push(BuildCloneShallowArray(context(),
boilerplate,
+ allocation_site,
alloc_site_mode,
FAST_ELEMENTS,
0/*copy-on-write*/));
@@ -343,12 +345,14 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
if_fixed.Then();
environment()->Push(BuildCloneShallowArray(context(),
boilerplate,
+ allocation_site,
alloc_site_mode,
FAST_ELEMENTS,
length));
if_fixed.Else();
environment()->Push(BuildCloneShallowArray(context(),
boilerplate,
+ allocation_site,
alloc_site_mode,
FAST_DOUBLE_ELEMENTS,
length));
@@ -356,6 +360,7 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
ElementsKind elements_kind = casted_stub()->ComputeElementsKind();
environment()->Push(BuildCloneShallowArray(context(),
boilerplate,
+ allocation_site,
alloc_site_mode,
elements_kind,
length));
@@ -422,6 +427,45 @@ Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
template <>
+HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
+ Zone* zone = this->zone();
+
+ HValue* size = AddInstruction(new(zone) HConstant(AllocationSite::kSize));
+ HAllocate::Flags flags = HAllocate::DefaultFlags();
+ flags = static_cast<HAllocate::Flags>(
+ flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
+ HInstruction* object = AddInstruction(new(zone)
+ HAllocate(context(), size, HType::JSObject(), flags));
+
+ // Store the map
+ Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(),
+ isolate());
+ AddStoreMapConstant(object, allocation_site_map);
+
+ // Store the payload (smi elements kind)
+ HValue* initial_elements_kind = AddInstruction(new(zone) HConstant(
+ GetInitialFastElementsKind()));
+ AddInstruction(new(zone) HStoreNamedField(object,
+ HObjectAccess::ForAllocationSitePayload(), initial_elements_kind));
+
+ // We use a hammer (SkipWriteBarrier()) to indicate that we know the input
+ // cell is really a Cell, and so no write barrier is needed.
+ // TODO(mvstanton): Add a debug_code check to verify the input cell is really
+ // a cell. (perhaps with a new instruction, HAssert).
+ HInstruction* cell = GetParameter(0);
+ HObjectAccess access = HObjectAccess::ForCellValue();
+ HStoreNamedField* store = AddStore(cell, access, object);
+ store->SkipWriteBarrier();
+ return cell;
+}
+
+
+Handle<Code> CreateAllocationSiteStub::GenerateCode() {
+ return DoGenerateCode(this);
+}
+
+
+template <>
HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() {
HInstruction* load = BuildUncheckedMonomorphicElementAccess(
GetParameter(0), GetParameter(1), NULL, NULL,
@@ -548,7 +592,10 @@ HValue* CodeStubGraphBuilderBase::BuildArrayConstructor(
}
HValue* property_cell = GetParameter(ArrayConstructorStubBase::kPropertyCell);
- JSArrayBuilder array_builder(this, kind, property_cell, constructor,
+ // Walk through the property cell to the AllocationSite
+ HValue* alloc_site = AddInstruction(new(zone()) HLoadNamedField(property_cell,
+ HObjectAccess::ForCellValue()));
+ JSArrayBuilder array_builder(this, kind, alloc_site, constructor,
override_mode);
HValue* result = NULL;
switch (argument_class) {
« no previous file with comments | « src/code-stubs.cc ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698