OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_CODE_STUB_ASSEMBLER_H_ | 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_CODE_STUB_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/compiler/code-assembler.h" | 8 #include "src/compiler/code-assembler.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 Code::Flags flags, const char* name); | 33 Code::Flags flags, const char* name); |
34 | 34 |
35 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS }; | 35 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS }; |
36 | 36 |
37 compiler::Node* BooleanMapConstant(); | 37 compiler::Node* BooleanMapConstant(); |
38 compiler::Node* EmptyStringConstant(); | 38 compiler::Node* EmptyStringConstant(); |
39 compiler::Node* HeapNumberMapConstant(); | 39 compiler::Node* HeapNumberMapConstant(); |
40 compiler::Node* NoContextConstant(); | 40 compiler::Node* NoContextConstant(); |
41 compiler::Node* NullConstant(); | 41 compiler::Node* NullConstant(); |
42 compiler::Node* UndefinedConstant(); | 42 compiler::Node* UndefinedConstant(); |
| 43 compiler::Node* TheHoleConstant(); |
| 44 compiler::Node* HashSeed(); |
43 compiler::Node* StaleRegisterConstant(); | 45 compiler::Node* StaleRegisterConstant(); |
44 | 46 |
45 // Float64 operations. | 47 // Float64 operations. |
46 compiler::Node* Float64Ceil(compiler::Node* x); | 48 compiler::Node* Float64Ceil(compiler::Node* x); |
47 compiler::Node* Float64Floor(compiler::Node* x); | 49 compiler::Node* Float64Floor(compiler::Node* x); |
48 compiler::Node* Float64Round(compiler::Node* x); | 50 compiler::Node* Float64Round(compiler::Node* x); |
49 compiler::Node* Float64Trunc(compiler::Node* x); | 51 compiler::Node* Float64Trunc(compiler::Node* x); |
50 | 52 |
51 // Tag a Word as a Smi value. | 53 // Tag a Word as a Smi value. |
52 compiler::Node* SmiTag(compiler::Node* value); | 54 compiler::Node* SmiTag(compiler::Node* value); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 MachineType rep = MachineType::AnyTagged()); | 106 MachineType rep = MachineType::AnyTagged()); |
105 // Load a field from an object on the heap. | 107 // Load a field from an object on the heap. |
106 compiler::Node* LoadObjectField(compiler::Node* object, int offset, | 108 compiler::Node* LoadObjectField(compiler::Node* object, int offset, |
107 MachineType rep = MachineType::AnyTagged()); | 109 MachineType rep = MachineType::AnyTagged()); |
108 // Load the floating point value of a HeapNumber. | 110 // Load the floating point value of a HeapNumber. |
109 compiler::Node* LoadHeapNumberValue(compiler::Node* object); | 111 compiler::Node* LoadHeapNumberValue(compiler::Node* object); |
110 // Load the Map of an HeapObject. | 112 // Load the Map of an HeapObject. |
111 compiler::Node* LoadMap(compiler::Node* object); | 113 compiler::Node* LoadMap(compiler::Node* object); |
112 // Load the instance type of an HeapObject. | 114 // Load the instance type of an HeapObject. |
113 compiler::Node* LoadInstanceType(compiler::Node* object); | 115 compiler::Node* LoadInstanceType(compiler::Node* object); |
| 116 // Load the properties backing store of a JSObject. |
| 117 compiler::Node* LoadProperties(compiler::Node* object); |
114 // Load the elements backing store of a JSObject. | 118 // Load the elements backing store of a JSObject. |
115 compiler::Node* LoadElements(compiler::Node* object); | 119 compiler::Node* LoadElements(compiler::Node* object); |
116 // Load the length of a fixed array base instance. | 120 // Load the length of a fixed array base instance. |
117 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); | 121 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); |
118 // Load the bit field of a Map. | 122 // Load the bit field of a Map. |
119 compiler::Node* LoadMapBitField(compiler::Node* map); | 123 compiler::Node* LoadMapBitField(compiler::Node* map); |
120 // Load bit field 2 of a map. | 124 // Load bit field 2 of a map. |
121 compiler::Node* LoadMapBitField2(compiler::Node* map); | 125 compiler::Node* LoadMapBitField2(compiler::Node* map); |
122 // Load bit field 3 of a map. | 126 // Load bit field 3 of a map. |
123 compiler::Node* LoadMapBitField3(compiler::Node* map); | 127 compiler::Node* LoadMapBitField3(compiler::Node* map); |
124 // Load the instance type of a map. | 128 // Load the instance type of a map. |
125 compiler::Node* LoadMapInstanceType(compiler::Node* map); | 129 compiler::Node* LoadMapInstanceType(compiler::Node* map); |
126 // Load the instance descriptors of a map. | 130 // Load the instance descriptors of a map. |
127 compiler::Node* LoadMapDescriptors(compiler::Node* map); | 131 compiler::Node* LoadMapDescriptors(compiler::Node* map); |
128 // Load the prototype of a map. | 132 // Load the prototype of a map. |
129 compiler::Node* LoadMapPrototype(compiler::Node* map); | 133 compiler::Node* LoadMapPrototype(compiler::Node* map); |
| 134 // Load the instance size of a Map. |
| 135 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
130 | 136 |
131 // Load the hash field of a name. | 137 // Load the hash field of a name. |
132 compiler::Node* LoadNameHash(compiler::Node* name); | 138 compiler::Node* LoadNameHashField(compiler::Node* name); |
133 // Load the instance size of a Map. | 139 // Load the hash value of a name. If {if_hash_not_computed} label |
134 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 140 // is specified then it also checks if hash is actually computed. |
| 141 compiler::Node* LoadNameHash(compiler::Node* name, |
| 142 Label* if_hash_not_computed = nullptr); |
| 143 |
| 144 // Load length field of a String object. |
| 145 compiler::Node* LoadStringLength(compiler::Node* object); |
| 146 // Load value field of a JSValue object. |
| 147 compiler::Node* LoadJSValueValue(compiler::Node* object); |
135 | 148 |
136 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); | 149 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); |
137 | 150 |
138 // Load an array element from a FixedArray. | 151 // Load an array element from a FixedArray. |
139 compiler::Node* LoadFixedArrayElement( | 152 compiler::Node* LoadFixedArrayElement( |
140 compiler::Node* object, compiler::Node* int32_index, | 153 compiler::Node* object, compiler::Node* int32_index, |
141 int additional_offset = 0, | 154 int additional_offset = 0, |
142 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 155 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 156 // Load an array element from a FixedDoubleArray. |
| 157 compiler::Node* LoadFixedDoubleArrayElement( |
| 158 compiler::Node* object, compiler::Node* int32_index, |
| 159 MachineType machine_type, int additional_offset = 0, |
| 160 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
143 | 161 |
144 // Context manipulation | 162 // Context manipulation |
145 compiler::Node* LoadNativeContext(compiler::Node* context); | 163 compiler::Node* LoadNativeContext(compiler::Node* context); |
146 | 164 |
147 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, | 165 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, |
148 compiler::Node* native_context); | 166 compiler::Node* native_context); |
149 | 167 |
150 // Store the floating point value of a HeapNumber. | 168 // Store the floating point value of a HeapNumber. |
151 compiler::Node* StoreHeapNumberValue(compiler::Node* object, | 169 compiler::Node* StoreHeapNumberValue(compiler::Node* object, |
152 compiler::Node* value); | 170 compiler::Node* value); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 template <typename T> | 236 template <typename T> |
219 compiler::Node* BitFieldDecode(compiler::Node* word32) { | 237 compiler::Node* BitFieldDecode(compiler::Node* word32) { |
220 return BitFieldDecode(word32, T::kShift, T::kMask); | 238 return BitFieldDecode(word32, T::kShift, T::kMask); |
221 } | 239 } |
222 | 240 |
223 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, | 241 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, |
224 uint32_t mask); | 242 uint32_t mask); |
225 | 243 |
226 // Various building blocks for stubs doing property lookups. | 244 // Various building blocks for stubs doing property lookups. |
227 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, | 245 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, |
228 Label* if_keyisunique, Label* call_runtime); | 246 Label* if_keyisunique, Label* if_bailout); |
| 247 |
| 248 static const int kInlinedDictionaryProbes = 4; |
| 249 template <typename Dictionary> |
| 250 void NameDictionaryLookup(compiler::Node* dictionary, |
| 251 compiler::Node* unique_name, Label* if_found, |
| 252 Variable* var_entry, Label* if_not_found, |
| 253 int inlined_probes = kInlinedDictionaryProbes); |
| 254 |
| 255 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); |
| 256 |
| 257 template <typename Dictionary> |
| 258 void NumberDictionaryLookup(compiler::Node* dictionary, compiler::Node* key, |
| 259 Label* if_found, Variable* var_entry, |
| 260 Label* if_not_found); |
229 | 261 |
230 void TryLookupProperty(compiler::Node* object, compiler::Node* map, | 262 void TryLookupProperty(compiler::Node* object, compiler::Node* map, |
231 compiler::Node* instance_type, compiler::Node* name, | 263 compiler::Node* instance_type, |
232 Label* if_found, Label* if_not_found, | 264 compiler::Node* unique_name, Label* if_found, |
233 Label* call_runtime); | 265 Label* if_not_found, Label* if_bailout); |
234 | 266 |
235 void TryLookupElement(compiler::Node* object, compiler::Node* map, | 267 void TryLookupElement(compiler::Node* object, compiler::Node* map, |
236 compiler::Node* instance_type, compiler::Node* index, | 268 compiler::Node* instance_type, compiler::Node* index, |
237 Label* if_found, Label* if_not_found, | 269 Label* if_found, Label* if_not_found, |
238 Label* call_runtime); | 270 Label* if_bailout); |
239 | 271 |
240 // Instanceof helpers. | 272 // Instanceof helpers. |
241 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) | 273 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) |
242 compiler::Node* OrdinaryHasInstance(compiler::Node* context, | 274 compiler::Node* OrdinaryHasInstance(compiler::Node* context, |
243 compiler::Node* callable, | 275 compiler::Node* callable, |
244 compiler::Node* object); | 276 compiler::Node* object); |
245 | 277 |
246 private: | 278 private: |
247 compiler::Node* ElementOffsetFromIndex(compiler::Node* index, | 279 compiler::Node* ElementOffsetFromIndex(compiler::Node* index, |
248 ElementsKind kind, ParameterMode mode, | 280 ElementsKind kind, ParameterMode mode, |
249 int base_size = 0); | 281 int base_size = 0); |
250 | 282 |
251 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, | 283 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, |
252 AllocationFlags flags, | 284 AllocationFlags flags, |
253 compiler::Node* top_address, | 285 compiler::Node* top_address, |
254 compiler::Node* limit_address); | 286 compiler::Node* limit_address); |
255 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, | 287 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, |
256 AllocationFlags flags, | 288 AllocationFlags flags, |
257 compiler::Node* top_adddress, | 289 compiler::Node* top_adddress, |
258 compiler::Node* limit_address); | 290 compiler::Node* limit_address); |
259 | 291 |
260 static const int kElementLoopUnrollThreshold = 8; | 292 static const int kElementLoopUnrollThreshold = 8; |
261 }; | 293 }; |
262 | 294 |
263 } // namespace internal | 295 } // namespace internal |
264 } // namespace v8 | 296 } // namespace v8 |
265 | 297 |
266 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 298 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |