| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 21 matching lines...) Expand all Loading... |
| 32 #include "ic-inl.h" | 32 #include "ic-inl.h" |
| 33 #include "codegen-inl.h" | 33 #include "codegen-inl.h" |
| 34 #include "stub-cache.h" | 34 #include "stub-cache.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 #define __ ACCESS_MASM(masm) | 39 #define __ ACCESS_MASM(masm) |
| 40 | 40 |
| 41 | 41 |
| 42 static void ProbeTable(MacroAssembler* masm, | 42 static void ProbeTable(Isolate* isolate, |
| 43 MacroAssembler* masm, |
| 43 Code::Flags flags, | 44 Code::Flags flags, |
| 44 StubCache::Table table, | 45 StubCache::Table table, |
| 45 Register name, | 46 Register name, |
| 46 Register offset, | 47 Register offset, |
| 47 Register extra) { | 48 Register extra) { |
| 48 ExternalReference key_offset(SCTableReference::keyReference(table)); | 49 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); |
| 49 ExternalReference value_offset(SCTableReference::valueReference(table)); | 50 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); |
| 50 | 51 |
| 51 Label miss; | 52 Label miss; |
| 52 | 53 |
| 53 if (extra.is_valid()) { | 54 if (extra.is_valid()) { |
| 54 // Get the code entry from the cache. | 55 // Get the code entry from the cache. |
| 55 __ mov(extra, Operand::StaticArray(offset, times_2, value_offset)); | 56 __ mov(extra, Operand::StaticArray(offset, times_2, value_offset)); |
| 56 | 57 |
| 57 // Check that the key in the entry matches the name. | 58 // Check that the key in the entry matches the name. |
| 58 __ cmp(name, Operand::StaticArray(offset, times_2, key_offset)); | 59 __ cmp(name, Operand::StaticArray(offset, times_2, key_offset)); |
| 59 __ j(not_equal, &miss, not_taken); | 60 __ j(not_equal, &miss, not_taken); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 101 } |
| 101 } | 102 } |
| 102 | 103 |
| 103 | 104 |
| 104 void StubCache::GenerateProbe(MacroAssembler* masm, | 105 void StubCache::GenerateProbe(MacroAssembler* masm, |
| 105 Code::Flags flags, | 106 Code::Flags flags, |
| 106 Register receiver, | 107 Register receiver, |
| 107 Register name, | 108 Register name, |
| 108 Register scratch, | 109 Register scratch, |
| 109 Register extra) { | 110 Register extra) { |
| 111 Isolate* isolate = Isolate::Current(); |
| 110 Label miss; | 112 Label miss; |
| 111 | 113 |
| 112 // Make sure that code is valid. The shifting code relies on the | 114 // Make sure that code is valid. The shifting code relies on the |
| 113 // entry size being 8. | 115 // entry size being 8. |
| 114 ASSERT(sizeof(Entry) == 8); | 116 ASSERT(sizeof(Entry) == 8); |
| 115 | 117 |
| 116 // Make sure the flags does not name a specific type. | 118 // Make sure the flags does not name a specific type. |
| 117 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); | 119 ASSERT(Code::ExtractTypeFromFlags(flags) == 0); |
| 118 | 120 |
| 119 // Make sure that there are no register conflicts. | 121 // Make sure that there are no register conflicts. |
| 120 ASSERT(!scratch.is(receiver)); | 122 ASSERT(!scratch.is(receiver)); |
| 121 ASSERT(!scratch.is(name)); | 123 ASSERT(!scratch.is(name)); |
| 122 ASSERT(!extra.is(receiver)); | 124 ASSERT(!extra.is(receiver)); |
| 123 ASSERT(!extra.is(name)); | 125 ASSERT(!extra.is(name)); |
| 124 ASSERT(!extra.is(scratch)); | 126 ASSERT(!extra.is(scratch)); |
| 125 | 127 |
| 126 // Check that the receiver isn't a smi. | 128 // Check that the receiver isn't a smi. |
| 127 __ test(receiver, Immediate(kSmiTagMask)); | 129 __ test(receiver, Immediate(kSmiTagMask)); |
| 128 __ j(zero, &miss, not_taken); | 130 __ j(zero, &miss, not_taken); |
| 129 | 131 |
| 130 // Get the map of the receiver and compute the hash. | 132 // Get the map of the receiver and compute the hash. |
| 131 __ mov(scratch, FieldOperand(name, String::kHashFieldOffset)); | 133 __ mov(scratch, FieldOperand(name, String::kHashFieldOffset)); |
| 132 __ add(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); | 134 __ add(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); |
| 133 __ xor_(scratch, flags); | 135 __ xor_(scratch, flags); |
| 134 __ and_(scratch, (kPrimaryTableSize - 1) << kHeapObjectTagSize); | 136 __ and_(scratch, (kPrimaryTableSize - 1) << kHeapObjectTagSize); |
| 135 | 137 |
| 136 // Probe the primary table. | 138 // Probe the primary table. |
| 137 ProbeTable(masm, flags, kPrimary, name, scratch, extra); | 139 ProbeTable(isolate, masm, flags, kPrimary, name, scratch, extra); |
| 138 | 140 |
| 139 // Primary miss: Compute hash for secondary probe. | 141 // Primary miss: Compute hash for secondary probe. |
| 140 __ mov(scratch, FieldOperand(name, String::kHashFieldOffset)); | 142 __ mov(scratch, FieldOperand(name, String::kHashFieldOffset)); |
| 141 __ add(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); | 143 __ add(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); |
| 142 __ xor_(scratch, flags); | 144 __ xor_(scratch, flags); |
| 143 __ and_(scratch, (kPrimaryTableSize - 1) << kHeapObjectTagSize); | 145 __ and_(scratch, (kPrimaryTableSize - 1) << kHeapObjectTagSize); |
| 144 __ sub(scratch, Operand(name)); | 146 __ sub(scratch, Operand(name)); |
| 145 __ add(Operand(scratch), Immediate(flags)); | 147 __ add(Operand(scratch), Immediate(flags)); |
| 146 __ and_(scratch, (kSecondaryTableSize - 1) << kHeapObjectTagSize); | 148 __ and_(scratch, (kSecondaryTableSize - 1) << kHeapObjectTagSize); |
| 147 | 149 |
| 148 // Probe the secondary table. | 150 // Probe the secondary table. |
| 149 ProbeTable(masm, flags, kSecondary, name, scratch, extra); | 151 ProbeTable(isolate, masm, flags, kSecondary, name, scratch, extra); |
| 150 | 152 |
| 151 // Cache miss: Fall-through and let caller handle the miss by | 153 // Cache miss: Fall-through and let caller handle the miss by |
| 152 // entering the runtime system. | 154 // entering the runtime system. |
| 153 __ bind(&miss); | 155 __ bind(&miss); |
| 154 } | 156 } |
| 155 | 157 |
| 156 | 158 |
| 157 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 159 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
| 158 int index, | 160 int index, |
| 159 Register prototype) { | 161 Register prototype) { |
| (...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 // Return the generated code. | 2509 // Return the generated code. |
| 2508 return GetCode(); | 2510 return GetCode(); |
| 2509 } | 2511 } |
| 2510 | 2512 |
| 2511 | 2513 |
| 2512 #undef __ | 2514 #undef __ |
| 2513 | 2515 |
| 2514 } } // namespace v8::internal | 2516 } } // namespace v8::internal |
| 2515 | 2517 |
| 2516 #endif // V8_TARGET_ARCH_IA32 | 2518 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |