OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64_CODE_STUBS_ARM64_H_ | 5 #ifndef V8_ARM64_CODE_STUBS_ARM64_H_ |
6 #define V8_ARM64_CODE_STUBS_ARM64_H_ | 6 #define V8_ARM64_CODE_STUBS_ARM64_H_ |
7 | 7 |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | 52 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
53 }; | 53 }; |
54 | 54 |
55 | 55 |
56 class StoreRegistersStateStub: public PlatformCodeStub { | 56 class StoreRegistersStateStub: public PlatformCodeStub { |
57 public: | 57 public: |
58 explicit StoreRegistersStateStub(Isolate* isolate) | 58 explicit StoreRegistersStateStub(Isolate* isolate) |
59 : PlatformCodeStub(isolate) {} | 59 : PlatformCodeStub(isolate) {} |
60 | 60 |
61 static Register to_be_pushed_lr() { return ip0; } | 61 static Register to_be_pushed_lr() { return ip0; } |
62 | |
62 static void GenerateAheadOfTime(Isolate* isolate); | 63 static void GenerateAheadOfTime(Isolate* isolate); |
64 | |
63 private: | 65 private: |
64 Major MajorKey() const { return StoreRegistersState; } | 66 Major MajorKey() const { return StoreRegistersState; } |
65 uint32_t MinorKey() const { return 0; } | |
66 | 67 |
67 void Generate(MacroAssembler* masm); | 68 void Generate(MacroAssembler* masm); |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(StoreRegistersStateStub); | |
68 }; | 71 }; |
69 | 72 |
70 | 73 |
71 class RestoreRegistersStateStub: public PlatformCodeStub { | 74 class RestoreRegistersStateStub: public PlatformCodeStub { |
72 public: | 75 public: |
73 explicit RestoreRegistersStateStub(Isolate* isolate) | 76 explicit RestoreRegistersStateStub(Isolate* isolate) |
74 : PlatformCodeStub(isolate) {} | 77 : PlatformCodeStub(isolate) {} |
75 | 78 |
76 static void GenerateAheadOfTime(Isolate* isolate); | 79 static void GenerateAheadOfTime(Isolate* isolate); |
77 private: | 80 private: |
78 Major MajorKey() const { return RestoreRegistersState; } | 81 Major MajorKey() const { return RestoreRegistersState; } |
79 uint32_t MinorKey() const { return 0; } | |
80 | 82 |
81 void Generate(MacroAssembler* masm); | 83 void Generate(MacroAssembler* masm); |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(RestoreRegistersStateStub); | |
82 }; | 86 }; |
83 | 87 |
84 | 88 |
85 class RecordWriteStub: public PlatformCodeStub { | 89 class RecordWriteStub: public PlatformCodeStub { |
86 public: | 90 public: |
87 // Stub to record the write of 'value' at 'address' in 'object'. | 91 // Stub to record the write of 'value' at 'address' in 'object'. |
88 // Typically 'address' = 'object' + <some offset>. | 92 // Typically 'address' = 'object' + <some offset>. |
89 // See MacroAssembler::RecordWriteField() for example. | 93 // See MacroAssembler::RecordWriteField() for example. |
90 RecordWriteStub(Isolate* isolate, | 94 RecordWriteStub(Isolate* isolate, |
91 Register object, | 95 Register object, |
92 Register value, | 96 Register value, |
93 Register address, | 97 Register address, |
94 RememberedSetAction remembered_set_action, | 98 RememberedSetAction remembered_set_action, |
95 SaveFPRegsMode fp_mode) | 99 SaveFPRegsMode fp_mode) |
96 : PlatformCodeStub(isolate), | 100 : PlatformCodeStub(isolate), |
97 object_(object), | |
98 value_(value), | |
99 address_(address), | |
100 remembered_set_action_(remembered_set_action), | |
101 save_fp_regs_mode_(fp_mode), | |
102 regs_(object, // An input reg. | 101 regs_(object, // An input reg. |
103 address, // An input reg. | 102 address, // An input reg. |
104 value) { // One scratch reg. | 103 value) { // One scratch reg. |
104 DCHECK(object.Is64Bits()); | |
105 DCHECK(value.Is64Bits()); | |
106 DCHECK(address.Is64Bits()); | |
107 minor_key_ = ObjectBits::encode(object.code()) | | |
108 ValueBits::encode(value.code()) | | |
109 AddressBits::encode(address.code()) | | |
110 RememberedSetActionBits::encode(remembered_set_action) | | |
111 SaveFPRegsModeBits::encode(fp_mode); | |
105 } | 112 } |
106 | 113 |
107 enum Mode { | 114 enum Mode { |
108 STORE_BUFFER_ONLY, | 115 STORE_BUFFER_ONLY, |
109 INCREMENTAL, | 116 INCREMENTAL, |
110 INCREMENTAL_COMPACTION | 117 INCREMENTAL_COMPACTION |
111 }; | 118 }; |
112 | 119 |
113 virtual bool SometimesSetsUpAFrame() { return false; } | 120 virtual bool SometimesSetsUpAFrame() { return false; } |
114 | 121 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 | 281 |
275 // We also remove MacroAssembler's scratch registers. | 282 // We also remove MacroAssembler's scratch registers. |
276 list.Remove(MacroAssembler::DefaultTmpList()); | 283 list.Remove(MacroAssembler::DefaultTmpList()); |
277 | 284 |
278 return list; | 285 return list; |
279 } | 286 } |
280 | 287 |
281 friend class RecordWriteStub; | 288 friend class RecordWriteStub; |
282 }; | 289 }; |
283 | 290 |
284 // A list of stub variants which are pregenerated. | |
285 // The variants are stored in the same format as the minor key, so | |
286 // MinorKeyFor() can be used to populate and check this list. | |
287 static const int kAheadOfTime[]; | |
288 | |
289 void Generate(MacroAssembler* masm); | |
290 void GenerateIncremental(MacroAssembler* masm, Mode mode); | |
291 | |
292 enum OnNoNeedToInformIncrementalMarker { | 291 enum OnNoNeedToInformIncrementalMarker { |
293 kReturnOnNoNeedToInformIncrementalMarker, | 292 kReturnOnNoNeedToInformIncrementalMarker, |
294 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker | 293 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker |
295 }; | 294 }; |
296 | 295 |
296 Major MajorKey() const { return RecordWrite; } | |
297 | |
298 void Generate(MacroAssembler* masm); | |
299 void GenerateIncremental(MacroAssembler* masm, Mode mode); | |
297 void CheckNeedsToInformIncrementalMarker( | 300 void CheckNeedsToInformIncrementalMarker( |
298 MacroAssembler* masm, | 301 MacroAssembler* masm, |
299 OnNoNeedToInformIncrementalMarker on_no_need, | 302 OnNoNeedToInformIncrementalMarker on_no_need, |
300 Mode mode); | 303 Mode mode); |
301 void InformIncrementalMarker(MacroAssembler* masm); | 304 void InformIncrementalMarker(MacroAssembler* masm); |
302 | 305 |
303 Major MajorKey() const { return RecordWrite; } | |
304 | |
305 uint32_t MinorKey() const { | |
306 return MinorKeyFor(object_, value_, address_, remembered_set_action_, | |
307 save_fp_regs_mode_); | |
308 } | |
309 | |
310 static uint32_t MinorKeyFor(Register object, Register value, Register address, | |
311 RememberedSetAction action, | |
312 SaveFPRegsMode fp_mode) { | |
313 DCHECK(object.Is64Bits()); | |
314 DCHECK(value.Is64Bits()); | |
315 DCHECK(address.Is64Bits()); | |
316 return ObjectBits::encode(object.code()) | | |
317 ValueBits::encode(value.code()) | | |
318 AddressBits::encode(address.code()) | | |
319 RememberedSetActionBits::encode(action) | | |
320 SaveFPRegsModeBits::encode(fp_mode); | |
321 } | |
322 | |
323 void Activate(Code* code) { | 306 void Activate(Code* code) { |
324 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); | 307 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); |
325 } | 308 } |
326 | 309 |
310 Register object() const { | |
311 return Register::from_code(ObjectBits::decode(minor_key_)); | |
312 } | |
313 | |
314 Register value() const { | |
315 return Register::from_code(ValueBits::decode(minor_key_)); | |
316 } | |
317 | |
318 Register address() const { | |
319 return Register::from_code(AddressBits::decode(minor_key_)); | |
320 } | |
321 | |
322 RememberedSetAction remembered_set_action() const { | |
323 return RememberedSetActionBits::decode(minor_key_); | |
324 } | |
325 | |
326 SaveFPRegsMode save_fp_regs_mode() const { | |
327 return SaveFPRegsModeBits::decode(minor_key_); | |
328 } | |
329 | |
327 class ObjectBits: public BitField<int, 0, 5> {}; | 330 class ObjectBits: public BitField<int, 0, 5> {}; |
328 class ValueBits: public BitField<int, 5, 5> {}; | 331 class ValueBits: public BitField<int, 5, 5> {}; |
329 class AddressBits: public BitField<int, 10, 5> {}; | 332 class AddressBits: public BitField<int, 10, 5> {}; |
330 class RememberedSetActionBits: public BitField<RememberedSetAction, 15, 1> {}; | 333 class RememberedSetActionBits: public BitField<RememberedSetAction, 15, 1> {}; |
331 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 16, 1> {}; | 334 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 16, 1> {}; |
332 | 335 |
mvstanton
2014/09/03 11:00:48
I think you forgot to remove the member variables
| |
333 Register object_; | 336 Register object_; |
334 Register value_; | 337 Register value_; |
335 Register address_; | 338 Register address_; |
336 RememberedSetAction remembered_set_action_; | 339 RememberedSetAction remembered_set_action_; |
337 SaveFPRegsMode save_fp_regs_mode_; | 340 SaveFPRegsMode save_fp_regs_mode_; |
338 Label slow_; | 341 Label slow_; |
339 RegisterAllocation regs_; | 342 RegisterAllocation regs_; |
340 }; | 343 }; |
341 | 344 |
342 | 345 |
343 // Helper to call C++ functions from generated code. The caller must prepare | 346 // Helper to call C++ functions from generated code. The caller must prepare |
344 // the exit frame before doing the call with GenerateCall. | 347 // the exit frame before doing the call with GenerateCall. |
345 class DirectCEntryStub: public PlatformCodeStub { | 348 class DirectCEntryStub: public PlatformCodeStub { |
346 public: | 349 public: |
347 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 350 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
348 void Generate(MacroAssembler* masm); | 351 void Generate(MacroAssembler* masm); |
349 void GenerateCall(MacroAssembler* masm, Register target); | 352 void GenerateCall(MacroAssembler* masm, Register target); |
350 | 353 |
351 private: | 354 private: |
352 Major MajorKey() const { return DirectCEntry; } | 355 Major MajorKey() const { return DirectCEntry; } |
353 uint32_t MinorKey() const { return 0; } | |
354 | 356 |
355 bool NeedsImmovableCode() { return true; } | 357 bool NeedsImmovableCode() { return true; } |
358 | |
359 DISALLOW_COPY_AND_ASSIGN(DirectCEntryStub); | |
356 }; | 360 }; |
357 | 361 |
358 | 362 |
359 class NameDictionaryLookupStub: public PlatformCodeStub { | 363 class NameDictionaryLookupStub: public PlatformCodeStub { |
360 public: | 364 public: |
361 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; | 365 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
362 | 366 |
363 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) | 367 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) |
364 : PlatformCodeStub(isolate), mode_(mode) { } | 368 : PlatformCodeStub(isolate) { |
369 minor_key_ = LookupModeBits::encode(mode); | |
370 } | |
365 | 371 |
366 void Generate(MacroAssembler* masm); | 372 void Generate(MacroAssembler* masm); |
367 | 373 |
368 static void GenerateNegativeLookup(MacroAssembler* masm, | 374 static void GenerateNegativeLookup(MacroAssembler* masm, |
369 Label* miss, | 375 Label* miss, |
370 Label* done, | 376 Label* done, |
371 Register receiver, | 377 Register receiver, |
372 Register properties, | 378 Register properties, |
373 Handle<Name> name, | 379 Handle<Name> name, |
374 Register scratch0); | 380 Register scratch0); |
(...skipping 15 matching lines...) Expand all Loading... | |
390 static const int kCapacityOffset = | 396 static const int kCapacityOffset = |
391 NameDictionary::kHeaderSize + | 397 NameDictionary::kHeaderSize + |
392 NameDictionary::kCapacityIndex * kPointerSize; | 398 NameDictionary::kCapacityIndex * kPointerSize; |
393 | 399 |
394 static const int kElementsStartOffset = | 400 static const int kElementsStartOffset = |
395 NameDictionary::kHeaderSize + | 401 NameDictionary::kHeaderSize + |
396 NameDictionary::kElementsStartIndex * kPointerSize; | 402 NameDictionary::kElementsStartIndex * kPointerSize; |
397 | 403 |
398 Major MajorKey() const { return NameDictionaryLookup; } | 404 Major MajorKey() const { return NameDictionaryLookup; } |
399 | 405 |
400 uint32_t MinorKey() const { return LookupModeBits::encode(mode_); } | 406 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } |
401 | 407 |
402 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 408 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
403 | 409 |
404 LookupMode mode_; | 410 DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub); |
405 }; | 411 }; |
406 | 412 |
407 } } // namespace v8::internal | 413 } } // namespace v8::internal |
408 | 414 |
409 #endif // V8_ARM64_CODE_STUBS_ARM64_H_ | 415 #endif // V8_ARM64_CODE_STUBS_ARM64_H_ |
OLD | NEW |