Chromium Code Reviews| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 566 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); | 566 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); |
| 567 return AddInstruction(BuildLoadNamedField(GetParameter(0), access)); | 567 return AddInstruction(BuildLoadNamedField(GetParameter(0), access)); |
| 568 } | 568 } |
| 569 | 569 |
| 570 | 570 |
| 571 Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) { | 571 Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) { |
| 572 return DoGenerateCode(isolate, this); | 572 return DoGenerateCode(isolate, this); |
| 573 } | 573 } |
| 574 | 574 |
| 575 | 575 |
| 576 template<> | |
| 577 HValue* CodeStubGraphBuilder<KeyedArrayCallStub>::BuildCodeStub() { | |
| 578 info()->SetGlobalScope(new(zone()) Scope(NULL, GLOBAL_SCOPE, zone())); | |
| 579 Scope* scope = new(zone()) Scope( | |
| 580 info()->global_scope(), FUNCTION_SCOPE, zone()); | |
| 581 info()->SetScope(scope); | |
| 582 | |
| 583 int argc = casted_stub()->argc() + 1; | |
| 584 for (int i = 0; i < argc; i++) { | |
| 585 scope->DeclareParameter(isolate()->factory()->empty_string(), VAR); | |
| 586 } | |
|
danno
2013/10/02 08:49:11
This is a total hack. I am not sure how to do it b
Toon Verwaest
2013/10/02 16:28:16
Done.
| |
| 587 | |
| 588 HValue* receiver = Add<HParameter>(1); | |
| 589 | |
| 590 // Load the expected array map from the context. | |
| 591 HValue* native_context = BuildGetNativeContext(); | |
| 592 HValue* index = Add<HConstant>( | |
| 593 static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); | |
| 594 HValue* map_array = Add<HLoadKeyed>( | |
| 595 native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS); | |
| 596 HValue* kind_index = Add<HConstant>(casted_stub()->elements_kind()); | |
| 597 HValue* map = Add<HLoadKeyed>( | |
| 598 map_array, kind_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); | |
|
danno
2013/10/02 08:49:11
Please find a way to share this code in some way w
Toon Verwaest
2013/10/02 16:28:16
Done.
| |
| 599 | |
| 600 HValue* checked_receiver = Add<HCheckMapValue>(receiver, map); | |
| 601 | |
| 602 HValue* function = BuildUncheckedMonomorphicElementAccess( | |
| 603 checked_receiver, GetParameter(0), | |
| 604 NULL, true, casted_stub()->elements_kind(), | |
| 605 false, NEVER_RETURN_HOLE, STANDARD_STORE); | |
| 606 return Add<HCallFunction>(function, argc, true); | |
| 607 } | |
| 608 | |
| 609 | |
| 610 Handle<Code> KeyedArrayCallStub::GenerateCode(Isolate* isolate) { | |
| 611 return DoGenerateCode(isolate, this); | |
| 612 } | |
| 613 | |
| 614 | |
| 576 template <> | 615 template <> |
| 577 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { | 616 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { |
| 578 BuildUncheckedMonomorphicElementAccess( | 617 BuildUncheckedMonomorphicElementAccess( |
| 579 GetParameter(0), GetParameter(1), GetParameter(2), | 618 GetParameter(0), GetParameter(1), GetParameter(2), |
| 580 casted_stub()->is_js_array(), casted_stub()->elements_kind(), | 619 casted_stub()->is_js_array(), casted_stub()->elements_kind(), |
| 581 true, NEVER_RETURN_HOLE, casted_stub()->store_mode()); | 620 true, NEVER_RETURN_HOLE, casted_stub()->store_mode()); |
| 582 | 621 |
| 583 return GetParameter(2); | 622 return GetParameter(2); |
| 584 } | 623 } |
| 585 | 624 |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1127 return js_function; | 1166 return js_function; |
| 1128 } | 1167 } |
| 1129 | 1168 |
| 1130 | 1169 |
| 1131 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1170 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
| 1132 return DoGenerateCode(isolate, this); | 1171 return DoGenerateCode(isolate, this); |
| 1133 } | 1172 } |
| 1134 | 1173 |
| 1135 | 1174 |
| 1136 } } // namespace v8::internal | 1175 } } // namespace v8::internal |
| OLD | NEW |