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