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

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

Issue 535733004: Minor-key-ify remaining code stubs. (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/arm/code-stubs-arm.cc » ('j') | src/arm64/code-stubs-arm64.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM_CODE_STUBS_ARM_H_
6 #define V8_ARM_CODE_STUBS_ARM_H_ 6 #define V8_ARM_CODE_STUBS_ARM_H_
7 7
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); 69 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
70 }; 70 };
71 71
72 72
73 // This stub can convert a signed int32 to a heap number (double). It does 73 // This stub can convert a signed int32 to a heap number (double). It does
74 // not work for int32s that are in Smi range! No GC occurs during this stub 74 // not work for int32s that are in Smi range! No GC occurs during this stub
75 // so you don't have to set up the frame. 75 // so you don't have to set up the frame.
76 class WriteInt32ToHeapNumberStub : public PlatformCodeStub { 76 class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
77 public: 77 public:
78 WriteInt32ToHeapNumberStub(Isolate* isolate, 78 WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int,
79 Register the_int, 79 Register the_heap_number, Register scratch)
80 Register the_heap_number, 80 : PlatformCodeStub(isolate) {
81 Register scratch) 81 minor_key_ = IntRegisterBits::encode(the_int.code()) |
82 : PlatformCodeStub(isolate), 82 HeapNumberRegisterBits::encode(the_heap_number.code()) |
83 the_int_(the_int), 83 ScratchRegisterBits::encode(scratch.code());
84 the_heap_number_(the_heap_number), 84 }
85 scratch_(scratch) { }
86 85
87 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); 86 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
88 87
89 private: 88 private:
90 Register the_int_; 89 Major MajorKey() const { return WriteInt32ToHeapNumber; }
91 Register the_heap_number_; 90
92 Register scratch_; 91 void Generate(MacroAssembler* masm);
92
93 Register the_int() const {
94 return Register::from_code(IntRegisterBits::decode(minor_key_));
95 }
96
97 Register the_heap_number() const {
98 return Register::from_code(HeapNumberRegisterBits::decode(minor_key_));
99 }
100
101 Register scratch() const {
102 return Register::from_code(ScratchRegisterBits::decode(minor_key_));
103 }
93 104
94 // Minor key encoding in 16 bits. 105 // Minor key encoding in 16 bits.
95 class IntRegisterBits: public BitField<int, 0, 4> {}; 106 class IntRegisterBits: public BitField<int, 0, 4> {};
96 class HeapNumberRegisterBits: public BitField<int, 4, 4> {}; 107 class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
97 class ScratchRegisterBits: public BitField<int, 8, 4> {}; 108 class ScratchRegisterBits: public BitField<int, 8, 4> {};
98 109
99 Major MajorKey() const { return WriteInt32ToHeapNumber; } 110 DISALLOW_COPY_AND_ASSIGN(WriteInt32ToHeapNumberStub);
100 uint32_t MinorKey() const {
101 // Encode the parameters in a unique 16 bit value.
102 return IntRegisterBits::encode(the_int_.code())
103 | HeapNumberRegisterBits::encode(the_heap_number_.code())
104 | ScratchRegisterBits::encode(scratch_.code());
105 }
106
107 void Generate(MacroAssembler* masm);
108 }; 111 };
109 112
110 113
111 class RecordWriteStub: public PlatformCodeStub { 114 class RecordWriteStub: public PlatformCodeStub {
112 public: 115 public:
113 RecordWriteStub(Isolate* isolate, 116 RecordWriteStub(Isolate* isolate,
114 Register object, 117 Register object,
115 Register value, 118 Register value,
116 Register address, 119 Register address,
117 RememberedSetAction remembered_set_action, 120 RememberedSetAction remembered_set_action,
118 SaveFPRegsMode fp_mode) 121 SaveFPRegsMode fp_mode)
119 : PlatformCodeStub(isolate), 122 : PlatformCodeStub(isolate),
120 object_(object),
121 value_(value),
122 address_(address),
123 remembered_set_action_(remembered_set_action),
124 save_fp_regs_mode_(fp_mode),
125 regs_(object, // An input reg. 123 regs_(object, // An input reg.
126 address, // An input reg. 124 address, // An input reg.
127 value) { // One scratch reg. 125 value) { // One scratch reg.
126 minor_key_ = ObjectBits::encode(object.code()) |
127 ValueBits::encode(value.code()) |
128 AddressBits::encode(address.code()) |
129 RememberedSetActionBits::encode(remembered_set_action) |
130 SaveFPRegsModeBits::encode(fp_mode);
128 } 131 }
129 132
130 enum Mode { 133 enum Mode {
131 STORE_BUFFER_ONLY, 134 STORE_BUFFER_ONLY,
132 INCREMENTAL, 135 INCREMENTAL,
133 INCREMENTAL_COMPACTION 136 INCREMENTAL_COMPACTION
134 }; 137 };
135 138
136 virtual bool SometimesSetsUpAFrame() { return false; } 139 virtual bool SometimesSetsUpAFrame() { return false; }
137 140
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 Register scratch1_; 250 Register scratch1_;
248 251
249 friend class RecordWriteStub; 252 friend class RecordWriteStub;
250 }; 253 };
251 254
252 enum OnNoNeedToInformIncrementalMarker { 255 enum OnNoNeedToInformIncrementalMarker {
253 kReturnOnNoNeedToInformIncrementalMarker, 256 kReturnOnNoNeedToInformIncrementalMarker,
254 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker 257 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
255 }; 258 };
256 259
260 Major MajorKey() const { return RecordWrite; }
261
257 void Generate(MacroAssembler* masm); 262 void Generate(MacroAssembler* masm);
258 void GenerateIncremental(MacroAssembler* masm, Mode mode); 263 void GenerateIncremental(MacroAssembler* masm, Mode mode);
259 void CheckNeedsToInformIncrementalMarker( 264 void CheckNeedsToInformIncrementalMarker(
260 MacroAssembler* masm, 265 MacroAssembler* masm,
261 OnNoNeedToInformIncrementalMarker on_no_need, 266 OnNoNeedToInformIncrementalMarker on_no_need,
262 Mode mode); 267 Mode mode);
263 void InformIncrementalMarker(MacroAssembler* masm); 268 void InformIncrementalMarker(MacroAssembler* masm);
264 269
265 Major MajorKey() const { return RecordWrite; }
266
267 uint32_t MinorKey() const {
268 return ObjectBits::encode(object_.code()) |
269 ValueBits::encode(value_.code()) |
270 AddressBits::encode(address_.code()) |
271 RememberedSetActionBits::encode(remembered_set_action_) |
272 SaveFPRegsModeBits::encode(save_fp_regs_mode_);
273 }
274
275 void Activate(Code* code) { 270 void Activate(Code* code) {
276 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); 271 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
277 } 272 }
278 273
274 Register object() const {
275 return Register::from_code(ObjectBits::decode(minor_key_));
276 }
277
278 Register value() const {
279 return Register::from_code(ValueBits::decode(minor_key_));
280 }
281
282 Register address() const {
283 return Register::from_code(AddressBits::decode(minor_key_));
284 }
285
286 RememberedSetAction remembered_set_action() const {
287 return RememberedSetActionBits::decode(minor_key_);
288 }
289
290 SaveFPRegsMode save_fp_regs_mode() const {
291 return SaveFPRegsModeBits::decode(minor_key_);
292 }
293
279 class ObjectBits: public BitField<int, 0, 4> {}; 294 class ObjectBits: public BitField<int, 0, 4> {};
280 class ValueBits: public BitField<int, 4, 4> {}; 295 class ValueBits: public BitField<int, 4, 4> {};
281 class AddressBits: public BitField<int, 8, 4> {}; 296 class AddressBits: public BitField<int, 8, 4> {};
282 class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {}; 297 class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {};
283 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {}; 298 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {};
284 299
285 Register object_;
286 Register value_;
287 Register address_;
288 RememberedSetAction remembered_set_action_;
289 SaveFPRegsMode save_fp_regs_mode_;
290 Label slow_; 300 Label slow_;
291 RegisterAllocation regs_; 301 RegisterAllocation regs_;
302
303 DISALLOW_COPY_AND_ASSIGN(RecordWriteStub);
292 }; 304 };
293 305
294 306
295 // Trampoline stub to call into native code. To call safely into native code 307 // Trampoline stub to call into native code. To call safely into native code
296 // in the presence of compacting GC (which can move code objects) we need to 308 // in the presence of compacting GC (which can move code objects) we need to
297 // keep the code which called into native pinned in the memory. Currently the 309 // keep the code which called into native pinned in the memory. Currently the
298 // simplest approach is to generate such stub early enough so it can never be 310 // simplest approach is to generate such stub early enough so it can never be
299 // moved by GC 311 // moved by GC
300 class DirectCEntryStub: public PlatformCodeStub { 312 class DirectCEntryStub: public PlatformCodeStub {
301 public: 313 public:
302 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 314 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
303 void Generate(MacroAssembler* masm); 315 void Generate(MacroAssembler* masm);
304 void GenerateCall(MacroAssembler* masm, Register target); 316 void GenerateCall(MacroAssembler* masm, Register target);
305 317
306 private: 318 private:
307 Major MajorKey() const { return DirectCEntry; } 319 Major MajorKey() const { return DirectCEntry; }
308 uint32_t MinorKey() const { return 0; }
309 320
310 bool NeedsImmovableCode() { return true; } 321 bool NeedsImmovableCode() { return true; }
322
323 DISALLOW_COPY_AND_ASSIGN(DirectCEntryStub);
311 }; 324 };
312 325
313 326
314 class NameDictionaryLookupStub: public PlatformCodeStub { 327 class NameDictionaryLookupStub: public PlatformCodeStub {
315 public: 328 public:
316 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; 329 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
317 330
318 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) 331 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode)
319 : PlatformCodeStub(isolate), mode_(mode) { } 332 : PlatformCodeStub(isolate) {
333 minor_key_ = LookupModeBits::encode(mode);
334 }
320 335
321 void Generate(MacroAssembler* masm); 336 void Generate(MacroAssembler* masm);
322 337
323 static void GenerateNegativeLookup(MacroAssembler* masm, 338 static void GenerateNegativeLookup(MacroAssembler* masm,
324 Label* miss, 339 Label* miss,
325 Label* done, 340 Label* done,
326 Register receiver, 341 Register receiver,
327 Register properties, 342 Register properties,
328 Handle<Name> name, 343 Handle<Name> name,
329 Register scratch0); 344 Register scratch0);
(...skipping 15 matching lines...) Expand all
345 static const int kCapacityOffset = 360 static const int kCapacityOffset =
346 NameDictionary::kHeaderSize + 361 NameDictionary::kHeaderSize +
347 NameDictionary::kCapacityIndex * kPointerSize; 362 NameDictionary::kCapacityIndex * kPointerSize;
348 363
349 static const int kElementsStartOffset = 364 static const int kElementsStartOffset =
350 NameDictionary::kHeaderSize + 365 NameDictionary::kHeaderSize +
351 NameDictionary::kElementsStartIndex * kPointerSize; 366 NameDictionary::kElementsStartIndex * kPointerSize;
352 367
353 Major MajorKey() const { return NameDictionaryLookup; } 368 Major MajorKey() const { return NameDictionaryLookup; }
354 369
355 uint32_t MinorKey() const { return LookupModeBits::encode(mode_); } 370 LookupMode mode() const { return LookupModeBits::decode(minor_key_); }
356 371
357 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; 372 class LookupModeBits: public BitField<LookupMode, 0, 1> {};
358 373
359 LookupMode mode_; 374 DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub);
360 }; 375 };
361 376
362 } } // namespace v8::internal 377 } } // namespace v8::internal
363 378
364 #endif // V8_ARM_CODE_STUBS_ARM_H_ 379 #endif // V8_ARM_CODE_STUBS_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | src/arm64/code-stubs-arm64.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698