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

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

Issue 542613003: Introduce code stub constructors for stub keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: define MajorKey inline 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/arm64/code-stubs-arm64.h » ('j') | test/cctest/test-code-stubs.cc » ('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"
9
10 namespace v8 { 8 namespace v8 {
11 namespace internal { 9 namespace internal {
12 10
13 11
14 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); 12 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
15 13
16 14
17 class StringHelper : public AllStatic { 15 class StringHelper : public AllStatic {
18 public: 16 public:
19 // Generate code for copying a large number of characters. This function 17 // Generate code for copying a large number of characters. This function
20 // is allowed to spend extra time setting up conditions to make copying 18 // is allowed to spend extra time setting up conditions to make copying
21 // faster. Copying of overlapping regions is not supported. 19 // faster. Copying of overlapping regions is not supported.
22 // Dest register ends at the position after the last character written. 20 // Dest register ends at the position after the last character written.
23 static void GenerateCopyCharacters(MacroAssembler* masm, 21 static void GenerateCopyCharacters(MacroAssembler* masm,
24 Register dest, 22 Register dest,
25 Register src, 23 Register src,
26 Register count, 24 Register count,
27 Register scratch, 25 Register scratch,
28 String::Encoding encoding); 26 String::Encoding encoding);
29 27
30
31 // Generate string hash. 28 // Generate string hash.
32 static void GenerateHashInit(MacroAssembler* masm, 29 static void GenerateHashInit(MacroAssembler* masm,
33 Register hash, 30 Register hash,
34 Register character); 31 Register character);
35 32
36 static void GenerateHashAddCharacter(MacroAssembler* masm, 33 static void GenerateHashAddCharacter(MacroAssembler* masm,
37 Register hash, 34 Register hash,
38 Register character); 35 Register character);
39 36
40 static void GenerateHashGetHash(MacroAssembler* masm, 37 static void GenerateHashGetHash(MacroAssembler* masm,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Register the_heap_number, Register scratch) 76 Register the_heap_number, Register scratch)
80 : PlatformCodeStub(isolate) { 77 : PlatformCodeStub(isolate) {
81 minor_key_ = IntRegisterBits::encode(the_int.code()) | 78 minor_key_ = IntRegisterBits::encode(the_int.code()) |
82 HeapNumberRegisterBits::encode(the_heap_number.code()) | 79 HeapNumberRegisterBits::encode(the_heap_number.code()) |
83 ScratchRegisterBits::encode(scratch.code()); 80 ScratchRegisterBits::encode(scratch.code());
84 } 81 }
85 82
86 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); 83 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
87 84
88 private: 85 private:
89 virtual inline Major MajorKey() const FINAL OVERRIDE;
90
91 void Generate(MacroAssembler* masm); 86 void Generate(MacroAssembler* masm);
92 87
93 Register the_int() const { 88 Register the_int() const {
94 return Register::from_code(IntRegisterBits::decode(minor_key_)); 89 return Register::from_code(IntRegisterBits::decode(minor_key_));
95 } 90 }
96 91
97 Register the_heap_number() const { 92 Register the_heap_number() const {
98 return Register::from_code(HeapNumberRegisterBits::decode(minor_key_)); 93 return Register::from_code(HeapNumberRegisterBits::decode(minor_key_));
99 } 94 }
100 95
101 Register scratch() const { 96 Register scratch() const {
102 return Register::from_code(ScratchRegisterBits::decode(minor_key_)); 97 return Register::from_code(ScratchRegisterBits::decode(minor_key_));
103 } 98 }
104 99
105 // Minor key encoding in 16 bits. 100 // Minor key encoding in 16 bits.
106 class IntRegisterBits: public BitField<int, 0, 4> {}; 101 class IntRegisterBits: public BitField<int, 0, 4> {};
107 class HeapNumberRegisterBits: public BitField<int, 4, 4> {}; 102 class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
108 class ScratchRegisterBits: public BitField<int, 8, 4> {}; 103 class ScratchRegisterBits: public BitField<int, 8, 4> {};
109 104
110 DISALLOW_COPY_AND_ASSIGN(WriteInt32ToHeapNumberStub); 105 DEFINE_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub);
111 }; 106 };
112 107
113 108
114 class RecordWriteStub: public PlatformCodeStub { 109 class RecordWriteStub: public PlatformCodeStub {
115 public: 110 public:
116 RecordWriteStub(Isolate* isolate, 111 RecordWriteStub(Isolate* isolate,
117 Register object, 112 Register object,
118 Register value, 113 Register value,
119 Register address, 114 Register address,
120 RememberedSetAction remembered_set_action, 115 RememberedSetAction remembered_set_action,
121 SaveFPRegsMode fp_mode) 116 SaveFPRegsMode fp_mode)
122 : PlatformCodeStub(isolate), 117 : PlatformCodeStub(isolate),
123 regs_(object, // An input reg. 118 regs_(object, // An input reg.
124 address, // An input reg. 119 address, // An input reg.
125 value) { // One scratch reg. 120 value) { // One scratch reg.
126 minor_key_ = ObjectBits::encode(object.code()) | 121 minor_key_ = ObjectBits::encode(object.code()) |
127 ValueBits::encode(value.code()) | 122 ValueBits::encode(value.code()) |
128 AddressBits::encode(address.code()) | 123 AddressBits::encode(address.code()) |
129 RememberedSetActionBits::encode(remembered_set_action) | 124 RememberedSetActionBits::encode(remembered_set_action) |
130 SaveFPRegsModeBits::encode(fp_mode); 125 SaveFPRegsModeBits::encode(fp_mode);
131 } 126 }
132 127
128 RecordWriteStub(uint32_t key, Isolate* isolate)
129 : PlatformCodeStub(key, isolate), regs_(object(), address(), value()) {}
130
133 enum Mode { 131 enum Mode {
134 STORE_BUFFER_ONLY, 132 STORE_BUFFER_ONLY,
135 INCREMENTAL, 133 INCREMENTAL,
136 INCREMENTAL_COMPACTION 134 INCREMENTAL_COMPACTION
137 }; 135 };
138 136
139 virtual bool SometimesSetsUpAFrame() { return false; } 137 virtual bool SometimesSetsUpAFrame() { return false; }
140 138
141 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) { 139 static void PatchBranchIntoNop(MacroAssembler* masm, int pos) {
142 masm->instr_at_put(pos, (masm->instr_at(pos) & ~B27) | (B24 | B20)); 140 masm->instr_at_put(pos, (masm->instr_at(pos) & ~B27) | (B24 | B20));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 Register scratch1_; 248 Register scratch1_;
251 249
252 friend class RecordWriteStub; 250 friend class RecordWriteStub;
253 }; 251 };
254 252
255 enum OnNoNeedToInformIncrementalMarker { 253 enum OnNoNeedToInformIncrementalMarker {
256 kReturnOnNoNeedToInformIncrementalMarker, 254 kReturnOnNoNeedToInformIncrementalMarker,
257 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker 255 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
258 }; 256 };
259 257
260 virtual inline Major MajorKey() const FINAL OVERRIDE; 258 virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; }
261 259
262 void Generate(MacroAssembler* masm); 260 void Generate(MacroAssembler* masm);
263 void GenerateIncremental(MacroAssembler* masm, Mode mode); 261 void GenerateIncremental(MacroAssembler* masm, Mode mode);
264 void CheckNeedsToInformIncrementalMarker( 262 void CheckNeedsToInformIncrementalMarker(
265 MacroAssembler* masm, 263 MacroAssembler* masm,
266 OnNoNeedToInformIncrementalMarker on_no_need, 264 OnNoNeedToInformIncrementalMarker on_no_need,
267 Mode mode); 265 Mode mode);
268 void InformIncrementalMarker(MacroAssembler* masm); 266 void InformIncrementalMarker(MacroAssembler* masm);
269 267
270 void Activate(Code* code) { 268 void Activate(Code* code) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // keep the code which called into native pinned in the memory. Currently the 307 // keep the code which called into native pinned in the memory. Currently the
310 // simplest approach is to generate such stub early enough so it can never be 308 // simplest approach is to generate such stub early enough so it can never be
311 // moved by GC 309 // moved by GC
312 class DirectCEntryStub: public PlatformCodeStub { 310 class DirectCEntryStub: public PlatformCodeStub {
313 public: 311 public:
314 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 312 explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
315 void Generate(MacroAssembler* masm); 313 void Generate(MacroAssembler* masm);
316 void GenerateCall(MacroAssembler* masm, Register target); 314 void GenerateCall(MacroAssembler* masm, Register target);
317 315
318 private: 316 private:
319 virtual inline Major MajorKey() const FINAL OVERRIDE;
320
321 bool NeedsImmovableCode() { return true; } 317 bool NeedsImmovableCode() { return true; }
322 318
323 DISALLOW_COPY_AND_ASSIGN(DirectCEntryStub); 319 DEFINE_CODE_STUB(DirectCEntry, PlatformCodeStub);
324 }; 320 };
325 321
326 322
327 class NameDictionaryLookupStub: public PlatformCodeStub { 323 class NameDictionaryLookupStub: public PlatformCodeStub {
328 public: 324 public:
329 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; 325 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
330 326
331 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode) 327 NameDictionaryLookupStub(Isolate* isolate, LookupMode mode)
332 : PlatformCodeStub(isolate) { 328 : PlatformCodeStub(isolate) {
333 minor_key_ = LookupModeBits::encode(mode); 329 minor_key_ = LookupModeBits::encode(mode);
(...skipping 24 matching lines...) Expand all
358 static const int kTotalProbes = 20; 354 static const int kTotalProbes = 20;
359 355
360 static const int kCapacityOffset = 356 static const int kCapacityOffset =
361 NameDictionary::kHeaderSize + 357 NameDictionary::kHeaderSize +
362 NameDictionary::kCapacityIndex * kPointerSize; 358 NameDictionary::kCapacityIndex * kPointerSize;
363 359
364 static const int kElementsStartOffset = 360 static const int kElementsStartOffset =
365 NameDictionary::kHeaderSize + 361 NameDictionary::kHeaderSize +
366 NameDictionary::kElementsStartIndex * kPointerSize; 362 NameDictionary::kElementsStartIndex * kPointerSize;
367 363
368 virtual inline Major MajorKey() const FINAL OVERRIDE;
369
370 LookupMode mode() const { return LookupModeBits::decode(minor_key_); } 364 LookupMode mode() const { return LookupModeBits::decode(minor_key_); }
371 365
372 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; 366 class LookupModeBits: public BitField<LookupMode, 0, 1> {};
373 367
374 DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub); 368 DEFINE_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
375 }; 369 };
376 370
377 } } // namespace v8::internal 371 } } // namespace v8::internal
378 372
379 #endif // V8_ARM_CODE_STUBS_ARM_H_ 373 #endif // V8_ARM_CODE_STUBS_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.h » ('j') | test/cctest/test-code-stubs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698