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" |
11 #include "src/objects.h" | 11 #include "src/objects.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class CallInterfaceDescriptor; | 16 class CallInterfaceDescriptor; |
17 class StatsCounter; | 17 class StatsCounter; |
18 class StubCache; | 18 class StubCache; |
19 | 19 |
20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; | 20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
21 | 21 |
| 22 enum class IterationKind { kKeys, kValues, kEntries }; |
| 23 |
22 #define HEAP_CONSTANT_LIST(V) \ | 24 #define HEAP_CONSTANT_LIST(V) \ |
23 V(BooleanMap, BooleanMap) \ | 25 V(BooleanMap, BooleanMap) \ |
24 V(empty_string, EmptyString) \ | 26 V(empty_string, EmptyString) \ |
25 V(EmptyFixedArray, EmptyFixedArray) \ | 27 V(EmptyFixedArray, EmptyFixedArray) \ |
26 V(FalseValue, False) \ | 28 V(FalseValue, False) \ |
27 V(FixedArrayMap, FixedArrayMap) \ | 29 V(FixedArrayMap, FixedArrayMap) \ |
28 V(FixedCOWArrayMap, FixedCOWArrayMap) \ | 30 V(FixedCOWArrayMap, FixedCOWArrayMap) \ |
29 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ | 31 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ |
30 V(HeapNumberMap, HeapNumberMap) \ | 32 V(HeapNumberMap, HeapNumberMap) \ |
31 V(MinusZeroValue, MinusZero) \ | 33 V(MinusZeroValue, MinusZero) \ |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b); | 135 compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b); |
134 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b); | 136 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b); |
135 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi. | 137 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi. |
136 compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b); | 138 compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b); |
137 // Computes a * b for Smi inputs a and b; result is not necessarily a Smi. | 139 // Computes a * b for Smi inputs a and b; result is not necessarily a Smi. |
138 compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b); | 140 compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b); |
139 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) { | 141 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) { |
140 return WordOr(a, b); | 142 return WordOr(a, b); |
141 } | 143 } |
142 | 144 |
| 145 // Smi | HeapNumber operations. |
| 146 compiler::Node* NumberInc(compiler::Node* value); |
| 147 |
143 // Allocate an object of the given size. | 148 // Allocate an object of the given size. |
144 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); | 149 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); |
145 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); | 150 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); |
146 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); | 151 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); |
147 compiler::Node* InnerAllocate(compiler::Node* previous, | 152 compiler::Node* InnerAllocate(compiler::Node* previous, |
148 compiler::Node* offset); | 153 compiler::Node* offset); |
149 | 154 |
150 void Assert(compiler::Node* condition); | 155 void Assert(compiler::Node* condition); |
151 | 156 |
152 // Check a value for smi-ness | 157 // Check a value for smi-ness |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 int additional_offset = 0, | 293 int additional_offset = 0, |
289 ParameterMode parameter_mode = INTEGER_PARAMETERS, | 294 ParameterMode parameter_mode = INTEGER_PARAMETERS, |
290 Label* if_hole = nullptr); | 295 Label* if_hole = nullptr); |
291 | 296 |
292 // Load Float64 value by |base| + |offset| address. If the value is a double | 297 // Load Float64 value by |base| + |offset| address. If the value is a double |
293 // hole then jump to |if_hole|. If |machine_type| is None then only the hole | 298 // hole then jump to |if_hole|. If |machine_type| is None then only the hole |
294 // check is generated. | 299 // check is generated. |
295 compiler::Node* LoadDoubleWithHoleCheck( | 300 compiler::Node* LoadDoubleWithHoleCheck( |
296 compiler::Node* base, compiler::Node* offset, Label* if_hole, | 301 compiler::Node* base, compiler::Node* offset, Label* if_hole, |
297 MachineType machine_type = MachineType::Float64()); | 302 MachineType machine_type = MachineType::Float64()); |
| 303 compiler::Node* LoadFixedTypedArrayElement( |
| 304 compiler::Node* data_pointer, compiler::Node* index_node, |
| 305 ElementsKind elements_kind, |
| 306 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
298 | 307 |
299 // Context manipulation | 308 // Context manipulation |
300 compiler::Node* LoadContextElement(compiler::Node* context, int slot_index); | 309 compiler::Node* LoadContextElement(compiler::Node* context, int slot_index); |
301 compiler::Node* StoreContextElement(compiler::Node* context, int slot_index, | 310 compiler::Node* StoreContextElement(compiler::Node* context, int slot_index, |
302 compiler::Node* value); | 311 compiler::Node* value); |
303 compiler::Node* LoadNativeContext(compiler::Node* context); | 312 compiler::Node* LoadNativeContext(compiler::Node* context); |
304 | 313 |
305 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, | 314 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, |
306 compiler::Node* native_context); | 315 compiler::Node* native_context); |
307 | 316 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 compiler::Node* AllocateJSArray( | 408 compiler::Node* AllocateJSArray( |
400 ElementsKind kind, compiler::Node* array_map, compiler::Node* capacity, | 409 ElementsKind kind, compiler::Node* array_map, compiler::Node* capacity, |
401 compiler::Node* length, compiler::Node* allocation_site = nullptr, | 410 compiler::Node* length, compiler::Node* allocation_site = nullptr, |
402 ParameterMode capacity_mode = INTEGER_PARAMETERS); | 411 ParameterMode capacity_mode = INTEGER_PARAMETERS); |
403 | 412 |
404 compiler::Node* AllocateFixedArray(ElementsKind kind, | 413 compiler::Node* AllocateFixedArray(ElementsKind kind, |
405 compiler::Node* capacity, | 414 compiler::Node* capacity, |
406 ParameterMode mode = INTEGER_PARAMETERS, | 415 ParameterMode mode = INTEGER_PARAMETERS, |
407 AllocationFlags flags = kNone); | 416 AllocationFlags flags = kNone); |
408 | 417 |
| 418 // Perform CreateArrayIterator (ES6 #sec-createarrayiterator). |
| 419 compiler::Node* CreateArrayIterator(compiler::Node* array, |
| 420 compiler::Node* array_map, |
| 421 compiler::Node* array_type, |
| 422 compiler::Node* context, |
| 423 IterationKind mode); |
| 424 |
| 425 compiler::Node* AllocateJSArrayIterator(compiler::Node* array, |
| 426 compiler::Node* array_map, |
| 427 compiler::Node* map); |
| 428 compiler::Node* AllocateJSTypedArrayIterator(compiler::Node* array, |
| 429 compiler::Node* map); |
| 430 |
409 void FillFixedArrayWithValue(ElementsKind kind, compiler::Node* array, | 431 void FillFixedArrayWithValue(ElementsKind kind, compiler::Node* array, |
410 compiler::Node* from_index, | 432 compiler::Node* from_index, |
411 compiler::Node* to_index, | 433 compiler::Node* to_index, |
412 Heap::RootListIndex value_root_index, | 434 Heap::RootListIndex value_root_index, |
413 ParameterMode mode = INTEGER_PARAMETERS); | 435 ParameterMode mode = INTEGER_PARAMETERS); |
414 | 436 |
415 // Copies all elements from |from_array| of |length| size to | 437 // Copies all elements from |from_array| of |length| size to |
416 // |to_array| of the same size respecting the elements kind. | 438 // |to_array| of the same size respecting the elements kind. |
417 void CopyFixedArrayElements( | 439 void CopyFixedArrayElements( |
418 ElementsKind kind, compiler::Node* from_array, compiler::Node* to_array, | 440 ElementsKind kind, compiler::Node* from_array, compiler::Node* to_array, |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 Label* bailout); | 1010 Label* bailout); |
989 | 1011 |
990 static const int kElementLoopUnrollThreshold = 8; | 1012 static const int kElementLoopUnrollThreshold = 8; |
991 }; | 1013 }; |
992 | 1014 |
993 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1015 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
994 | 1016 |
995 } // namespace internal | 1017 } // namespace internal |
996 } // namespace v8 | 1018 } // namespace v8 |
997 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1019 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |