OLD | NEW |
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_X64_CODE_STUBS_X64_H_ | 5 #ifndef V8_X64_CODE_STUBS_X64_H_ |
6 #define V8_X64_CODE_STUBS_X64_H_ | 6 #define V8_X64_CODE_STUBS_X64_H_ |
7 | 7 |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 Label::Distance near_jump = Label::kFar); | 64 Label::Distance near_jump = Label::kFar); |
65 | 65 |
66 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | 66 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
67 }; | 67 }; |
68 | 68 |
69 | 69 |
70 class NameDictionaryLookupStub: public PlatformCodeStub { | 70 class NameDictionaryLookupStub: public PlatformCodeStub { |
71 public: | 71 public: |
72 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; | 72 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
73 | 73 |
74 NameDictionaryLookupStub(Isolate* isolate, | 74 NameDictionaryLookupStub(Isolate* isolate, Register dictionary, |
75 Register dictionary, | 75 Register result, Register index, LookupMode mode) |
76 Register result, | 76 : PlatformCodeStub(isolate) { |
77 Register index, | 77 minor_key_ = DictionaryBits::encode(dictionary.code()) | |
78 LookupMode mode) | 78 ResultBits::encode(result.code()) | |
79 : PlatformCodeStub(isolate), | 79 IndexBits::encode(index.code()) | LookupModeBits::encode(mode); |
80 dictionary_(dictionary), | 80 } |
81 result_(result), | |
82 index_(index), | |
83 mode_(mode) { } | |
84 | 81 |
85 void Generate(MacroAssembler* masm); | 82 void Generate(MacroAssembler* masm); |
86 | 83 |
87 static void GenerateNegativeLookup(MacroAssembler* masm, | 84 static void GenerateNegativeLookup(MacroAssembler* masm, |
88 Label* miss, | 85 Label* miss, |
89 Label* done, | 86 Label* done, |
90 Register properties, | 87 Register properties, |
91 Handle<Name> name, | 88 Handle<Name> name, |
92 Register r0); | 89 Register r0); |
93 | 90 |
(...skipping 14 matching lines...) Expand all Loading... |
108 static const int kCapacityOffset = | 105 static const int kCapacityOffset = |
109 NameDictionary::kHeaderSize + | 106 NameDictionary::kHeaderSize + |
110 NameDictionary::kCapacityIndex * kPointerSize; | 107 NameDictionary::kCapacityIndex * kPointerSize; |
111 | 108 |
112 static const int kElementsStartOffset = | 109 static const int kElementsStartOffset = |
113 NameDictionary::kHeaderSize + | 110 NameDictionary::kHeaderSize + |
114 NameDictionary::kElementsStartIndex * kPointerSize; | 111 NameDictionary::kElementsStartIndex * kPointerSize; |
115 | 112 |
116 Major MajorKey() const { return NameDictionaryLookup; } | 113 Major MajorKey() const { return NameDictionaryLookup; } |
117 | 114 |
118 uint32_t MinorKey() const { | 115 Register dictionary() const { |
119 return DictionaryBits::encode(dictionary_.code()) | | 116 return Register::from_code(DictionaryBits::decode(minor_key_)); |
120 ResultBits::encode(result_.code()) | | |
121 IndexBits::encode(index_.code()) | | |
122 LookupModeBits::encode(mode_); | |
123 } | 117 } |
124 | 118 |
| 119 Register result() const { |
| 120 return Register::from_code(ResultBits::decode(minor_key_)); |
| 121 } |
| 122 |
| 123 Register index() const { |
| 124 return Register::from_code(IndexBits::decode(minor_key_)); |
| 125 } |
| 126 |
| 127 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } |
| 128 |
125 class DictionaryBits: public BitField<int, 0, 4> {}; | 129 class DictionaryBits: public BitField<int, 0, 4> {}; |
126 class ResultBits: public BitField<int, 4, 4> {}; | 130 class ResultBits: public BitField<int, 4, 4> {}; |
127 class IndexBits: public BitField<int, 8, 4> {}; | 131 class IndexBits: public BitField<int, 8, 4> {}; |
128 class LookupModeBits: public BitField<LookupMode, 12, 1> {}; | 132 class LookupModeBits: public BitField<LookupMode, 12, 1> {}; |
129 | 133 |
130 Register dictionary_; | 134 DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub); |
131 Register result_; | |
132 Register index_; | |
133 LookupMode mode_; | |
134 }; | 135 }; |
135 | 136 |
136 | 137 |
137 class RecordWriteStub: public PlatformCodeStub { | 138 class RecordWriteStub: public PlatformCodeStub { |
138 public: | 139 public: |
139 RecordWriteStub(Isolate* isolate, | 140 RecordWriteStub(Isolate* isolate, Register object, Register value, |
140 Register object, | 141 Register address, RememberedSetAction remembered_set_action, |
141 Register value, | |
142 Register address, | |
143 RememberedSetAction remembered_set_action, | |
144 SaveFPRegsMode fp_mode) | 142 SaveFPRegsMode fp_mode) |
145 : PlatformCodeStub(isolate), | 143 : PlatformCodeStub(isolate), |
146 object_(object), | |
147 value_(value), | |
148 address_(address), | |
149 remembered_set_action_(remembered_set_action), | |
150 save_fp_regs_mode_(fp_mode), | |
151 regs_(object, // An input reg. | 144 regs_(object, // An input reg. |
152 address, // An input reg. | 145 address, // An input reg. |
153 value) { // One scratch reg. | 146 value) { // One scratch reg. |
| 147 minor_key_ = ObjectBits::encode(object.code()) | |
| 148 ValueBits::encode(value.code()) | |
| 149 AddressBits::encode(address.code()) | |
| 150 RememberedSetActionBits::encode(remembered_set_action) | |
| 151 SaveFPRegsModeBits::encode(fp_mode); |
154 } | 152 } |
155 | 153 |
156 enum Mode { | 154 enum Mode { |
157 STORE_BUFFER_ONLY, | 155 STORE_BUFFER_ONLY, |
158 INCREMENTAL, | 156 INCREMENTAL, |
159 INCREMENTAL_COMPACTION | 157 INCREMENTAL_COMPACTION |
160 }; | 158 }; |
161 | 159 |
162 virtual bool SometimesSetsUpAFrame() { return false; } | 160 virtual bool SometimesSetsUpAFrame() { return false; } |
163 | 161 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 return no_reg; | 327 return no_reg; |
330 } | 328 } |
331 friend class RecordWriteStub; | 329 friend class RecordWriteStub; |
332 }; | 330 }; |
333 | 331 |
334 enum OnNoNeedToInformIncrementalMarker { | 332 enum OnNoNeedToInformIncrementalMarker { |
335 kReturnOnNoNeedToInformIncrementalMarker, | 333 kReturnOnNoNeedToInformIncrementalMarker, |
336 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker | 334 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker |
337 }; | 335 }; |
338 | 336 |
| 337 Major MajorKey() const { return RecordWrite; } |
| 338 |
339 void Generate(MacroAssembler* masm); | 339 void Generate(MacroAssembler* masm); |
340 void GenerateIncremental(MacroAssembler* masm, Mode mode); | 340 void GenerateIncremental(MacroAssembler* masm, Mode mode); |
341 void CheckNeedsToInformIncrementalMarker( | 341 void CheckNeedsToInformIncrementalMarker( |
342 MacroAssembler* masm, | 342 MacroAssembler* masm, |
343 OnNoNeedToInformIncrementalMarker on_no_need, | 343 OnNoNeedToInformIncrementalMarker on_no_need, |
344 Mode mode); | 344 Mode mode); |
345 void InformIncrementalMarker(MacroAssembler* masm); | 345 void InformIncrementalMarker(MacroAssembler* masm); |
346 | 346 |
347 Major MajorKey() const { return RecordWrite; } | |
348 | |
349 uint32_t MinorKey() const { | |
350 return ObjectBits::encode(object_.code()) | | |
351 ValueBits::encode(value_.code()) | | |
352 AddressBits::encode(address_.code()) | | |
353 RememberedSetActionBits::encode(remembered_set_action_) | | |
354 SaveFPRegsModeBits::encode(save_fp_regs_mode_); | |
355 } | |
356 | |
357 void Activate(Code* code) { | 347 void Activate(Code* code) { |
358 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); | 348 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); |
359 } | 349 } |
360 | 350 |
| 351 Register object() const { |
| 352 return Register::from_code(ObjectBits::decode(minor_key_)); |
| 353 } |
| 354 |
| 355 Register value() const { |
| 356 return Register::from_code(ValueBits::decode(minor_key_)); |
| 357 } |
| 358 |
| 359 Register address() const { |
| 360 return Register::from_code(AddressBits::decode(minor_key_)); |
| 361 } |
| 362 |
| 363 RememberedSetAction remembered_set_action() const { |
| 364 return RememberedSetActionBits::decode(minor_key_); |
| 365 } |
| 366 |
| 367 SaveFPRegsMode save_fp_regs_mode() const { |
| 368 return SaveFPRegsModeBits::decode(minor_key_); |
| 369 } |
| 370 |
361 class ObjectBits: public BitField<int, 0, 4> {}; | 371 class ObjectBits: public BitField<int, 0, 4> {}; |
362 class ValueBits: public BitField<int, 4, 4> {}; | 372 class ValueBits: public BitField<int, 4, 4> {}; |
363 class AddressBits: public BitField<int, 8, 4> {}; | 373 class AddressBits: public BitField<int, 8, 4> {}; |
364 class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {}; | 374 class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {}; |
365 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {}; | 375 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {}; |
366 | 376 |
367 Register object_; | |
368 Register value_; | |
369 Register address_; | |
370 RememberedSetAction remembered_set_action_; | |
371 SaveFPRegsMode save_fp_regs_mode_; | |
372 Label slow_; | 377 Label slow_; |
373 RegisterAllocation regs_; | 378 RegisterAllocation regs_; |
| 379 |
| 380 DISALLOW_COPY_AND_ASSIGN(RecordWriteStub); |
374 }; | 381 }; |
375 | 382 |
376 | 383 |
377 } } // namespace v8::internal | 384 } } // namespace v8::internal |
378 | 385 |
379 #endif // V8_X64_CODE_STUBS_X64_H_ | 386 #endif // V8_X64_CODE_STUBS_X64_H_ |
OLD | NEW |