Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Side by Side Diff: src/mips/code-stubs-mips.h

Issue 535373003: MIPS: Introduce code stub constructors for stub keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips64/code-stubs-mips64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_MIPS_CODE_STUBS_ARM_H_ 5 #ifndef V8_MIPS_CODE_STUBS_ARM_H_
6 #define V8_MIPS_CODE_STUBS_ARM_H_ 6 #define V8_MIPS_CODE_STUBS_ARM_H_
7 7
8 #include "src/code-stubs.h"
9
10
11 namespace v8 { 8 namespace v8 {
12 namespace internal { 9 namespace internal {
13 10
14 11
15 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); 12 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
16 13
17 14
18 class StringHelper : public AllStatic { 15 class StringHelper : public AllStatic {
19 public: 16 public:
20 // Generate code for copying a large number of characters. This function 17 // Generate code for copying a large number of characters. This function
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); 55 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
59 }; 56 };
60 57
61 58
62 class StoreRegistersStateStub: public PlatformCodeStub { 59 class StoreRegistersStateStub: public PlatformCodeStub {
63 public: 60 public:
64 explicit StoreRegistersStateStub(Isolate* isolate) 61 explicit StoreRegistersStateStub(Isolate* isolate)
65 : PlatformCodeStub(isolate) {} 62 : PlatformCodeStub(isolate) {}
66 63
67 static void GenerateAheadOfTime(Isolate* isolate); 64 static void GenerateAheadOfTime(Isolate* isolate);
65
68 private: 66 private:
69 virtual inline Major MajorKey() const FINAL OVERRIDE; 67 void Generate(MacroAssembler* masm);
70 uint32_t MinorKey() const { return 0; }
71 68
72 void Generate(MacroAssembler* masm); 69 DEFINE_CODE_STUB(StoreRegistersState, PlatformCodeStub);
73 }; 70 };
74 71
72
75 class RestoreRegistersStateStub: public PlatformCodeStub { 73 class RestoreRegistersStateStub: public PlatformCodeStub {
76 public: 74 public:
77 explicit RestoreRegistersStateStub(Isolate* isolate) 75 explicit RestoreRegistersStateStub(Isolate* isolate)
78 : PlatformCodeStub(isolate) {} 76 : PlatformCodeStub(isolate) {}
79 77
80 static void GenerateAheadOfTime(Isolate* isolate); 78 static void GenerateAheadOfTime(Isolate* isolate);
79
81 private: 80 private:
82 virtual inline Major MajorKey() const FINAL OVERRIDE; 81 void Generate(MacroAssembler* masm);
83 uint32_t MinorKey() const { return 0; }
84 82
85 void Generate(MacroAssembler* masm); 83 DEFINE_CODE_STUB(RestoreRegistersState, PlatformCodeStub);
86 }; 84 };
87 85
88 86
89 // This stub can convert a signed int32 to a heap number (double). It does 87 // This stub can convert a signed int32 to a heap number (double). It does
90 // not work for int32s that are in Smi range! No GC occurs during this stub 88 // not work for int32s that are in Smi range! No GC occurs during this stub
91 // so you don't have to set up the frame. 89 // so you don't have to set up the frame.
92 class WriteInt32ToHeapNumberStub : public PlatformCodeStub { 90 class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
93 public: 91 public:
94 WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int, 92 WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int,
95 Register the_heap_number, Register scratch, 93 Register the_heap_number, Register scratch,
96 Register scratch2) 94 Register scratch2)
97 : PlatformCodeStub(isolate) { 95 : PlatformCodeStub(isolate) {
98 minor_key_ = IntRegisterBits::encode(the_int.code()) | 96 minor_key_ = IntRegisterBits::encode(the_int.code()) |
99 HeapNumberRegisterBits::encode(the_heap_number.code()) | 97 HeapNumberRegisterBits::encode(the_heap_number.code()) |
100 ScratchRegisterBits::encode(scratch.code()) | 98 ScratchRegisterBits::encode(scratch.code()) |
101 SignRegisterBits::encode(scratch2.code()); 99 SignRegisterBits::encode(scratch2.code());
102 DCHECK(IntRegisterBits::is_valid(the_int.code())); 100 DCHECK(IntRegisterBits::is_valid(the_int.code()));
103 DCHECK(HeapNumberRegisterBits::is_valid(the_heap_number.code())); 101 DCHECK(HeapNumberRegisterBits::is_valid(the_heap_number.code()));
104 DCHECK(ScratchRegisterBits::is_valid(scratch.code())); 102 DCHECK(ScratchRegisterBits::is_valid(scratch.code()));
105 DCHECK(SignRegisterBits::is_valid(scratch2.code())); 103 DCHECK(SignRegisterBits::is_valid(scratch2.code()));
106 } 104 }
107 105
108 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); 106 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
109 107
110 private: 108 private:
111 virtual inline Major MajorKey() const FINAL OVERRIDE;
112
113 void Generate(MacroAssembler* masm); 109 void Generate(MacroAssembler* masm);
114 110
115 Register the_int() const { 111 Register the_int() const {
116 return Register::from_code(IntRegisterBits::decode(minor_key_)); 112 return Register::from_code(IntRegisterBits::decode(minor_key_));
117 } 113 }
118 114
119 Register the_heap_number() const { 115 Register the_heap_number() const {
120 return Register::from_code(HeapNumberRegisterBits::decode(minor_key_)); 116 return Register::from_code(HeapNumberRegisterBits::decode(minor_key_));
121 } 117 }
122 118
123 Register scratch() const { 119 Register scratch() const {
124 return Register::from_code(ScratchRegisterBits::decode(minor_key_)); 120 return Register::from_code(ScratchRegisterBits::decode(minor_key_));
125 } 121 }
126 122
127 Register sign() const { 123 Register sign() const {
128 return Register::from_code(SignRegisterBits::decode(minor_key_)); 124 return Register::from_code(SignRegisterBits::decode(minor_key_));
129 } 125 }
130 126
131 // Minor key encoding in 16 bits. 127 // Minor key encoding in 16 bits.
132 class IntRegisterBits: public BitField<int, 0, 4> {}; 128 class IntRegisterBits: public BitField<int, 0, 4> {};
133 class HeapNumberRegisterBits: public BitField<int, 4, 4> {}; 129 class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
134 class ScratchRegisterBits: public BitField<int, 8, 4> {}; 130 class ScratchRegisterBits: public BitField<int, 8, 4> {};
135 class SignRegisterBits: public BitField<int, 12, 4> {}; 131 class SignRegisterBits: public BitField<int, 12, 4> {};
136 132
137 DISALLOW_COPY_AND_ASSIGN(WriteInt32ToHeapNumberStub); 133 DEFINE_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub);
138 }; 134 };
139 135
140 136
141 class RecordWriteStub: public PlatformCodeStub { 137 class RecordWriteStub: public PlatformCodeStub {
142 public: 138 public:
143 RecordWriteStub(Isolate* isolate, 139 RecordWriteStub(Isolate* isolate,
144 Register object, 140 Register object,
145 Register value, 141 Register value,
146 Register address, 142 Register address,
147 RememberedSetAction remembered_set_action, 143 RememberedSetAction remembered_set_action,
148 SaveFPRegsMode fp_mode) 144 SaveFPRegsMode fp_mode)
149 : PlatformCodeStub(isolate), 145 : PlatformCodeStub(isolate),
150 regs_(object, // An input reg. 146 regs_(object, // An input reg.
151 address, // An input reg. 147 address, // An input reg.
152 value) { // One scratch reg. 148 value) { // One scratch reg.
153 minor_key_ = ObjectBits::encode(object.code()) | 149 minor_key_ = ObjectBits::encode(object.code()) |
154 ValueBits::encode(value.code()) | 150 ValueBits::encode(value.code()) |
155 AddressBits::encode(address.code()) | 151 AddressBits::encode(address.code()) |
156 RememberedSetActionBits::encode(remembered_set_action) | 152 RememberedSetActionBits::encode(remembered_set_action) |
157 SaveFPRegsModeBits::encode(fp_mode); 153 SaveFPRegsModeBits::encode(fp_mode);
158 } 154 }
159 155
156 RecordWriteStub(uint32_t key, Isolate* isolate)
157 : PlatformCodeStub(key, isolate), regs_(object(), address(), value()) {}
158
160 enum Mode { 159 enum Mode {
161 STORE_BUFFER_ONLY, 160 STORE_BUFFER_ONLY,
162 INCREMENTAL, 161 INCREMENTAL,
163 INCREMENTAL_COMPACTION 162 INCREMENTAL_COMPACTION
164 }; 163 };
165 164
166 virtual bool SometimesSetsUpAFrame() { return false; } 165 virtual bool SometimesSetsUpAFrame() { return false; }
167 166
168 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) { 167 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) {
169 const unsigned offset = masm->instr_at(pos) & kImm16Mask; 168 const unsigned offset = masm->instr_at(pos) & kImm16Mask;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 Register scratch1_; 280 Register scratch1_;
282 281
283 friend class RecordWriteStub; 282 friend class RecordWriteStub;
284 }; 283 };
285 284
286 enum OnNoNeedToInformIncrementalMarker { 285 enum OnNoNeedToInformIncrementalMarker {
287 kReturnOnNoNeedToInformIncrementalMarker, 286 kReturnOnNoNeedToInformIncrementalMarker,
288 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker 287 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
289 }; 288 };
290 289
291 virtual inline Major MajorKey() const FINAL OVERRIDE; 290 virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; }
292 291
293 void Generate(MacroAssembler* masm); 292 void Generate(MacroAssembler* masm);
294 void GenerateIncremental(MacroAssembler* masm, Mode mode); 293 void GenerateIncremental(MacroAssembler* masm, Mode mode);
295 void CheckNeedsToInformIncrementalMarker( 294 void CheckNeedsToInformIncrementalMarker(
296 MacroAssembler* masm, 295 MacroAssembler* masm,
297 OnNoNeedToInformIncrementalMarker on_no_need, 296 OnNoNeedToInformIncrementalMarker on_no_need,
298 Mode mode); 297 Mode mode);
299 void InformIncrementalMarker(MacroAssembler* masm); 298 void InformIncrementalMarker(MacroAssembler* masm);
300 299
301 void Activate(Code* code) { 300 void Activate(Code* code) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 // keep the code which called into native pinned in the memory. Currently the 339 // 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 340 // simplest approach is to generate such stub early enough so it can never be
342 // moved by GC 341 // moved by GC
343 class DirectCEntryStub: public PlatformCodeStub { 342 class DirectCEntryStub: public PlatformCodeStub {
344 public: 343 public:
345 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 344 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
346 void Generate(MacroAssembler* masm); 345 void Generate(MacroAssembler* masm);
347 void GenerateCall(MacroAssembler* masm, Register target); 346 void GenerateCall(MacroAssembler* masm, Register target);
348 347
349 private: 348 private:
350 virtual inline Major MajorKey() const FINAL OVERRIDE;
351
352 bool NeedsImmovableCode() { return true; } 349 bool NeedsImmovableCode() { return true; }
353 350
354 DISALLOW_COPY_AND_ASSIGN(DirectCEntryStub); 351 DEFINE_CODE_STUB(DirectCEntry, PlatformCodeStub);
355 }; 352 };
356 353
357 354
358 class NameDictionaryLookupStub: public PlatformCodeStub { 355 class NameDictionaryLookupStub: public PlatformCodeStub {
359 public: 356 public:
360 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; 357 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
361 358
362 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) 359 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode)
363 : PlatformCodeStub(isolate) { 360 : PlatformCodeStub(isolate) {
364 minor_key_ = LookupModeBits::encode(mode); 361 minor_key_ = LookupModeBits::encode(mode);
(...skipping 24 matching lines...) Expand all
389 static const int kTotalProbes = 20; 386 static const int kTotalProbes = 20;
390 387
391 static const int kCapacityOffset = 388 static const int kCapacityOffset =
392 NameDictionary::kHeaderSize + 389 NameDictionary::kHeaderSize +
393 NameDictionary::kCapacityIndex * kPointerSize; 390 NameDictionary::kCapacityIndex * kPointerSize;
394 391
395 static const int kElementsStartOffset = 392 static const int kElementsStartOffset =
396 NameDictionary::kHeaderSize + 393 NameDictionary::kHeaderSize +
397 NameDictionary::kElementsStartIndex * kPointerSize; 394 NameDictionary::kElementsStartIndex * kPointerSize;
398 395
399 virtual inline Major MajorKey() const FINAL OVERRIDE;
400
401 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } 396 LookupMode mode() const { return LookupModeBits::decode(minor_key_); }
402 397
403 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; 398 class LookupModeBits: public BitField<LookupMode, 0, 1> {};
404 399
405 DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub); 400 DEFINE_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
406 }; 401 };
407 402
408 403
409 } } // namespace v8::internal 404 } } // namespace v8::internal
410 405
411 #endif // V8_MIPS_CODE_STUBS_ARM_H_ 406 #endif // V8_MIPS_CODE_STUBS_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/mips64/code-stubs-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698