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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, | 203 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, |
204 Label* if_equal, Label* if_notequal) { | 204 Label* if_equal, Label* if_notequal) { |
205 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, | 205 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, |
206 if_notequal); | 206 if_notequal); |
207 } | 207 } |
208 | 208 |
209 void BranchIfJSReceiver(compiler::Node* object, Label* if_true, | 209 void BranchIfJSReceiver(compiler::Node* object, Label* if_true, |
210 Label* if_false); | 210 Label* if_false); |
211 void BranchIfJSObject(compiler::Node* object, Label* if_true, | 211 void BranchIfJSObject(compiler::Node* object, Label* if_true, |
212 Label* if_false); | 212 Label* if_false); |
213 | |
214 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, | 213 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, |
215 Label* if_true, Label* if_false); | 214 Label* if_true, Label* if_false); |
216 | 215 |
217 // Load value from current frame by given offset in bytes. | 216 // Load value from current frame by given offset in bytes. |
218 compiler::Node* LoadFromFrame(int offset, | 217 compiler::Node* LoadFromFrame(int offset, |
219 MachineType rep = MachineType::AnyTagged()); | 218 MachineType rep = MachineType::AnyTagged()); |
220 // Load value from current parent frame by given offset in bytes. | 219 // Load value from current parent frame by given offset in bytes. |
221 compiler::Node* LoadFromParentFrame( | 220 compiler::Node* LoadFromParentFrame( |
222 int offset, MachineType rep = MachineType::AnyTagged()); | 221 int offset, MachineType rep = MachineType::AnyTagged()); |
223 | 222 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 compiler::Node* LoadMapPrototypeInfo(compiler::Node* map, | 278 compiler::Node* LoadMapPrototypeInfo(compiler::Node* map, |
280 Label* if_has_no_proto_info); | 279 Label* if_has_no_proto_info); |
281 // Load the instance size of a Map. | 280 // Load the instance size of a Map. |
282 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 281 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
283 // Load the inobject properties count of a Map (valid only for JSObjects). | 282 // Load the inobject properties count of a Map (valid only for JSObjects). |
284 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); | 283 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); |
285 // Load the constructor function index of a Map (only for primitive maps). | 284 // Load the constructor function index of a Map (only for primitive maps). |
286 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); | 285 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); |
287 // Load the constructor of a Map (equivalent to Map::GetConstructor()). | 286 // Load the constructor of a Map (equivalent to Map::GetConstructor()). |
288 compiler::Node* LoadMapConstructor(compiler::Node* map); | 287 compiler::Node* LoadMapConstructor(compiler::Node* map); |
289 // Check whether the map is for an object with special properties, such as a | |
290 // JSProxy or an object with interceptors. | |
291 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); | |
292 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); | |
293 // Check if the map is set for slow properties. | 288 // Check if the map is set for slow properties. |
294 compiler::Node* IsDictionaryMap(compiler::Node* map); | 289 compiler::Node* IsDictionaryMap(compiler::Node* map); |
295 | 290 |
296 // Load the hash field of a name as an uint32 value. | 291 // Load the hash field of a name as an uint32 value. |
297 compiler::Node* LoadNameHashField(compiler::Node* name); | 292 compiler::Node* LoadNameHashField(compiler::Node* name); |
298 // Load the hash value of a name as an uint32 value. | 293 // Load the hash value of a name as an uint32 value. |
299 // If {if_hash_not_computed} label is specified then it also checks if | 294 // If {if_hash_not_computed} label is specified then it also checks if |
300 // hash is actually computed. | 295 // hash is actually computed. |
301 compiler::Node* LoadNameHash(compiler::Node* name, | 296 compiler::Node* LoadNameHash(compiler::Node* name, |
302 Label* if_hash_not_computed = nullptr); | 297 Label* if_hash_not_computed = nullptr); |
303 | 298 |
304 // Load length field of a String object. | 299 // Load length field of a String object. |
305 compiler::Node* LoadStringLength(compiler::Node* object); | 300 compiler::Node* LoadStringLength(compiler::Node* object); |
306 // Load value field of a JSValue object. | 301 // Load value field of a JSValue object. |
307 compiler::Node* LoadJSValueValue(compiler::Node* object); | 302 compiler::Node* LoadJSValueValue(compiler::Node* object); |
308 // Load value field of a WeakCell object. | 303 // Load value field of a WeakCell object. |
| 304 compiler::Node* LoadWeakCellValueUnchecked(compiler::Node* weak_cell); |
309 compiler::Node* LoadWeakCellValue(compiler::Node* weak_cell, | 305 compiler::Node* LoadWeakCellValue(compiler::Node* weak_cell, |
310 Label* if_cleared = nullptr); | 306 Label* if_cleared = nullptr); |
311 | 307 |
312 // Load an array element from a FixedArray. | 308 // Load an array element from a FixedArray. |
313 compiler::Node* LoadFixedArrayElement( | 309 compiler::Node* LoadFixedArrayElement( |
314 compiler::Node* object, compiler::Node* index, int additional_offset = 0, | 310 compiler::Node* object, compiler::Node* index, int additional_offset = 0, |
315 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 311 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
316 // Load an array element from a FixedArray, untag it and return it as Word32. | 312 // Load an array element from a FixedArray, untag it and return it as Word32. |
317 compiler::Node* LoadAndUntagToWord32FixedArrayElement( | 313 compiler::Node* LoadAndUntagToWord32FixedArrayElement( |
318 compiler::Node* object, compiler::Node* index, int additional_offset = 0, | 314 compiler::Node* object, compiler::Node* index, int additional_offset = 0, |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 char const* method_name); | 598 char const* method_name); |
603 | 599 |
604 // Throws a TypeError for {method_name} if {value} is not of the given | 600 // Throws a TypeError for {method_name} if {value} is not of the given |
605 // instance type. Returns {value}'s map. | 601 // instance type. Returns {value}'s map. |
606 compiler::Node* ThrowIfNotInstanceType(compiler::Node* context, | 602 compiler::Node* ThrowIfNotInstanceType(compiler::Node* context, |
607 compiler::Node* value, | 603 compiler::Node* value, |
608 InstanceType instance_type, | 604 InstanceType instance_type, |
609 char const* method_name); | 605 char const* method_name); |
610 | 606 |
611 // Type checks. | 607 // Type checks. |
| 608 // Check whether the map is for an object with special properties, such as a |
| 609 // JSProxy or an object with interceptors. |
| 610 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); |
| 611 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); |
612 compiler::Node* IsStringInstanceType(compiler::Node* instance_type); | 612 compiler::Node* IsStringInstanceType(compiler::Node* instance_type); |
| 613 compiler::Node* IsString(compiler::Node* object); |
| 614 compiler::Node* IsJSObject(compiler::Node* object); |
613 compiler::Node* IsJSReceiverInstanceType(compiler::Node* instance_type); | 615 compiler::Node* IsJSReceiverInstanceType(compiler::Node* instance_type); |
614 | 616 compiler::Node* IsJSReceiver(compiler::Node* object); |
| 617 compiler::Node* IsMap(compiler::Node* object); |
615 compiler::Node* IsCallableMap(compiler::Node* map); | 618 compiler::Node* IsCallableMap(compiler::Node* map); |
| 619 compiler::Node* IsName(compiler::Node* object); |
| 620 compiler::Node* IsJSValue(compiler::Node* object); |
| 621 compiler::Node* IsJSArray(compiler::Node* object); |
| 622 compiler::Node* IsNativeContext(compiler::Node* object); |
| 623 compiler::Node* IsWeakCell(compiler::Node* object); |
| 624 compiler::Node* IsFixedDoubleArray(compiler::Node* object); |
| 625 compiler::Node* IsHashTable(compiler::Node* object); |
| 626 compiler::Node* IsDictionary(compiler::Node* object); |
| 627 compiler::Node* IsUnseededNumberDictionary(compiler::Node* object); |
616 | 628 |
617 // String helpers. | 629 // String helpers. |
618 // Load a character from a String (might flatten a ConsString). | 630 // Load a character from a String (might flatten a ConsString). |
619 compiler::Node* StringCharCodeAt(compiler::Node* string, | 631 compiler::Node* StringCharCodeAt(compiler::Node* string, |
620 compiler::Node* smi_index); | 632 compiler::Node* smi_index); |
621 // Return the single character string with only {code}. | 633 // Return the single character string with only {code}. |
622 compiler::Node* StringFromCharCode(compiler::Node* code); | 634 compiler::Node* StringFromCharCode(compiler::Node* code); |
623 // Return a new string object which holds a substring containing the range | 635 // Return a new string object which holds a substring containing the range |
624 // [from,to[ of string. |from| and |to| are expected to be tagged. | 636 // [from,to[ of string. |from| and |to| are expected to be tagged. |
625 compiler::Node* SubString(compiler::Node* context, compiler::Node* string, | 637 compiler::Node* SubString(compiler::Node* context, compiler::Node* string, |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1174 |
1163 compiler::Node* SmiShiftBitsConstant(); | 1175 compiler::Node* SmiShiftBitsConstant(); |
1164 | 1176 |
1165 // Emits keyed sloppy arguments load if the |value| is nullptr or store | 1177 // Emits keyed sloppy arguments load if the |value| is nullptr or store |
1166 // otherwise. Returns either the loaded value or |value|. | 1178 // otherwise. Returns either the loaded value or |value|. |
1167 compiler::Node* EmitKeyedSloppyArguments(compiler::Node* receiver, | 1179 compiler::Node* EmitKeyedSloppyArguments(compiler::Node* receiver, |
1168 compiler::Node* key, | 1180 compiler::Node* key, |
1169 compiler::Node* value, | 1181 compiler::Node* value, |
1170 Label* bailout); | 1182 Label* bailout); |
1171 | 1183 |
| 1184 compiler::Node* AllocateSlicedString(Heap::RootListIndex map_root_index, |
| 1185 compiler::Node* length, |
| 1186 compiler::Node* parent, |
| 1187 compiler::Node* offset); |
| 1188 |
| 1189 compiler::Node* AllocateConsString(Heap::RootListIndex map_root_index, |
| 1190 compiler::Node* length, |
| 1191 compiler::Node* first, |
| 1192 compiler::Node* second, |
| 1193 AllocationFlags flags); |
| 1194 |
1172 static const int kElementLoopUnrollThreshold = 8; | 1195 static const int kElementLoopUnrollThreshold = 8; |
1173 }; | 1196 }; |
1174 | 1197 |
1175 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) | 1198 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
| 1199 #ifdef ENABLE_SLOW_DCHECKS |
| 1200 #define CSA_SLOW_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
| 1201 #else |
| 1202 #define CSA_SLOW_ASSERT(x) |
| 1203 #endif |
1176 | 1204 |
1177 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1205 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1178 | 1206 |
1179 } // namespace internal | 1207 } // namespace internal |
1180 } // namespace v8 | 1208 } // namespace v8 |
1181 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1209 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |