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