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_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" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 | 14 |
15 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); | 15 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); |
16 | 16 |
17 | 17 |
18 class StoreBufferOverflowStub: public PlatformCodeStub { | |
19 public: | |
20 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) | |
21 : PlatformCodeStub(isolate), save_doubles_(save_fp) {} | |
22 | |
23 void Generate(MacroAssembler* masm); | |
24 | |
25 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | |
26 virtual bool SometimesSetsUpAFrame() { return false; } | |
27 | |
28 private: | |
29 SaveFPRegsMode save_doubles_; | |
30 | |
31 Major MajorKey() const { return StoreBufferOverflow; } | |
32 uint32_t MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } | |
33 }; | |
34 | |
35 | |
36 class StringHelper : public AllStatic { | 18 class StringHelper : public AllStatic { |
37 public: | 19 public: |
38 // Generate code for copying a large number of characters. This function | 20 // Generate code for copying a large number of characters. This function |
39 // is allowed to spend extra time setting up conditions to make copying | 21 // is allowed to spend extra time setting up conditions to make copying |
40 // faster. Copying of overlapping regions is not supported. | 22 // faster. Copying of overlapping regions is not supported. |
41 // Dest register ends at the position after the last character written. | 23 // Dest register ends at the position after the last character written. |
42 static void GenerateCopyCharacters(MacroAssembler* masm, | 24 static void GenerateCopyCharacters(MacroAssembler* masm, |
43 Register dest, | 25 Register dest, |
44 Register src, | 26 Register src, |
45 Register count, | 27 Register count, |
46 Register scratch, | 28 Register scratch, |
47 String::Encoding encoding); | 29 String::Encoding encoding); |
48 | 30 |
49 | 31 |
50 // Generate string hash. | 32 // Generate string hash. |
51 static void GenerateHashInit(MacroAssembler* masm, | 33 static void GenerateHashInit(MacroAssembler* masm, |
52 Register hash, | 34 Register hash, |
53 Register character); | 35 Register character); |
54 | 36 |
55 static void GenerateHashAddCharacter(MacroAssembler* masm, | 37 static void GenerateHashAddCharacter(MacroAssembler* masm, |
56 Register hash, | 38 Register hash, |
57 Register character); | 39 Register character); |
58 | 40 |
59 static void GenerateHashGetHash(MacroAssembler* masm, | 41 static void GenerateHashGetHash(MacroAssembler* masm, |
60 Register hash); | 42 Register hash); |
61 | 43 |
| 44 // Compare two flat ASCII strings and returns result in v0. |
| 45 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, |
| 46 Register left, |
| 47 Register right, |
| 48 Register scratch1, |
| 49 Register scratch2, |
| 50 Register scratch3, |
| 51 Register scratch4); |
| 52 |
| 53 // Compares two flat ASCII strings for equality and returns result in v0. |
| 54 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, |
| 55 Register left, |
| 56 Register right, |
| 57 Register scratch1, |
| 58 Register scratch2, |
| 59 Register scratch3); |
| 60 |
62 private: | 61 private: |
| 62 static void GenerateAsciiCharsCompareLoop(MacroAssembler* masm, |
| 63 Register left, |
| 64 Register right, |
| 65 Register length, |
| 66 Register scratch1, |
| 67 Register scratch2, |
| 68 Register scratch3, |
| 69 Label* chars_not_equal); |
| 70 |
63 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | 71 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
64 }; | 72 }; |
65 | 73 |
66 | 74 |
67 class SubStringStub: public PlatformCodeStub { | |
68 public: | |
69 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | |
70 | |
71 private: | |
72 Major MajorKey() const { return SubString; } | |
73 uint32_t MinorKey() const { return 0; } | |
74 | |
75 void Generate(MacroAssembler* masm); | |
76 }; | |
77 | |
78 | |
79 class StoreRegistersStateStub: public PlatformCodeStub { | 75 class StoreRegistersStateStub: public PlatformCodeStub { |
80 public: | 76 public: |
81 explicit StoreRegistersStateStub(Isolate* isolate) | 77 explicit StoreRegistersStateStub(Isolate* isolate) |
82 : PlatformCodeStub(isolate) {} | 78 : PlatformCodeStub(isolate) {} |
83 | 79 |
84 static void GenerateAheadOfTime(Isolate* isolate); | 80 static void GenerateAheadOfTime(Isolate* isolate); |
85 private: | 81 private: |
86 Major MajorKey() const { return StoreRegistersState; } | 82 Major MajorKey() const { return StoreRegistersState; } |
87 uint32_t MinorKey() const { return 0; } | 83 uint32_t MinorKey() const { return 0; } |
88 | 84 |
89 void Generate(MacroAssembler* masm); | 85 void Generate(MacroAssembler* masm); |
90 }; | 86 }; |
91 | 87 |
92 class RestoreRegistersStateStub: public PlatformCodeStub { | 88 class RestoreRegistersStateStub: public PlatformCodeStub { |
93 public: | 89 public: |
94 explicit RestoreRegistersStateStub(Isolate* isolate) | 90 explicit RestoreRegistersStateStub(Isolate* isolate) |
95 : PlatformCodeStub(isolate) {} | 91 : PlatformCodeStub(isolate) {} |
96 | 92 |
97 static void GenerateAheadOfTime(Isolate* isolate); | 93 static void GenerateAheadOfTime(Isolate* isolate); |
98 private: | 94 private: |
99 Major MajorKey() const { return RestoreRegistersState; } | 95 Major MajorKey() const { return RestoreRegistersState; } |
100 uint32_t MinorKey() const { return 0; } | 96 uint32_t MinorKey() const { return 0; } |
101 | 97 |
102 void Generate(MacroAssembler* masm); | 98 void Generate(MacroAssembler* masm); |
103 }; | 99 }; |
104 | 100 |
105 class StringCompareStub: public PlatformCodeStub { | |
106 public: | |
107 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | |
108 | |
109 // Compare two flat ASCII strings and returns result in v0. | |
110 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, | |
111 Register left, | |
112 Register right, | |
113 Register scratch1, | |
114 Register scratch2, | |
115 Register scratch3, | |
116 Register scratch4); | |
117 | |
118 // Compares two flat ASCII strings for equality and returns result | |
119 // in v0. | |
120 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, | |
121 Register left, | |
122 Register right, | |
123 Register scratch1, | |
124 Register scratch2, | |
125 Register scratch3); | |
126 | |
127 private: | |
128 virtual Major MajorKey() const { return StringCompare; } | |
129 virtual uint32_t MinorKey() const { return 0; } | |
130 virtual void Generate(MacroAssembler* masm); | |
131 | |
132 static void GenerateAsciiCharsCompareLoop(MacroAssembler* masm, | |
133 Register left, | |
134 Register right, | |
135 Register length, | |
136 Register scratch1, | |
137 Register scratch2, | |
138 Register scratch3, | |
139 Label* chars_not_equal); | |
140 }; | |
141 | |
142 | 101 |
143 // This stub can convert a signed int32 to a heap number (double). It does | 102 // This stub can convert a signed int32 to a heap number (double). It does |
144 // not work for int32s that are in Smi range! No GC occurs during this stub | 103 // not work for int32s that are in Smi range! No GC occurs during this stub |
145 // so you don't have to set up the frame. | 104 // so you don't have to set up the frame. |
146 class WriteInt32ToHeapNumberStub : public PlatformCodeStub { | 105 class WriteInt32ToHeapNumberStub : public PlatformCodeStub { |
147 public: | 106 public: |
148 WriteInt32ToHeapNumberStub(Isolate* isolate, | 107 WriteInt32ToHeapNumberStub(Isolate* isolate, |
149 Register the_int, | 108 Register the_int, |
150 Register the_heap_number, | 109 Register the_heap_number, |
151 Register scratch, | 110 Register scratch, |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 399 |
441 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 400 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
442 | 401 |
443 LookupMode mode_; | 402 LookupMode mode_; |
444 }; | 403 }; |
445 | 404 |
446 | 405 |
447 } } // namespace v8::internal | 406 } } // namespace v8::internal |
448 | 407 |
449 #endif // V8_MIPS_CODE_STUBS_ARM_H_ | 408 #endif // V8_MIPS_CODE_STUBS_ARM_H_ |
OLD | NEW |