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

Side by Side 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: Make this thing work with snapshots. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 explicit CodeStubGraphBuilder(Stub* stub) 159 explicit CodeStubGraphBuilder(Stub* stub)
160 : CodeStubGraphBuilderBase(Isolate::Current(), stub) {} 160 : CodeStubGraphBuilderBase(Isolate::Current(), stub) {}
161 161
162 protected: 162 protected:
163 virtual HValue* BuildCodeStub(); 163 virtual HValue* BuildCodeStub();
164 Stub* casted_stub() { return static_cast<Stub*>(stub()); } 164 Stub* casted_stub() { return static_cast<Stub*>(stub()); }
165 }; 165 };
166 166
167 167
168 template <> 168 template <>
169 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
170 Zone* zone = this->zone();
171 Factory* factory = isolate()->factory();
172 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
173 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
174 int length = casted_stub()->length();
175
176 HInstruction* boilerplate =
177 AddInstruction(new(zone) HLoadKeyed(GetParameter(0),
178 GetParameter(1),
179 NULL,
180 FAST_ELEMENTS));
181
182 CheckBuilder builder(this, BailoutId::StubEntry());
183 builder.CheckNotUndefined(boilerplate);
184
185 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
186 HValue* elements =
187 AddInstruction(new(zone) HLoadElements(boilerplate, NULL));
188
189 IfBuilder if_fixed_cow(this, BailoutId::StubEntry());
190 if_fixed_cow.BeginCompareMapTrue(elements, factory->fixed_cow_array_map());
191 environment()->Push(BuildCloneShallowArray(context(),
192 boilerplate,
193 alloc_site_mode,
194 FAST_ELEMENTS,
195 BailoutId::StubEntry(),
196 0/*copy-on-write*/));
197 if_fixed_cow.BeginFalse();
198
199 IfBuilder if_fixed(this, BailoutId::StubEntry());
200 if_fixed.BeginCompareMapTrue(elements, factory->fixed_array_map());
201 environment()->Push(BuildCloneShallowArray(context(),
202 boilerplate,
203 alloc_site_mode,
204 FAST_ELEMENTS,
205 BailoutId::StubEntry(),
206 length));
207 if_fixed.BeginFalse();
208
209 environment()->Push(BuildCloneShallowArray(context(),
210 boilerplate,
211 alloc_site_mode,
212 FAST_DOUBLE_ELEMENTS,
213 BailoutId::StubEntry(),
214 length));
215 } else {
216 ElementsKind elements_kind = casted_stub()->ComputeElementsKind();
217 environment()->Push(BuildCloneShallowArray(context(),
218 boilerplate,
219 alloc_site_mode,
220 elements_kind,
221 BailoutId::StubEntry(),
222 length));
223 }
224
225 return environment()->Pop();
226 }
227
228
229 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
230 CodeStubGraphBuilder<FastCloneShallowArrayStub> builder(this);
231 LChunk* chunk = OptimizeGraph(builder.CreateGraph());
232 return chunk->Codegen(Code::COMPILED_STUB);
233 }
234
235
236 template <>
169 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { 237 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
170 Zone* zone = this->zone(); 238 Zone* zone = this->zone();
171 Factory* factory = isolate()->factory(); 239 Factory* factory = isolate()->factory();
172 240
173 HInstruction* boilerplate = 241 HInstruction* boilerplate =
174 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), 242 AddInstruction(new(zone) HLoadKeyed(GetParameter(0),
175 GetParameter(1), 243 GetParameter(1),
176 NULL, 244 NULL,
177 FAST_ELEMENTS)); 245 FAST_ELEMENTS));
178 246
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 443 }
376 444
377 445
378 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { 446 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() {
379 CodeStubGraphBuilder<ArrayNArgumentsConstructorStub> builder(this); 447 CodeStubGraphBuilder<ArrayNArgumentsConstructorStub> builder(this);
380 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); 448 LChunk* chunk = OptimizeGraph(builder.CreateGraph());
381 return chunk->Codegen(Code::COMPILED_STUB); 449 return chunk->Codegen(Code::COMPILED_STUB);
382 } 450 }
383 451
384 } } // namespace v8::internal 452 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/deoptimizer.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698