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 <functional> | 8 #include <functional> |
9 | 9 |
10 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 // Smi | HeapNumber operations. | 150 // Smi | HeapNumber operations. |
151 compiler::Node* NumberInc(compiler::Node* value); | 151 compiler::Node* NumberInc(compiler::Node* value); |
152 | 152 |
153 // Allocate an object of the given size. | 153 // Allocate an object of the given size. |
154 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); | 154 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); |
155 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); | 155 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); |
156 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); | 156 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); |
157 compiler::Node* InnerAllocate(compiler::Node* previous, | 157 compiler::Node* InnerAllocate(compiler::Node* previous, |
158 compiler::Node* offset); | 158 compiler::Node* offset); |
| 159 compiler::Node* IsRegularHeapObjectSize(compiler::Node* size); |
159 | 160 |
160 void Assert(compiler::Node* condition, const char* string = nullptr, | 161 void Assert(compiler::Node* condition, const char* string = nullptr, |
161 const char* file = nullptr, int line = 0); | 162 const char* file = nullptr, int line = 0); |
162 | 163 |
163 // Check a value for smi-ness | 164 // Check a value for smi-ness |
164 compiler::Node* TaggedIsSmi(compiler::Node* a); | 165 compiler::Node* TaggedIsSmi(compiler::Node* a); |
165 // Check that the value is a non-negative smi. | 166 // Check that the value is a non-negative smi. |
166 compiler::Node* WordIsPositiveSmi(compiler::Node* a); | 167 compiler::Node* WordIsPositiveSmi(compiler::Node* a); |
| 168 // Check that a word has a word-aligned address. |
| 169 compiler::Node* WordIsWordAligned(compiler::Node* word); |
167 | 170 |
168 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, | 171 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, |
169 Label* if_false) { | 172 Label* if_false) { |
170 Branch(SmiEqual(a, b), if_true, if_false); | 173 Branch(SmiEqual(a, b), if_true, if_false); |
171 } | 174 } |
172 | 175 |
173 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true, | 176 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true, |
174 Label* if_false) { | 177 Label* if_false) { |
175 Branch(SmiLessThan(a, b), if_true, if_false); | 178 Branch(SmiLessThan(a, b), if_true, if_false); |
176 } | 179 } |
(...skipping 15 matching lines...) Expand all Loading... |
192 | 195 |
193 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* lhs_map, | 196 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* lhs_map, |
194 compiler::Node* rhs, compiler::Node* rhs_map, | 197 compiler::Node* rhs, compiler::Node* rhs_map, |
195 Label* if_equal, Label* if_notequal); | 198 Label* if_equal, Label* if_notequal); |
196 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, | 199 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, |
197 Label* if_equal, Label* if_notequal) { | 200 Label* if_equal, Label* if_notequal) { |
198 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, | 201 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, |
199 if_notequal); | 202 if_notequal); |
200 } | 203 } |
201 | 204 |
| 205 void BranchIfJSReceiver(compiler::Node* object, Label* if_true, |
| 206 Label* if_false); |
| 207 void BranchIfJSObject(compiler::Node* object, Label* if_true, |
| 208 Label* if_false); |
| 209 |
202 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, | 210 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, |
203 Label* if_true, Label* if_false); | 211 Label* if_true, Label* if_false); |
204 | 212 |
205 // Load value from current frame by given offset in bytes. | 213 // Load value from current frame by given offset in bytes. |
206 compiler::Node* LoadFromFrame(int offset, | 214 compiler::Node* LoadFromFrame(int offset, |
207 MachineType rep = MachineType::AnyTagged()); | 215 MachineType rep = MachineType::AnyTagged()); |
208 // Load value from current parent frame by given offset in bytes. | 216 // Load value from current parent frame by given offset in bytes. |
209 compiler::Node* LoadFromParentFrame( | 217 compiler::Node* LoadFromParentFrame( |
210 int offset, MachineType rep = MachineType::AnyTagged()); | 218 int offset, MachineType rep = MachineType::AnyTagged()); |
211 | 219 |
(...skipping 15 matching lines...) Expand all Loading... |
227 compiler::Node* LoadAndUntagSmi(compiler::Node* base, int index); | 235 compiler::Node* LoadAndUntagSmi(compiler::Node* base, int index); |
228 // Load a SMI root, untag it, and convert to Word32. | 236 // Load a SMI root, untag it, and convert to Word32. |
229 compiler::Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index); | 237 compiler::Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index); |
230 | 238 |
231 // Load the floating point value of a HeapNumber. | 239 // Load the floating point value of a HeapNumber. |
232 compiler::Node* LoadHeapNumberValue(compiler::Node* object); | 240 compiler::Node* LoadHeapNumberValue(compiler::Node* object); |
233 // Load the Map of an HeapObject. | 241 // Load the Map of an HeapObject. |
234 compiler::Node* LoadMap(compiler::Node* object); | 242 compiler::Node* LoadMap(compiler::Node* object); |
235 // Load the instance type of an HeapObject. | 243 // Load the instance type of an HeapObject. |
236 compiler::Node* LoadInstanceType(compiler::Node* object); | 244 compiler::Node* LoadInstanceType(compiler::Node* object); |
| 245 // Compare the instance the type of the object against the provided one. |
| 246 compiler::Node* HasInstanceType(compiler::Node* object, InstanceType type); |
237 // Checks that given heap object has given instance type. | 247 // Checks that given heap object has given instance type. |
238 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); | 248 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); |
239 // Load the properties backing store of a JSObject. | 249 // Load the properties backing store of a JSObject. |
240 compiler::Node* LoadProperties(compiler::Node* object); | 250 compiler::Node* LoadProperties(compiler::Node* object); |
241 // Load the elements backing store of a JSObject. | 251 // Load the elements backing store of a JSObject. |
242 compiler::Node* LoadElements(compiler::Node* object); | 252 compiler::Node* LoadElements(compiler::Node* object); |
243 // Load the length of a JSArray instance. | 253 // Load the length of a JSArray instance. |
244 compiler::Node* LoadJSArrayLength(compiler::Node* array); | 254 compiler::Node* LoadJSArrayLength(compiler::Node* array); |
245 // Load the length of a fixed array base instance. | 255 // Load the length of a fixed array base instance. |
246 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); | 256 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); |
247 // Load the length of a fixed array base instance. | 257 // Load the length of a fixed array base instance. |
248 compiler::Node* LoadAndUntagFixedArrayBaseLength(compiler::Node* array); | 258 compiler::Node* LoadAndUntagFixedArrayBaseLength(compiler::Node* array); |
249 // Load the bit field of a Map. | 259 // Load the bit field of a Map. |
250 compiler::Node* LoadMapBitField(compiler::Node* map); | 260 compiler::Node* LoadMapBitField(compiler::Node* map); |
251 // Load bit field 2 of a map. | 261 // Load bit field 2 of a map. |
252 compiler::Node* LoadMapBitField2(compiler::Node* map); | 262 compiler::Node* LoadMapBitField2(compiler::Node* map); |
253 // Load bit field 3 of a map. | 263 // Load bit field 3 of a map. |
254 compiler::Node* LoadMapBitField3(compiler::Node* map); | 264 compiler::Node* LoadMapBitField3(compiler::Node* map); |
255 // Load the instance type of a map. | 265 // Load the instance type of a map. |
256 compiler::Node* LoadMapInstanceType(compiler::Node* map); | 266 compiler::Node* LoadMapInstanceType(compiler::Node* map); |
257 // Load the ElementsKind of a map. | 267 // Load the ElementsKind of a map. |
258 compiler::Node* LoadMapElementsKind(compiler::Node* map); | 268 compiler::Node* LoadMapElementsKind(compiler::Node* map); |
259 // Load the instance descriptors of a map. | 269 // Load the instance descriptors of a map. |
260 compiler::Node* LoadMapDescriptors(compiler::Node* map); | 270 compiler::Node* LoadMapDescriptors(compiler::Node* map); |
261 // Load the prototype of a map. | 271 // Load the prototype of a map. |
262 compiler::Node* LoadMapPrototype(compiler::Node* map); | 272 compiler::Node* LoadMapPrototype(compiler::Node* map); |
| 273 // Load the prototype info of a map. The result has to be checked if it is a |
| 274 // prototype info object or not. |
| 275 compiler::Node* LoadMapPrototypeInfo(compiler::Node* map, |
| 276 Label* if_has_no_proto_info); |
263 // Load the instance size of a Map. | 277 // Load the instance size of a Map. |
264 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 278 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
265 // Load the inobject properties count of a Map (valid only for JSObjects). | 279 // Load the inobject properties count of a Map (valid only for JSObjects). |
266 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); | 280 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); |
267 // Load the constructor function index of a Map (only for primitive maps). | 281 // Load the constructor function index of a Map (only for primitive maps). |
268 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); | 282 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); |
269 // Load the constructor of a Map (equivalent to Map::GetConstructor()). | 283 // Load the constructor of a Map (equivalent to Map::GetConstructor()). |
270 compiler::Node* LoadMapConstructor(compiler::Node* map); | 284 compiler::Node* LoadMapConstructor(compiler::Node* map); |
| 285 // Check whether the map is for an object with special properties, such as a |
| 286 // JSProxy or an object with interceptors. |
| 287 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); |
| 288 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); |
271 | 289 |
272 // Load the hash field of a name as an uint32 value. | 290 // Load the hash field of a name as an uint32 value. |
273 compiler::Node* LoadNameHashField(compiler::Node* name); | 291 compiler::Node* LoadNameHashField(compiler::Node* name); |
274 // Load the hash value of a name as an uint32 value. | 292 // Load the hash value of a name as an uint32 value. |
275 // If {if_hash_not_computed} label is specified then it also checks if | 293 // If {if_hash_not_computed} label is specified then it also checks if |
276 // hash is actually computed. | 294 // hash is actually computed. |
277 compiler::Node* LoadNameHash(compiler::Node* name, | 295 compiler::Node* LoadNameHash(compiler::Node* name, |
278 Label* if_hash_not_computed = nullptr); | 296 Label* if_hash_not_computed = nullptr); |
279 | 297 |
280 // Load length field of a String object. | 298 // Load length field of a String object. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // Store an array element to a FixedArray. | 361 // Store an array element to a FixedArray. |
344 compiler::Node* StoreFixedArrayElement( | 362 compiler::Node* StoreFixedArrayElement( |
345 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 363 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
346 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, | 364 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
347 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 365 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
348 | 366 |
349 compiler::Node* StoreFixedDoubleArrayElement( | 367 compiler::Node* StoreFixedDoubleArrayElement( |
350 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 368 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
351 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 369 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
352 | 370 |
| 371 void StoreFieldsNoWriteBarrier(compiler::Node* start_address, |
| 372 compiler::Node* end_address, |
| 373 compiler::Node* value); |
| 374 |
353 // Allocate a HeapNumber without initializing its value. | 375 // Allocate a HeapNumber without initializing its value. |
354 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); | 376 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); |
355 // Allocate a HeapNumber with a specific value. | 377 // Allocate a HeapNumber with a specific value. |
356 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, | 378 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, |
357 MutableMode mode = IMMUTABLE); | 379 MutableMode mode = IMMUTABLE); |
358 // Allocate a SeqOneByteString with the given length. | 380 // Allocate a SeqOneByteString with the given length. |
359 compiler::Node* AllocateSeqOneByteString(int length, | 381 compiler::Node* AllocateSeqOneByteString(int length, |
360 AllocationFlags flags = kNone); | 382 AllocationFlags flags = kNone); |
361 compiler::Node* AllocateSeqOneByteString( | 383 compiler::Node* AllocateSeqOneByteString( |
362 compiler::Node* context, compiler::Node* length, | 384 compiler::Node* context, compiler::Node* length, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 424 |
403 // Allocate a RegExpResult with the given length (the number of captures, | 425 // Allocate a RegExpResult with the given length (the number of captures, |
404 // including the match itself), index (the index where the match starts), | 426 // including the match itself), index (the index where the match starts), |
405 // and input string. |length| and |index| are expected to be tagged, and | 427 // and input string. |length| and |index| are expected to be tagged, and |
406 // |input| must be a string. | 428 // |input| must be a string. |
407 compiler::Node* AllocateRegExpResult(compiler::Node* context, | 429 compiler::Node* AllocateRegExpResult(compiler::Node* context, |
408 compiler::Node* length, | 430 compiler::Node* length, |
409 compiler::Node* index, | 431 compiler::Node* index, |
410 compiler::Node* input); | 432 compiler::Node* input); |
411 | 433 |
| 434 compiler::Node* AllocateJSObjectFromMap(compiler::Node* map, |
| 435 compiler::Node* properties = nullptr, |
| 436 compiler::Node* elements = nullptr); |
| 437 |
| 438 void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map, |
| 439 compiler::Node* size, |
| 440 compiler::Node* properties = nullptr, |
| 441 compiler::Node* elements = nullptr); |
| 442 |
| 443 void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map, |
| 444 compiler::Node* size, |
| 445 int start_offset = JSObject::kHeaderSize); |
| 446 |
412 // Allocate a JSArray without elements and initialize the header fields. | 447 // Allocate a JSArray without elements and initialize the header fields. |
413 compiler::Node* AllocateUninitializedJSArrayWithoutElements( | 448 compiler::Node* AllocateUninitializedJSArrayWithoutElements( |
414 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, | 449 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, |
415 compiler::Node* allocation_site); | 450 compiler::Node* allocation_site); |
416 // Allocate and return a JSArray with initialized header fields and its | 451 // Allocate and return a JSArray with initialized header fields and its |
417 // uninitialized elements. | 452 // uninitialized elements. |
418 // The ParameterMode argument is only used for the capacity parameter. | 453 // The ParameterMode argument is only used for the capacity parameter. |
419 std::pair<compiler::Node*, compiler::Node*> | 454 std::pair<compiler::Node*, compiler::Node*> |
420 AllocateUninitializedJSArrayWithElements( | 455 AllocateUninitializedJSArrayWithElements( |
421 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, | 456 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 static const int kElementLoopUnrollThreshold = 8; | 1088 static const int kElementLoopUnrollThreshold = 8; |
1054 }; | 1089 }; |
1055 | 1090 |
1056 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) | 1091 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
1057 | 1092 |
1058 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1093 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1059 | 1094 |
1060 } // namespace internal | 1095 } // namespace internal |
1061 } // namespace v8 | 1096 } // namespace v8 |
1062 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1097 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |