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

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

Issue 12521011: Compile FastCloneShallowArrayStub using Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years, 9 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/deoptimizer.cc » ('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 ee903aef1cf6d4e30556fed59ef341e34e44f413..10112e8c32dd7d739e3aafe7c145c9e365e98267 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -189,6 +189,74 @@ static Handle<Code> DoGenerateCode(Stub* stub) {
template <>
+HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
+ Zone* zone = this->zone();
+ Factory* factory = isolate()->factory();
+ AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
+ FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
+ int length = casted_stub()->length();
+
+ HInstruction* boilerplate =
+ AddInstruction(new(zone) HLoadKeyed(GetParameter(0),
+ GetParameter(1),
+ NULL,
+ FAST_ELEMENTS));
+
+ CheckBuilder builder(this);
+ builder.CheckNotUndefined(boilerplate);
+
+ if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
+ HValue* elements =
+ AddInstruction(new(zone) HLoadElements(boilerplate, NULL));
+
+ IfBuilder if_fixed_cow(this);
+ if_fixed_cow.BeginIfMapEquals(elements, factory->fixed_cow_array_map());
+ environment()->Push(BuildCloneShallowArray(context(),
+ boilerplate,
+ alloc_site_mode,
+ FAST_ELEMENTS,
+ BailoutId::StubEntry(),
+ 0/*copy-on-write*/));
+ if_fixed_cow.BeginElse();
+
+ IfBuilder if_fixed(this);
+ if_fixed.BeginIfMapEquals(elements, factory->fixed_array_map());
+ environment()->Push(BuildCloneShallowArray(context(),
+ boilerplate,
+ alloc_site_mode,
+ FAST_ELEMENTS,
+ BailoutId::StubEntry(),
+ length));
+ if_fixed.BeginElse();
+
+ environment()->Push(BuildCloneShallowArray(context(),
+ boilerplate,
+ alloc_site_mode,
+ FAST_DOUBLE_ELEMENTS,
+ BailoutId::StubEntry(),
+ length));
+ } else {
+ ElementsKind elements_kind = casted_stub()->ComputeElementsKind();
+ environment()->Push(BuildCloneShallowArray(context(),
+ boilerplate,
+ alloc_site_mode,
+ elements_kind,
+ BailoutId::StubEntry(),
+ length));
+ }
+
+ return environment()->Pop();
+}
+
+
+Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
+ CodeStubGraphBuilder<FastCloneShallowArrayStub> builder(this);
+ LChunk* chunk = OptimizeGraph(builder.CreateGraph());
+ return chunk->Codegen(Code::COMPILED_STUB);
+}
+
+
+template <>
HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
Zone* zone = this->zone();
Factory* factory = isolate()->factory();
« no previous file with comments | « src/code-stubs.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698