| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 RecordWriteStub : 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 RecordWriteStub(Isolate* isolate, Register object, Register value, |
| 55 Register the_heap_number, Register scratch) | 53 Register address, RememberedSetAction remembered_set_action, |
| 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 | |
| 62 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | |
| 63 | |
| 64 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(); | |
| 83 DEFINE_PLATFORM_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub); | |
| 84 }; | |
| 85 | |
| 86 | |
| 87 class RecordWriteStub: public PlatformCodeStub { | |
| 88 public: | |
| 89 RecordWriteStub(Isolate* isolate, | |
| 90 Register object, | |
| 91 Register value, | |
| 92 Register address, | |
| 93 RememberedSetAction remembered_set_action, | |
| 94 SaveFPRegsMode fp_mode) | 54 SaveFPRegsMode fp_mode) |
| 95 : PlatformCodeStub(isolate), | 55 : PlatformCodeStub(isolate), |
| 96 regs_(object, // An input reg. | 56 regs_(object, // An input reg. |
| 97 address, // An input reg. | 57 address, // An input reg. |
| 98 value) { // One scratch reg. | 58 value) { // One scratch reg. |
| 99 minor_key_ = ObjectBits::encode(object.code()) | | 59 minor_key_ = ObjectBits::encode(object.code()) | |
| 100 ValueBits::encode(value.code()) | | 60 ValueBits::encode(value.code()) | |
| 101 AddressBits::encode(address.code()) | | 61 AddressBits::encode(address.code()) | |
| 102 RememberedSetActionBits::encode(remembered_set_action) | | 62 RememberedSetActionBits::encode(remembered_set_action) | |
| 103 SaveFPRegsModeBits::encode(fp_mode); | 63 SaveFPRegsModeBits::encode(fp_mode); |
| 104 } | 64 } |
| 105 | 65 |
| 106 RecordWriteStub(uint32_t key, Isolate* isolate) | 66 RecordWriteStub(uint32_t key, Isolate* isolate) |
| 107 : PlatformCodeStub(key, isolate), regs_(object(), address(), value()) {} | 67 : PlatformCodeStub(key, isolate), regs_(object(), address(), value()) {} |
| 108 | 68 |
| 109 enum Mode { | 69 enum Mode { STORE_BUFFER_ONLY, INCREMENTAL, INCREMENTAL_COMPACTION }; |
| 110 STORE_BUFFER_ONLY, | |
| 111 INCREMENTAL, | |
| 112 INCREMENTAL_COMPACTION | |
| 113 }; | |
| 114 | 70 |
| 115 virtual bool SometimesSetsUpAFrame() { return false; } | 71 virtual bool SometimesSetsUpAFrame() { return false; } |
| 116 | 72 |
| 117 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) { | 73 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) { |
| 118 masm->instr_at_put(pos, (masm->instr_at(pos) & ~B27) | (B24 | B20)); | 74 masm->instr_at_put(pos, (masm->instr_at(pos) & ~kBOfieldMask) | BT); |
| 119 DCHECK(Assembler::IsTstImmediate(masm->instr_at(pos))); | 75 // roohack DCHECK(Assembler::IsTstImmediate(masm->instr_at(pos))); |
| 120 } | 76 } |
| 121 | 77 |
| 122 static void PatchNopIntoBranch(MacroAssembler* masm, int pos) { | 78 static void PatchNopIntoBranch(MacroAssembler* masm, int pos) { |
| 123 masm->instr_at_put(pos, (masm->instr_at(pos) & ~(B24 | B20)) | B27); | 79 masm->instr_at_put(pos, (masm->instr_at(pos) & ~kBOfieldMask) | BF); |
| 124 DCHECK(Assembler::IsBranch(masm->instr_at(pos))); | 80 // roohack DCHECK(Assembler::IsBranch(masm->instr_at(pos))); |
| 125 } | 81 } |
| 126 | 82 |
| 127 static Mode GetMode(Code* stub) { | 83 static Mode GetMode(Code* stub) { |
| 128 Instr first_instruction = Assembler::instr_at(stub->instruction_start()); | 84 Instr first_instruction = |
| 85 Assembler::instr_at(stub->instruction_start() + Assembler::kInstrSize); |
| 129 Instr second_instruction = Assembler::instr_at(stub->instruction_start() + | 86 Instr second_instruction = Assembler::instr_at(stub->instruction_start() + |
| 130 Assembler::kInstrSize); | 87 (Assembler::kInstrSize * 2)); |
| 131 | 88 |
| 132 if (Assembler::IsBranch(first_instruction)) { | 89 if (BF == (first_instruction & kBOfieldMask)) { |
| 133 return INCREMENTAL; | 90 return INCREMENTAL; |
| 134 } | 91 } |
| 135 | 92 |
| 136 DCHECK(Assembler::IsTstImmediate(first_instruction)); | 93 // roohack DCHECK(Assembler::IsTstImmediate(first_instruction)); |
| 137 | 94 |
| 138 if (Assembler::IsBranch(second_instruction)) { | 95 if (BF == (second_instruction & kBOfieldMask)) { |
| 139 return INCREMENTAL_COMPACTION; | 96 return INCREMENTAL_COMPACTION; |
| 140 } | 97 } |
| 141 | 98 |
| 142 DCHECK(Assembler::IsTstImmediate(second_instruction)); | 99 // roohack DCHECK(Assembler::IsTstImmediate(second_instruction)); |
| 143 | 100 |
| 144 return STORE_BUFFER_ONLY; | 101 return STORE_BUFFER_ONLY; |
| 145 } | 102 } |
| 146 | 103 |
| 147 static void Patch(Code* stub, Mode mode) { | 104 static void Patch(Code* stub, Mode mode) { |
| 148 MacroAssembler masm(NULL, | 105 MacroAssembler masm(NULL, stub->instruction_start(), |
| 149 stub->instruction_start(), | |
| 150 stub->instruction_size()); | 106 stub->instruction_size()); |
| 151 switch (mode) { | 107 switch (mode) { |
| 152 case STORE_BUFFER_ONLY: | 108 case STORE_BUFFER_ONLY: |
| 153 DCHECK(GetMode(stub) == INCREMENTAL || | 109 DCHECK(GetMode(stub) == INCREMENTAL || |
| 154 GetMode(stub) == INCREMENTAL_COMPACTION); | 110 GetMode(stub) == INCREMENTAL_COMPACTION); |
| 155 PatchBranchIntoNop(&masm, 0); | 111 |
| 156 PatchBranchIntoNop(&masm, Assembler::kInstrSize); | 112 PatchBranchIntoNop(&masm, Assembler::kInstrSize); |
| 113 PatchBranchIntoNop(&masm, Assembler::kInstrSize * 2); |
| 157 break; | 114 break; |
| 158 case INCREMENTAL: | 115 case INCREMENTAL: |
| 159 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); | 116 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); |
| 160 PatchNopIntoBranch(&masm, 0); | 117 PatchNopIntoBranch(&masm, Assembler::kInstrSize); |
| 161 break; | 118 break; |
| 162 case INCREMENTAL_COMPACTION: | 119 case INCREMENTAL_COMPACTION: |
| 163 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); | 120 DCHECK(GetMode(stub) == STORE_BUFFER_ONLY); |
| 164 PatchNopIntoBranch(&masm, Assembler::kInstrSize); | 121 PatchNopIntoBranch(&masm, Assembler::kInstrSize * 2); |
| 165 break; | 122 break; |
| 166 } | 123 } |
| 167 DCHECK(GetMode(stub) == mode); | 124 DCHECK(GetMode(stub) == mode); |
| 168 CpuFeatures::FlushICache(stub->instruction_start(), | 125 CpuFeatures::FlushICache(stub->instruction_start() + Assembler::kInstrSize, |
| 169 2 * Assembler::kInstrSize); | 126 2 * Assembler::kInstrSize); |
| 170 } | 127 } |
| 171 | 128 |
| 172 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 129 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 173 | 130 |
| 174 private: | 131 private: |
| 175 // This is a helper class for freeing up 3 scratch registers. The input is | 132 // 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 | 133 // two registers that must be preserved and one scratch register provided by |
| 177 // the caller. | 134 // the caller. |
| 178 class RegisterAllocation { | 135 class RegisterAllocation { |
| 179 public: | 136 public: |
| 180 RegisterAllocation(Register object, | 137 RegisterAllocation(Register object, Register address, Register scratch0) |
| 181 Register address, | 138 : 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)); | 139 DCHECK(!AreAliased(scratch0, object, address, no_reg)); |
| 187 scratch1_ = GetRegisterThatIsNotOneOf(object_, address_, scratch0_); | 140 scratch1_ = GetRegisterThatIsNotOneOf(object_, address_, scratch0_); |
| 188 } | 141 } |
| 189 | 142 |
| 190 void Save(MacroAssembler* masm) { | 143 void Save(MacroAssembler* masm) { |
| 191 DCHECK(!AreAliased(object_, address_, scratch1_, scratch0_)); | 144 DCHECK(!AreAliased(object_, address_, scratch1_, scratch0_)); |
| 192 // We don't have to save scratch0_ because it was given to us as | 145 // We don't have to save scratch0_ because it was given to us as |
| 193 // a scratch register. | 146 // a scratch register. |
| 194 masm->push(scratch1_); | 147 masm->push(scratch1_); |
| 195 } | 148 } |
| 196 | 149 |
| 197 void Restore(MacroAssembler* masm) { | 150 void Restore(MacroAssembler* masm) { masm->pop(scratch1_); } |
| 198 masm->pop(scratch1_); | |
| 199 } | |
| 200 | 151 |
| 201 // If we have to call into C then we need to save and restore all caller- | 152 // 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 | 153 // 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. | 154 // will be restored by other means so we don't bother pushing them here. |
| 204 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 155 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
| 205 masm->stm(db_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); | 156 masm->mflr(r0); |
| 157 masm->push(r0); |
| 158 masm->MultiPush(kJSCallerSaved & ~scratch1_.bit()); |
| 206 if (mode == kSaveFPRegs) { | 159 if (mode == kSaveFPRegs) { |
| 207 masm->SaveFPRegs(sp, scratch0_); | 160 // Save all volatile FP registers except d0. |
| 161 masm->SaveFPRegs(sp, 1, DoubleRegister::kNumVolatileRegisters - 1); |
| 208 } | 162 } |
| 209 } | 163 } |
| 210 | 164 |
| 211 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 165 inline void RestoreCallerSaveRegisters(MacroAssembler* masm, |
| 212 SaveFPRegsMode mode) { | 166 SaveFPRegsMode mode) { |
| 213 if (mode == kSaveFPRegs) { | 167 if (mode == kSaveFPRegs) { |
| 214 masm->RestoreFPRegs(sp, scratch0_); | 168 // Restore all volatile FP registers except d0. |
| 169 masm->RestoreFPRegs(sp, 1, DoubleRegister::kNumVolatileRegisters - 1); |
| 215 } | 170 } |
| 216 masm->ldm(ia_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit()); | 171 masm->MultiPop(kJSCallerSaved & ~scratch1_.bit()); |
| 172 masm->pop(r0); |
| 173 masm->mtlr(r0); |
| 217 } | 174 } |
| 218 | 175 |
| 219 inline Register object() { return object_; } | 176 inline Register object() { return object_; } |
| 220 inline Register address() { return address_; } | 177 inline Register address() { return address_; } |
| 221 inline Register scratch0() { return scratch0_; } | 178 inline Register scratch0() { return scratch0_; } |
| 222 inline Register scratch1() { return scratch1_; } | 179 inline Register scratch1() { return scratch1_; } |
| 223 | 180 |
| 224 private: | 181 private: |
| 225 Register object_; | 182 Register object_; |
| 226 Register address_; | 183 Register address_; |
| 227 Register scratch0_; | 184 Register scratch0_; |
| 228 Register scratch1_; | 185 Register scratch1_; |
| 229 | 186 |
| 230 friend class RecordWriteStub; | 187 friend class RecordWriteStub; |
| 231 }; | 188 }; |
| 232 | 189 |
| 233 enum OnNoNeedToInformIncrementalMarker { | 190 enum OnNoNeedToInformIncrementalMarker { |
| 234 kReturnOnNoNeedToInformIncrementalMarker, | 191 kReturnOnNoNeedToInformIncrementalMarker, |
| 235 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker | 192 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker |
| 236 }; | 193 }; |
| 237 | 194 |
| 238 virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; } | 195 virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; } |
| 239 | 196 |
| 240 virtual void Generate(MacroAssembler* masm) OVERRIDE; | 197 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
| 241 void GenerateIncremental(MacroAssembler* masm, Mode mode); | 198 void GenerateIncremental(MacroAssembler* masm, Mode mode); |
| 242 void CheckNeedsToInformIncrementalMarker( | 199 void CheckNeedsToInformIncrementalMarker( |
| 243 MacroAssembler* masm, | 200 MacroAssembler* masm, OnNoNeedToInformIncrementalMarker on_no_need, |
| 244 OnNoNeedToInformIncrementalMarker on_no_need, | |
| 245 Mode mode); | 201 Mode mode); |
| 246 void InformIncrementalMarker(MacroAssembler* masm); | 202 void InformIncrementalMarker(MacroAssembler* masm); |
| 247 | 203 |
| 248 void Activate(Code* code) { | 204 void Activate(Code* code) { |
| 249 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); | 205 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); |
| 250 } | 206 } |
| 251 | 207 |
| 252 Register object() const { | 208 Register object() const { |
| 253 return Register::from_code(ObjectBits::decode(minor_key_)); | 209 return Register::from_code(ObjectBits::decode(minor_key_)); |
| 254 } | 210 } |
| 255 | 211 |
| 256 Register value() const { | 212 Register value() const { |
| 257 return Register::from_code(ValueBits::decode(minor_key_)); | 213 return Register::from_code(ValueBits::decode(minor_key_)); |
| 258 } | 214 } |
| 259 | 215 |
| 260 Register address() const { | 216 Register address() const { |
| 261 return Register::from_code(AddressBits::decode(minor_key_)); | 217 return Register::from_code(AddressBits::decode(minor_key_)); |
| 262 } | 218 } |
| 263 | 219 |
| 264 RememberedSetAction remembered_set_action() const { | 220 RememberedSetAction remembered_set_action() const { |
| 265 return RememberedSetActionBits::decode(minor_key_); | 221 return RememberedSetActionBits::decode(minor_key_); |
| 266 } | 222 } |
| 267 | 223 |
| 268 SaveFPRegsMode save_fp_regs_mode() const { | 224 SaveFPRegsMode save_fp_regs_mode() const { |
| 269 return SaveFPRegsModeBits::decode(minor_key_); | 225 return SaveFPRegsModeBits::decode(minor_key_); |
| 270 } | 226 } |
| 271 | 227 |
| 272 class ObjectBits: public BitField<int, 0, 4> {}; | 228 class ObjectBits : public BitField<int, 0, 5> {}; |
| 273 class ValueBits: public BitField<int, 4, 4> {}; | 229 class ValueBits : public BitField<int, 5, 5> {}; |
| 274 class AddressBits: public BitField<int, 8, 4> {}; | 230 class AddressBits : public BitField<int, 10, 5> {}; |
| 275 class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {}; | 231 class RememberedSetActionBits : public BitField<RememberedSetAction, 15, 1> { |
| 276 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {}; | 232 }; |
| 233 class SaveFPRegsModeBits : public BitField<SaveFPRegsMode, 16, 1> {}; |
| 277 | 234 |
| 278 Label slow_; | 235 Label slow_; |
| 279 RegisterAllocation regs_; | 236 RegisterAllocation regs_; |
| 280 | 237 |
| 281 DISALLOW_COPY_AND_ASSIGN(RecordWriteStub); | 238 DISALLOW_COPY_AND_ASSIGN(RecordWriteStub); |
| 282 }; | 239 }; |
| 283 | 240 |
| 284 | 241 |
| 285 // Trampoline stub to call into native code. To call safely into native code | 242 // 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 | 243 // 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 | 244 // 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 | 245 // simplest approach is to generate such stub early enough so it can never be |
| 289 // moved by GC | 246 // moved by GC |
| 290 class DirectCEntryStub: public PlatformCodeStub { | 247 class DirectCEntryStub : public PlatformCodeStub { |
| 291 public: | 248 public: |
| 292 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 249 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 293 void GenerateCall(MacroAssembler* masm, Register target); | 250 void GenerateCall(MacroAssembler* masm, Register target); |
| 294 | 251 |
| 295 private: | 252 private: |
| 296 bool NeedsImmovableCode() { return true; } | 253 bool NeedsImmovableCode() { return true; } |
| 297 | 254 |
| 298 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 255 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 299 DEFINE_PLATFORM_CODE_STUB(DirectCEntry, PlatformCodeStub); | 256 DEFINE_PLATFORM_CODE_STUB(DirectCEntry, PlatformCodeStub); |
| 300 }; | 257 }; |
| 301 | 258 |
| 302 | 259 |
| 303 class NameDictionaryLookupStub: public PlatformCodeStub { | 260 class NameDictionaryLookupStub : public PlatformCodeStub { |
| 304 public: | 261 public: |
| 305 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; | 262 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
| 306 | 263 |
| 307 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) | 264 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) |
| 308 : PlatformCodeStub(isolate) { | 265 : PlatformCodeStub(isolate) { |
| 309 minor_key_ = LookupModeBits::encode(mode); | 266 minor_key_ = LookupModeBits::encode(mode); |
| 310 } | 267 } |
| 311 | 268 |
| 312 static void GenerateNegativeLookup(MacroAssembler* masm, | 269 static void GenerateNegativeLookup(MacroAssembler* masm, Label* miss, |
| 313 Label* miss, | 270 Label* done, Register receiver, |
| 314 Label* done, | 271 Register properties, Handle<Name> name, |
| 315 Register receiver, | |
| 316 Register properties, | |
| 317 Handle<Name> name, | |
| 318 Register scratch0); | 272 Register scratch0); |
| 319 | 273 |
| 320 static void GeneratePositiveLookup(MacroAssembler* masm, | 274 static void GeneratePositiveLookup(MacroAssembler* masm, Label* miss, |
| 321 Label* miss, | 275 Label* done, Register elements, |
| 322 Label* done, | 276 Register name, Register r0, Register r1); |
| 323 Register elements, | |
| 324 Register name, | |
| 325 Register r0, | |
| 326 Register r1); | |
| 327 | 277 |
| 328 virtual bool SometimesSetsUpAFrame() { return false; } | 278 virtual bool SometimesSetsUpAFrame() { return false; } |
| 329 | 279 |
| 330 private: | 280 private: |
| 331 static const int kInlinedProbes = 4; | 281 static const int kInlinedProbes = 4; |
| 332 static const int kTotalProbes = 20; | 282 static const int kTotalProbes = 20; |
| 333 | 283 |
| 334 static const int kCapacityOffset = | 284 static const int kCapacityOffset = |
| 335 NameDictionary::kHeaderSize + | 285 NameDictionary::kHeaderSize + |
| 336 NameDictionary::kCapacityIndex * kPointerSize; | 286 NameDictionary::kCapacityIndex * kPointerSize; |
| 337 | 287 |
| 338 static const int kElementsStartOffset = | 288 static const int kElementsStartOffset = |
| 339 NameDictionary::kHeaderSize + | 289 NameDictionary::kHeaderSize + |
| 340 NameDictionary::kElementsStartIndex * kPointerSize; | 290 NameDictionary::kElementsStartIndex * kPointerSize; |
| 341 | 291 |
| 342 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } | 292 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } |
| 343 | 293 |
| 344 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 294 class LookupModeBits : public BitField<LookupMode, 0, 1> {}; |
| 345 | 295 |
| 346 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 296 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 347 DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub); | 297 DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub); |
| 348 }; | 298 }; |
| 299 } |
| 300 } // namespace v8::internal |
| 349 | 301 |
| 350 } } // namespace v8::internal | 302 #endif // V8_PPC_CODE_STUBS_PPC_H_ |
| 351 | |
| 352 #endif // V8_ARM_CODE_STUBS_ARM_H_ | |
| OLD | NEW |