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

Side by Side Diff: src/arm/ic-arm.cc

Issue 1715003: Add inlining of property load on ARM... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 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
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/arm/virtual-frame-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 "assembler-arm.h"
30 #include "codegen-inl.h" 31 #include "codegen-inl.h"
32 #include "disasm.h"
31 #include "ic-inl.h" 33 #include "ic-inl.h"
32 #include "runtime.h" 34 #include "runtime.h"
33 #include "stub-cache.h" 35 #include "stub-cache.h"
34 36
35 namespace v8 { 37 namespace v8 {
36 namespace internal { 38 namespace internal {
37 39
38 40
39 // ---------------------------------------------------------------------------- 41 // ----------------------------------------------------------------------------
40 // Static IC stub generators. 42 // Static IC stub generators.
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 556
555 __ ldr(r3, MemOperand(sp, 0)); 557 __ ldr(r3, MemOperand(sp, 0));
556 __ stm(db_w, sp, r2.bit() | r3.bit()); 558 __ stm(db_w, sp, r2.bit() | r3.bit());
557 559
558 // Perform tail call to the entry. 560 // Perform tail call to the entry.
559 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss)); 561 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss));
560 __ TailCallExternalReference(ref, 2, 1); 562 __ TailCallExternalReference(ref, 2, 1);
561 } 563 }
562 564
563 565
564 // TODO(181): Implement map patching once loop nesting is tracked on the 566 void LoadIC::ClearInlinedVersion(Address address) {
565 // ARM platform so we can generate inlined fast-case code loads in 567 // Reset the map check of the inlined inobject property load (if present) to
566 // loops. 568 // guarantee failure by holding an invalid map (the null value). The offset
567 void LoadIC::ClearInlinedVersion(Address address) {} 569 // can be patched to anything.
568 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { 570 PatchInlinedLoad(address, Heap::null_value(), 0);
569 return false;
570 } 571 }
571 572
573
574 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) {
575 // If the instruction after the call site is not a B instruction then this is
576 // not related to an inlined in-object property load. The B instructions is
577 // located just after the call to the IC in the deferred code handling the
578 // miss in the inlined code. All other calls to a load IC should ensure there
579 // in no B instruction directly following the call.
580 Address address_after_call = address + Assembler::kCallTargetAddressOffset;
581 Instr instr_after_call = Assembler::instr_at(address_after_call);
582 if (!Assembler::IsB(instr_after_call)) return false;
583
584 // Find the end of the inlined code for handling the load.
585 int b_offset =
586 Assembler::GetBOffset(instr_after_call) + Assembler::kPcLoadDelta;
587 ASSERT(b_offset < 0); // Jumping back from deferred code.
588 Address inline_end_address = address_after_call + b_offset;
589
590 // Patch the offset of the property load instruction (ldr r0, [r1, #+XXX]).
591 Address ldr_property_instr_address = inline_end_address - 4;
592 ASSERT(Assembler::IsLdrRegisterImmediate(
593 Assembler::instr_at(ldr_property_instr_address)));
594 Instr ldr_property_instr = Assembler::instr_at(ldr_property_instr_address);
595 ldr_property_instr = Assembler::SetLdrRegisterImmediateOffset(
596 ldr_property_instr, offset - kHeapObjectTag);
Erik Corry 2010/04/22 20:10:41 What if the offset doesn't fit in the immediate fi
597 Assembler::instr_at_put(ldr_property_instr_address, ldr_property_instr);
598
599 // Indicate that code has changed.
600 CPU::FlushICache(ldr_property_instr_address, 1 * Assembler::kInstrSize);
601
602 // Patch the map check.
603 Address ldr_map_instr_address = inline_end_address - 16;
604 Assembler::set_target_address_at(ldr_map_instr_address,
605 reinterpret_cast<Address>(map));
606 return true;
607 }
608
609
572 void KeyedLoadIC::ClearInlinedVersion(Address address) {} 610 void KeyedLoadIC::ClearInlinedVersion(Address address) {}
611
612
573 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { 613 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) {
574 return false; 614 return false;
575 } 615 }
576 616
617
577 void KeyedStoreIC::ClearInlinedVersion(Address address) {} 618 void KeyedStoreIC::ClearInlinedVersion(Address address) {}
619
620
578 void KeyedStoreIC::RestoreInlinedVersion(Address address) {} 621 void KeyedStoreIC::RestoreInlinedVersion(Address address) {}
622
623
579 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { 624 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) {
580 return false; 625 return false;
581 } 626 }
582 627
583 628
584 Object* KeyedLoadIC_Miss(Arguments args); 629 Object* KeyedLoadIC_Miss(Arguments args);
585 630
586 631
587 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 632 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
588 // ---------- S t a t e -------------- 633 // ---------- S t a t e --------------
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 __ bind(&miss); 1730 __ bind(&miss);
1686 1731
1687 GenerateMiss(masm); 1732 GenerateMiss(masm);
1688 } 1733 }
1689 1734
1690 1735
1691 #undef __ 1736 #undef __
1692 1737
1693 1738
1694 } } // namespace v8::internal 1739 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/arm/virtual-frame-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698