| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 29 matching lines...) Expand all Loading... |
| 40 // StubCompiler static helper functions | 40 // StubCompiler static helper functions |
| 41 | 41 |
| 42 #define __ ACCESS_MASM(masm) | 42 #define __ ACCESS_MASM(masm) |
| 43 | 43 |
| 44 | 44 |
| 45 static void ProbeTable(MacroAssembler* masm, | 45 static void ProbeTable(MacroAssembler* masm, |
| 46 Code::Flags flags, | 46 Code::Flags flags, |
| 47 StubCache::Table table, | 47 StubCache::Table table, |
| 48 Register name, | 48 Register name, |
| 49 Register offset) { | 49 Register offset) { |
| 50 // The offset register must hold a *positive* smi. | 50 ASSERT_EQ(8, kPointerSize); |
| 51 ASSERT_EQ(16, sizeof(StubCache::Entry)); |
| 52 // The offset register holds the entry offset times four (due to masking |
| 53 // and shifting optimizations). |
| 51 ExternalReference key_offset(SCTableReference::keyReference(table)); | 54 ExternalReference key_offset(SCTableReference::keyReference(table)); |
| 52 Label miss; | 55 Label miss; |
| 53 | 56 |
| 54 __ movq(kScratchRegister, key_offset); | 57 __ movq(kScratchRegister, key_offset); |
| 55 SmiIndex index = masm->SmiToIndex(offset, offset, kPointerSizeLog2); | |
| 56 // Check that the key in the entry matches the name. | 58 // Check that the key in the entry matches the name. |
| 57 __ cmpl(name, Operand(kScratchRegister, index.reg, index.scale, 0)); | 59 // Multiply entry offset by 16 to get the entry address. Since the |
| 60 // offset register already holds the entry offset times four, multiply |
| 61 // by a further four. |
| 62 __ cmpl(name, Operand(kScratchRegister, offset, times_4, 0)); |
| 58 __ j(not_equal, &miss); | 63 __ j(not_equal, &miss); |
| 59 // Get the code entry from the cache. | 64 // Get the code entry from the cache. |
| 60 // Use key_offset + kPointerSize, rather than loading value_offset. | 65 // Use key_offset + kPointerSize, rather than loading value_offset. |
| 61 __ movq(kScratchRegister, | 66 __ movq(kScratchRegister, |
| 62 Operand(kScratchRegister, index.reg, index.scale, kPointerSize)); | 67 Operand(kScratchRegister, offset, times_4, kPointerSize)); |
| 63 // Check that the flags match what we're looking for. | 68 // Check that the flags match what we're looking for. |
| 64 __ movl(offset, FieldOperand(kScratchRegister, Code::kFlagsOffset)); | 69 __ movl(offset, FieldOperand(kScratchRegister, Code::kFlagsOffset)); |
| 65 __ and_(offset, Immediate(~Code::kFlagsNotUsedInLookup)); | 70 __ and_(offset, Immediate(~Code::kFlagsNotUsedInLookup)); |
| 66 __ cmpl(offset, Immediate(flags)); | 71 __ cmpl(offset, Immediate(flags)); |
| 67 __ j(not_equal, &miss); | 72 __ j(not_equal, &miss); |
| 68 | 73 |
| 69 // Jump to the first instruction in the code stub. | 74 // Jump to the first instruction in the code stub. |
| 70 __ addq(kScratchRegister, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 75 __ addq(kScratchRegister, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 71 __ jmp(kScratchRegister); | 76 __ jmp(kScratchRegister); |
| 72 | 77 |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1856 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1852 | 1857 |
| 1853 // Return the generated code. | 1858 // Return the generated code. |
| 1854 return GetCode(); | 1859 return GetCode(); |
| 1855 } | 1860 } |
| 1856 | 1861 |
| 1857 | 1862 |
| 1858 #undef __ | 1863 #undef __ |
| 1859 | 1864 |
| 1860 } } // namespace v8::internal | 1865 } } // namespace v8::internal |
| OLD | NEW |