OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ARM_CODE_STUBS_ARM_H_ | 5 #ifndef V8_PPC_CODE_STUBS_PPC_H_ |
6 #define V8_ARM_CODE_STUBS_ARM_H_ | 6 #define V8_PPC_CODE_STUBS_PPC_H_ |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
11 | 11 |
12 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); | 12 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); |
13 | 13 |
14 | 14 |
15 class StringHelper : public AllStatic { | 15 class StringHelper : public AllStatic { |
16 public: | 16 public: |
17 // Generate code for copying a large number of characters. This function | 17 // Generate code for copying a large number of characters. This function |
18 // is allowed to spend extra time setting up conditions to make copying | 18 // is allowed to spend extra time setting up conditions to make copying |
19 // faster. Copying of overlapping regions is not supported. | 19 // faster. Copying of overlapping regions is not supported. |
20 // Dest register ends at the position after the last character written. | 20 // Dest register ends at the position after the last character written. |
21 static void GenerateCopyCharacters(MacroAssembler* masm, | 21 static void GenerateCopyCharacters(MacroAssembler* masm, Register dest, |
22 Register dest, | 22 Register src, Register count, |
23 Register src, | |
24 Register count, | |
25 Register scratch, | 23 Register scratch, |
26 String::Encoding encoding); | 24 String::Encoding encoding); |
27 | 25 |
28 // Compares two flat one-byte strings and returns result in r0. | 26 // Compares two flat one-byte strings and returns result in r0. |
29 static void GenerateCompareFlatOneByteStrings( | 27 static void GenerateCompareFlatOneByteStrings(MacroAssembler* masm, |
30 MacroAssembler* masm, Register left, Register right, Register scratch1, | 28 Register left, Register right, |
31 Register scratch2, Register scratch3, Register scratch4); | 29 Register scratch1, |
| 30 Register scratch2, |
| 31 Register scratch3); |
32 | 32 |
33 // Compares two flat one-byte strings for equality and returns result in r0. | 33 // Compares two flat one-byte strings for equality and returns result in r0. |
34 static void GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 34 static void GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
35 Register left, Register right, | 35 Register left, Register right, |
36 Register scratch1, | 36 Register scratch1, |
37 Register scratch2, | 37 Register scratch2); |
38 Register scratch3); | |
39 | 38 |
40 private: | 39 private: |
41 static void GenerateOneByteCharsCompareLoop( | 40 static void GenerateOneByteCharsCompareLoop(MacroAssembler* masm, |
42 MacroAssembler* masm, Register left, Register right, Register length, | 41 Register left, Register right, |
43 Register scratch1, Register scratch2, Label* chars_not_equal); | 42 Register length, |
| 43 Register scratch1, |
| 44 Label* chars_not_equal); |
44 | 45 |
45 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | 46 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
46 }; | 47 }; |
47 | 48 |
48 | 49 |
49 // This stub can convert a signed int32 to a heap number (double). It does | 50 class StoreRegistersStateStub : public PlatformCodeStub { |
50 // not work for int32s that are in Smi range! No GC occurs during this stub | |
51 // so you don't have to set up the frame. | |
52 class WriteInt32ToHeapNumberStub : public PlatformCodeStub { | |
53 public: | 51 public: |
54 WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int, | 52 explicit StoreRegistersStateStub(Isolate* isolate) |
55 Register the_heap_number, Register scratch) | 53 : PlatformCodeStub(isolate) {} |
56 : PlatformCodeStub(isolate) { | |
57 minor_key_ = IntRegisterBits::encode(the_int.code()) | | |
58 HeapNumberRegisterBits::encode(the_heap_number.code()) | | |
59 ScratchRegisterBits::encode(scratch.code()); | |
60 } | |
61 | 54 |
62 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | 55 static void GenerateAheadOfTime(Isolate* isolate); |
63 | 56 |
64 private: | 57 private: |
65 Register the_int() const { | |
66 return Register::from_code(IntRegisterBits::decode(minor_key_)); | |
67 } | |
68 | |
69 Register the_heap_number() const { | |
70 return Register::from_code(HeapNumberRegisterBits::decode(minor_key_)); | |
71 } | |
72 | |
73 Register scratch() const { | |
74 return Register::from_code(ScratchRegisterBits::decode(minor_key_)); | |
75 } | |
76 | |
77 // Minor key encoding in 16 bits. | |
78 class IntRegisterBits: public BitField<int, 0, 4> {}; | |
79 class HeapNumberRegisterBits: public BitField<int, 4, 4> {}; | |
80 class ScratchRegisterBits: public BitField<int, 8, 4> {}; | |
81 | |
82 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 58 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
83 DEFINE_PLATFORM_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub); | 59 DEFINE_PLATFORM_CODE_STUB(StoreRegistersState, PlatformCodeStub); |
84 }; | 60 }; |
85 | 61 |
86 | 62 |
87 class RecordWriteStub: public PlatformCodeStub { | 63 class RestoreRegistersStateStub : public PlatformCodeStub { |
88 public: | 64 public: |
89 RecordWriteStub(Isolate* isolate, | 65 explicit RestoreRegistersStateStub(Isolate* isolate) |
90 Register object, | 66 : PlatformCodeStub(isolate) {} |
91 Register value, | 67 |
92 Register address, | 68 static void GenerateAheadOfTime(Isolate* isolate); |
93 RememberedSetAction remembered_set_action, | 69 |
| 70 private: |
| 71 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 72 DEFINE_PLATFORM_CODE_STUB(RestoreRegistersState, PlatformCodeStub); |
| 73 }; |
| 74 |
| 75 |
| 76 class RecordWriteStub : public PlatformCodeStub { |
| 77 public: |
| 78 RecordWriteStub(Isolate* isolate, Register object, Register value, |
| 79 Register address, RememberedSetAction remembered_set_action, |
94 SaveFPRegsMode fp_mode) | 80 SaveFPRegsMode fp_mode) |
95 : PlatformCodeStub(isolate), | 81 : PlatformCodeStub(isolate), |
96 regs_(object, // An input reg. | 82 regs_(object, // An input reg. |
97 address, // An input reg. | 83 address, // An input reg. |
98 value) { // One scratch reg. | 84 value) { // One scratch reg. |
99 minor_key_ = ObjectBits::encode(object.code()) | | 85 minor_key_ = ObjectBits::encode(object.code()) | |
100 ValueBits::encode(value.code()) | | 86 ValueBits::encode(value.code()) | |
101 AddressBits::encode(address.code()) | | 87 AddressBits::encode(address.code()) | |
102 RememberedSetActionBits::encode(remembered_set_action) | | 88 RememberedSetActionBits::encode(remembered_set_action) | |
103 SaveFPRegsModeBits::encode(fp_mode); | 89 SaveFPRegsModeBits::encode(fp_mode); |
104 } | 90 } |
105 | 91 |
106 RecordWriteStub(uint32_t key, Isolate* isolate) | 92 RecordWriteStub(uint32_t key, Isolate* isolate) |
107 : PlatformCodeStub(key, isolate), regs_(object(), address(), value()) {} | 93 : PlatformCodeStub(key, isolate), regs_(object(), address(), value()) {} |
108 | 94 |
109 enum Mode { | 95 enum Mode { STORE_BUFFER_ONLY, INCREMENTAL, INCREMENTAL_COMPACTION }; |
110 STORE_BUFFER_ONLY, | |
111 INCREMENTAL, | |
112 INCREMENTAL_COMPACTION | |
113 }; | |
114 | 96 |
115 virtual bool SometimesSetsUpAFrame() { return false; } | 97 virtual bool SometimesSetsUpAFrame() { return false; } |
116 | 98 |
117 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) { | 99 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) { |
118 masm->instr_at_put(pos, (masm->instr_at(pos) & ~B27) | (B24 | B20)); | 100 // Consider adding DCHECK here to catch bad patching |
119 DCHECK(Assembler::IsTstImmediate(masm->instr_at(pos))); | 101 masm->instr_at_put(pos, (masm->instr_at(pos) & ~kBOfieldMask) | BT); |
120 } | 102 } |
121 | 103 |
122 static void PatchNopIntoBranch(MacroAssembler* masm, int pos) { | 104 static void PatchNopIntoBranch(MacroAssembler* masm, int pos) { |
123 masm->instr_at_put(pos, (masm->instr_at(pos) & ~(B24 | B20)) | B27); | 105 // Consider adding DCHECK here to catch bad patching |
124 DCHECK(Assembler::IsBranch(masm->instr_at(pos))); | 106 masm->instr_at_put(pos, (masm->instr_at(pos) & ~kBOfieldMask) | BF); |
125 } | 107 } |
126 | 108 |
127 static Mode GetMode(Code* stub) { | 109 static Mode GetMode(Code* stub) { |
128 Instr first_instruction = Assembler::instr_at(stub->instruction_start()); | 110 Instr first_instruction = |
| 111 Assembler::instr_at(stub->instruction_start() + Assembler::kInstrSize); |
129 Instr second_instruction = Assembler::instr_at(stub->instruction_start() + | 112 Instr second_instruction = Assembler::instr_at(stub->instruction_start() + |
130 Assembler::kInstrSize); | 113 (Assembler::kInstrSize * 2)); |
131 | 114 |
132 if (Assembler::IsBranch(first_instruction)) { | 115 // Consider adding DCHECK here to catch unexpected instruction sequence |
| 116 if (BF == (first_instruction & kBOfieldMask)) { |
133 return INCREMENTAL; | 117 return INCREMENTAL; |
134 } | 118 } |
135 | 119 |
136 DCHECK(Assembler::IsTstImmediate(first_instruction)); | 120 if (BF == (second_instruction & kBOfieldMask)) { |
137 | |
138 if (Assembler::IsBranch(second_instruction)) { | |
139 return INCREMENTAL_COMPACTION; | 121 return INCREMENTAL_COMPACTION; |
140 } | 122 } |
141 | 123 |
142 DCHECK(Assembler::IsTstImmediate(second_instruction)); | |
143 | |
144 return STORE_BUFFER_ONLY; | 124 return STORE_BUFFER_ONLY; |
145 } | 125 } |
146 | 126 |
147 static void Patch(Code* stub, Mode mode) { | 127 static void Patch(Code* stub, Mode mode) { |
148 MacroAssembler masm(NULL, | 128 MacroAssembler masm(NULL, stub->instruction_start(), |
149 stub->instruction_start(), | |
150 stub->instruction_size()); | 129 stub->instruction_size()); |
151 switch (mode) { | 130 switch (mode) { |
152 case STORE_BUFFER_ONLY: | 131 case STORE_BUFFER_ONLY: |
153 DCHECK(GetMode(stub) == INCREMENTAL || | 132 DCHECK(GetMode(stub) == INCREMENTAL || |
154 GetMode(stub) == INCREMENTAL_COMPACTION); | 133 GetMode(stub) == INCREMENTAL_COMPACTION); |
155 PatchBranchIntoNop(&masm, 0); | 134 |
156 PatchBranchIntoNop(&masm, Assembler::kInstrSize); | 135 PatchBranchIntoNop(&masm, Assembler::kInstrSize); |
| 136 PatchBranchIntoNop(&masm, Assembler::kInstrSize * 2); |
157 break; | 137 break; |
158 case INCREMENTAL: | 138 case INCREMENTAL: |
159 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); | 139 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); |
160 PatchNopIntoBranch(&masm, 0); | 140 PatchNopIntoBranch(&masm, Assembler::kInstrSize); |
161 break; | 141 break; |
162 case INCREMENTAL_COMPACTION: | 142 case INCREMENTAL_COMPACTION: |
163 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); | 143 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); |
164 PatchNopIntoBranch(&masm, Assembler::kInstrSize); | 144 PatchNopIntoBranch(&masm, Assembler::kInstrSize * 2); |
165 break; | 145 break; |
166 } | 146 } |
167 DCHECK(GetMode(stub) == mode); | 147 DCHECK(GetMode(stub) == mode); |
168 CpuFeatures::FlushICache(stub->instruction_start(), | 148 CpuFeatures::FlushICache(stub->instruction_start() + Assembler::kInstrSize, |
169 2 * Assembler::kInstrSize); | 149 2 * Assembler::kInstrSize); |
170 } | 150 } |
171 | 151 |
172 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 152 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
173 | 153 |
174 private: | 154 private: |
175 // This is a helper class for freeing up 3 scratch registers. The input is | 155 // This is a helper class for freeing up 3 scratch registers. The input is |
176 // two registers that must be preserved and one scratch register provided by | 156 // two registers that must be preserved and one scratch register provided by |
177 // the caller. | 157 // the caller. |
178 class RegisterAllocation { | 158 class RegisterAllocation { |
179 public: | 159 public: |
180 RegisterAllocation(Register object, | 160 RegisterAllocation(Register object, Register address, Register scratch0) |
181 Register address, | 161 : object_(object), address_(address), scratch0_(scratch0) { |
182 Register scratch0) | |
183 : object_(object), | |
184 address_(address), | |
185 scratch0_(scratch0) { | |
186 DCHECK(!AreAliased(scratch0, object, address, no_reg)); | 162 DCHECK(!AreAliased(scratch0, object, address, no_reg)); |
187 scratch1_ = GetRegisterThatIsNotOneOf(object_, address_, scratch0_); | 163 scratch1_ = GetRegisterThatIsNotOneOf(object_, address_, scratch0_); |
188 } | 164 } |
189 | 165 |
190 void Save(MacroAssembler* masm) { | 166 void Save(MacroAssembler* masm) { |
191 DCHECK(!AreAliased(object_, address_, scratch1_, scratch0_)); | 167 DCHECK(!AreAliased(object_, address_, scratch1_, scratch0_)); |
192 // We don't have to save scratch0_ because it was given to us as | 168 // We don't have to save scratch0_ because it was given to us as |
193 // a scratch register. | 169 // a scratch register. |
194 masm->push(scratch1_); | 170 masm->push(scratch1_); |
195 } | 171 } |
196 | 172 |
197 void Restore(MacroAssembler* masm) { | 173 void Restore(MacroAssembler* masm) { masm->pop(scratch1_); } |
198 masm->pop(scratch1_); | |
199 } | |
200 | 174 |
201 // If we have to call into C then we need to save and restore all caller- | 175 // If we have to call into C then we need to save and restore all caller- |
202 // saved registers that were not already preserved. The scratch registers | 176 // saved registers that were not already preserved. The scratch registers |
203 // will be restored by other means so we don't bother pushing them here. | 177 // will be restored by other means so we don't bother pushing them here. |
204 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 178 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
205 masm->stm(db_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); | 179 masm->mflr(r0); |
| 180 masm->push(r0); |
| 181 masm->MultiPush(kJSCallerSaved & ~scratch1_.bit()); |
206 if (mode == kSaveFPRegs) { | 182 if (mode == kSaveFPRegs) { |
207 masm->SaveFPRegs(sp, scratch0_); | 183 // Save all volatile FP registers except d0. |
| 184 masm->SaveFPRegs(sp, 1, DoubleRegister::kNumVolatileRegisters - 1); |
208 } | 185 } |
209 } | 186 } |
210 | 187 |
211 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 188 inline void RestoreCallerSaveRegisters(MacroAssembler* masm, |
212 SaveFPRegsMode mode) { | 189 SaveFPRegsMode mode) { |
213 if (mode == kSaveFPRegs) { | 190 if (mode == kSaveFPRegs) { |
214 masm->RestoreFPRegs(sp, scratch0_); | 191 // Restore all volatile FP registers except d0. |
| 192 masm->RestoreFPRegs(sp, 1, DoubleRegister::kNumVolatileRegisters - 1); |
215 } | 193 } |
216 masm->ldm(ia_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); | 194 masm->MultiPop(kJSCallerSaved & ~scratch1_.bit()); |
| 195 masm->pop(r0); |
| 196 masm->mtlr(r0); |
217 } | 197 } |
218 | 198 |
219 inline Register object() { return object_; } | 199 inline Register object() { return object_; } |
220 inline Register address() { return address_; } | 200 inline Register address() { return address_; } |
221 inline Register scratch0() { return scratch0_; } | 201 inline Register scratch0() { return scratch0_; } |
222 inline Register scratch1() { return scratch1_; } | 202 inline Register scratch1() { return scratch1_; } |
223 | 203 |
224 private: | 204 private: |
225 Register object_; | 205 Register object_; |
226 Register address_; | 206 Register address_; |
227 Register scratch0_; | 207 Register scratch0_; |
228 Register scratch1_; | 208 Register scratch1_; |
229 | 209 |
230 friend class RecordWriteStub; | 210 friend class RecordWriteStub; |
231 }; | 211 }; |
232 | 212 |
233 enum OnNoNeedToInformIncrementalMarker { | 213 enum OnNoNeedToInformIncrementalMarker { |
234 kReturnOnNoNeedToInformIncrementalMarker, | 214 kReturnOnNoNeedToInformIncrementalMarker, |
235 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker | 215 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker |
236 }; | 216 }; |
237 | 217 |
238 virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; } | 218 virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; } |
239 | 219 |
240 virtual void Generate(MacroAssembler* masm) OVERRIDE; | 220 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
241 void GenerateIncremental(MacroAssembler* masm, Mode mode); | 221 void GenerateIncremental(MacroAssembler* masm, Mode mode); |
242 void CheckNeedsToInformIncrementalMarker( | 222 void CheckNeedsToInformIncrementalMarker( |
243 MacroAssembler* masm, | 223 MacroAssembler* masm, OnNoNeedToInformIncrementalMarker on_no_need, |
244 OnNoNeedToInformIncrementalMarker on_no_need, | |
245 Mode mode); | 224 Mode mode); |
246 void InformIncrementalMarker(MacroAssembler* masm); | 225 void InformIncrementalMarker(MacroAssembler* masm); |
247 | 226 |
248 void Activate(Code* code) { | 227 void Activate(Code* code) { |
249 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); | 228 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); |
250 } | 229 } |
251 | 230 |
252 Register object() const { | 231 Register object() const { |
253 return Register::from_code(ObjectBits::decode(minor_key_)); | 232 return Register::from_code(ObjectBits::decode(minor_key_)); |
254 } | 233 } |
255 | 234 |
256 Register value() const { | 235 Register value() const { |
257 return Register::from_code(ValueBits::decode(minor_key_)); | 236 return Register::from_code(ValueBits::decode(minor_key_)); |
258 } | 237 } |
259 | 238 |
260 Register address() const { | 239 Register address() const { |
261 return Register::from_code(AddressBits::decode(minor_key_)); | 240 return Register::from_code(AddressBits::decode(minor_key_)); |
262 } | 241 } |
263 | 242 |
264 RememberedSetAction remembered_set_action() const { | 243 RememberedSetAction remembered_set_action() const { |
265 return RememberedSetActionBits::decode(minor_key_); | 244 return RememberedSetActionBits::decode(minor_key_); |
266 } | 245 } |
267 | 246 |
268 SaveFPRegsMode save_fp_regs_mode() const { | 247 SaveFPRegsMode save_fp_regs_mode() const { |
269 return SaveFPRegsModeBits::decode(minor_key_); | 248 return SaveFPRegsModeBits::decode(minor_key_); |
270 } | 249 } |
271 | 250 |
272 class ObjectBits: public BitField<int, 0, 4> {}; | 251 class ObjectBits : public BitField<int, 0, 5> {}; |
273 class ValueBits: public BitField<int, 4, 4> {}; | 252 class ValueBits : public BitField<int, 5, 5> {}; |
274 class AddressBits: public BitField<int, 8, 4> {}; | 253 class AddressBits : public BitField<int, 10, 5> {}; |
275 class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {}; | 254 class RememberedSetActionBits : public BitField<RememberedSetAction, 15, 1> { |
276 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {}; | 255 }; |
| 256 class SaveFPRegsModeBits : public BitField<SaveFPRegsMode, 16, 1> {}; |
277 | 257 |
278 Label slow_; | 258 Label slow_; |
279 RegisterAllocation regs_; | 259 RegisterAllocation regs_; |
280 | 260 |
281 DISALLOW_COPY_AND_ASSIGN(RecordWriteStub); | 261 DISALLOW_COPY_AND_ASSIGN(RecordWriteStub); |
282 }; | 262 }; |
283 | 263 |
284 | 264 |
285 // Trampoline stub to call into native code. To call safely into native code | 265 // Trampoline stub to call into native code. To call safely into native code |
286 // in the presence of compacting GC (which can move code objects) we need to | 266 // in the presence of compacting GC (which can move code objects) we need to |
287 // keep the code which called into native pinned in the memory. Currently the | 267 // keep the code which called into native pinned in the memory. Currently the |
288 // simplest approach is to generate such stub early enough so it can never be | 268 // simplest approach is to generate such stub early enough so it can never be |
289 // moved by GC | 269 // moved by GC |
290 class DirectCEntryStub: public PlatformCodeStub { | 270 class DirectCEntryStub : public PlatformCodeStub { |
291 public: | 271 public: |
292 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 272 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
293 void GenerateCall(MacroAssembler* masm, Register target); | 273 void GenerateCall(MacroAssembler* masm, Register target); |
294 | 274 |
295 private: | 275 private: |
296 bool NeedsImmovableCode() { return true; } | 276 bool NeedsImmovableCode() { return true; } |
297 | 277 |
298 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 278 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
299 DEFINE_PLATFORM_CODE_STUB(DirectCEntry, PlatformCodeStub); | 279 DEFINE_PLATFORM_CODE_STUB(DirectCEntry, PlatformCodeStub); |
300 }; | 280 }; |
301 | 281 |
302 | 282 |
303 class NameDictionaryLookupStub: public PlatformCodeStub { | 283 class NameDictionaryLookupStub : public PlatformCodeStub { |
304 public: | 284 public: |
305 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; | 285 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
306 | 286 |
307 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) | 287 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) |
308 : PlatformCodeStub(isolate) { | 288 : PlatformCodeStub(isolate) { |
309 minor_key_ = LookupModeBits::encode(mode); | 289 minor_key_ = LookupModeBits::encode(mode); |
310 } | 290 } |
311 | 291 |
312 static void GenerateNegativeLookup(MacroAssembler* masm, | 292 static void GenerateNegativeLookup(MacroAssembler* masm, Label* miss, |
313 Label* miss, | 293 Label* done, Register receiver, |
314 Label* done, | 294 Register properties, Handle<Name> name, |
315 Register receiver, | |
316 Register properties, | |
317 Handle<Name> name, | |
318 Register scratch0); | 295 Register scratch0); |
319 | 296 |
320 static void GeneratePositiveLookup(MacroAssembler* masm, | 297 static void GeneratePositiveLookup(MacroAssembler* masm, Label* miss, |
321 Label* miss, | 298 Label* done, Register elements, |
322 Label* done, | 299 Register name, Register r0, Register r1); |
323 Register elements, | |
324 Register name, | |
325 Register r0, | |
326 Register r1); | |
327 | 300 |
328 virtual bool SometimesSetsUpAFrame() { return false; } | 301 virtual bool SometimesSetsUpAFrame() { return false; } |
329 | 302 |
330 private: | 303 private: |
331 static const int kInlinedProbes = 4; | 304 static const int kInlinedProbes = 4; |
332 static const int kTotalProbes = 20; | 305 static const int kTotalProbes = 20; |
333 | 306 |
334 static const int kCapacityOffset = | 307 static const int kCapacityOffset = |
335 NameDictionary::kHeaderSize + | 308 NameDictionary::kHeaderSize + |
336 NameDictionary::kCapacityIndex * kPointerSize; | 309 NameDictionary::kCapacityIndex * kPointerSize; |
337 | 310 |
338 static const int kElementsStartOffset = | 311 static const int kElementsStartOffset = |
339 NameDictionary::kHeaderSize + | 312 NameDictionary::kHeaderSize + |
340 NameDictionary::kElementsStartIndex * kPointerSize; | 313 NameDictionary::kElementsStartIndex * kPointerSize; |
341 | 314 |
342 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } | 315 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } |
343 | 316 |
344 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 317 class LookupModeBits : public BitField<LookupMode, 0, 1> {}; |
345 | 318 |
346 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 319 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
347 DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub); | 320 DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub); |
348 }; | 321 }; |
| 322 } |
| 323 } // namespace v8::internal |
349 | 324 |
350 } } // namespace v8::internal | 325 #endif // V8_PPC_CODE_STUBS_PPC_H_ |
351 | |
352 #endif // V8_ARM_CODE_STUBS_ARM_H_ | |
OLD | NEW |