OLD | NEW |
---|---|
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 12 matching lines...) Expand all Loading... | |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "code-stubs.h" | 30 #include "code-stubs.h" |
31 #include "hydrogen.h" | 31 #include "hydrogen.h" |
32 #include "lithium.h" | 32 #include "lithium.h" |
33 #include "stub-cache.h" | |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 | 38 |
38 static LChunk* OptimizeGraph(HGraph* graph) { | 39 static LChunk* OptimizeGraph(HGraph* graph) { |
39 Isolate* isolate = graph->isolate(); | 40 Isolate* isolate = graph->isolate(); |
40 AssertNoAllocation no_gc; | 41 AssertNoAllocation no_gc; |
41 NoHandleAllocation no_handles(isolate); | 42 NoHandleAllocation no_handles(isolate); |
42 NoHandleDereference no_deref(isolate); | 43 NoHandleDereference no_deref(isolate); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 | 231 |
231 | 232 |
232 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { | 233 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { |
233 CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this); | 234 CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this); |
234 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); | 235 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); |
235 return chunk->Codegen(Code::COMPILED_STUB); | 236 return chunk->Codegen(Code::COMPILED_STUB); |
236 } | 237 } |
237 | 238 |
238 | 239 |
239 template <> | 240 template <> |
241 HValue* CodeStubGraphBuilder<FastArrayLengthStub>::BuildCodeStub() { | |
242 HInstruction* load = BuildFastArrayLengthLoad(GetParameter(0)); | |
243 AddInstruction(load); | |
244 return load; | |
245 } | |
246 | |
247 | |
248 Handle<Code> FastArrayLengthStub::GenerateCode() { | |
249 CodeStubGraphBuilder<FastArrayLengthStub> builder(this); | |
250 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); | |
251 return chunk->Codegen(Code::COMPILED_STUB); | |
252 } | |
253 | |
254 void FastArrayLengthStub::InitializeInterfaceDescriptor( | |
255 Isolate* isolate, | |
256 CodeStubInterfaceDescriptor* descriptor) { | |
257 descriptor->register_param_count_ = 2; | |
danno
2013/03/12 11:16:16
Descriptors are persistent, but the lifetime of re
| |
258 // See LoadStubCompiler::registers(). | |
259 registers_[0] = receiver_; | |
260 registers_[1] = LoadStubCompiler::name(); | |
261 descriptor->register_params_ = registers_; | |
262 descriptor->deoptimization_handler_ = | |
263 Runtime::FunctionForId(Runtime::kUnexpectedDeopt)->entry; | |
264 } | |
265 | |
266 | |
267 template <> | |
240 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { | 268 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { |
241 Zone* zone = this->zone(); | 269 Zone* zone = this->zone(); |
242 | 270 |
243 HValue* js_array = GetParameter(0); | 271 HValue* js_array = GetParameter(0); |
244 HValue* map = GetParameter(1); | 272 HValue* map = GetParameter(1); |
245 | 273 |
246 info()->MarkAsSavesCallerDoubles(); | 274 info()->MarkAsSavesCallerDoubles(); |
247 | 275 |
248 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); | 276 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); |
249 | 277 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 } | 404 } |
377 | 405 |
378 | 406 |
379 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { | 407 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { |
380 CodeStubGraphBuilder<ArrayNArgumentsConstructorStub> builder(this); | 408 CodeStubGraphBuilder<ArrayNArgumentsConstructorStub> builder(this); |
381 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); | 409 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); |
382 return chunk->Codegen(Code::COMPILED_STUB); | 410 return chunk->Codegen(Code::COMPILED_STUB); |
383 } | 411 } |
384 | 412 |
385 } } // namespace v8::internal | 413 } } // namespace v8::internal |
OLD | NEW |