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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b); | 133 compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b); |
132 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b); | 134 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b); |
133 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi. | 135 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi. |
134 compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b); | 136 compiler::Node* SmiMod(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* SmiMul(compiler::Node* a, compiler::Node* b); | 138 compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b); |
137 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) { | 139 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) { |
138 return WordOr(a, b); | 140 return WordOr(a, b); |
139 } | 141 } |
140 | 142 |
| 143 // Smi | HeapNumber operations. |
| 144 compiler::Node* NumberInc(compiler::Node* value); |
| 145 |
141 // Allocate an object of the given size. | 146 // Allocate an object of the given size. |
142 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); | 147 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); |
143 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); | 148 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); |
144 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); | 149 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); |
145 compiler::Node* InnerAllocate(compiler::Node* previous, | 150 compiler::Node* InnerAllocate(compiler::Node* previous, |
146 compiler::Node* offset); | 151 compiler::Node* offset); |
147 | 152 |
148 void Assert(compiler::Node* condition); | 153 void Assert(compiler::Node* condition); |
149 | 154 |
150 // Check a value for smi-ness | 155 // Check a value for smi-ness |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 int additional_offset = 0, | 291 int additional_offset = 0, |
287 ParameterMode parameter_mode = INTEGER_PARAMETERS, | 292 ParameterMode parameter_mode = INTEGER_PARAMETERS, |
288 Label* if_hole = nullptr); | 293 Label* if_hole = nullptr); |
289 | 294 |
290 // Load Float64 value by |base| + |offset| address. If the value is a double | 295 // Load Float64 value by |base| + |offset| address. If the value is a double |
291 // hole then jump to |if_hole|. If |machine_type| is None then only the hole | 296 // hole then jump to |if_hole|. If |machine_type| is None then only the hole |
292 // check is generated. | 297 // check is generated. |
293 compiler::Node* LoadDoubleWithHoleCheck( | 298 compiler::Node* LoadDoubleWithHoleCheck( |
294 compiler::Node* base, compiler::Node* offset, Label* if_hole, | 299 compiler::Node* base, compiler::Node* offset, Label* if_hole, |
295 MachineType machine_type = MachineType::Float64()); | 300 MachineType machine_type = MachineType::Float64()); |
| 301 compiler::Node* LoadFixedTypedArrayElement( |
| 302 compiler::Node* data_pointer, compiler::Node* index_node, |
| 303 ElementsKind elements_kind, |
| 304 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
296 | 305 |
297 // Context manipulation | 306 // Context manipulation |
298 compiler::Node* LoadContextElement(compiler::Node* context, int slot_index); | 307 compiler::Node* LoadContextElement(compiler::Node* context, int slot_index); |
299 compiler::Node* StoreContextElement(compiler::Node* context, int slot_index, | 308 compiler::Node* StoreContextElement(compiler::Node* context, int slot_index, |
300 compiler::Node* value); | 309 compiler::Node* value); |
301 compiler::Node* LoadNativeContext(compiler::Node* context); | 310 compiler::Node* LoadNativeContext(compiler::Node* context); |
302 | 311 |
303 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, | 312 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, |
304 compiler::Node* native_context); | 313 compiler::Node* native_context); |
305 | 314 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 compiler::Node* AllocateJSArray( | 406 compiler::Node* AllocateJSArray( |
398 ElementsKind kind, compiler::Node* array_map, compiler::Node* capacity, | 407 ElementsKind kind, compiler::Node* array_map, compiler::Node* capacity, |
399 compiler::Node* length, compiler::Node* allocation_site = nullptr, | 408 compiler::Node* length, compiler::Node* allocation_site = nullptr, |
400 ParameterMode capacity_mode = INTEGER_PARAMETERS); | 409 ParameterMode capacity_mode = INTEGER_PARAMETERS); |
401 | 410 |
402 compiler::Node* AllocateFixedArray(ElementsKind kind, | 411 compiler::Node* AllocateFixedArray(ElementsKind kind, |
403 compiler::Node* capacity, | 412 compiler::Node* capacity, |
404 ParameterMode mode = INTEGER_PARAMETERS, | 413 ParameterMode mode = INTEGER_PARAMETERS, |
405 AllocationFlags flags = kNone); | 414 AllocationFlags flags = kNone); |
406 | 415 |
| 416 // Perform CreateArrayIterator (ES6 #sec-createarrayiterator). |
| 417 compiler::Node* CreateArrayIterator(compiler::Node* array, |
| 418 compiler::Node* array_map, |
| 419 compiler::Node* array_type, |
| 420 compiler::Node* context, |
| 421 IterationKind mode); |
| 422 |
| 423 compiler::Node* AllocateJSArrayIterator(compiler::Node* array, |
| 424 compiler::Node* array_map, |
| 425 compiler::Node* map); |
| 426 compiler::Node* AllocateJSTypedArrayIterator(compiler::Node* array, |
| 427 compiler::Node* map); |
| 428 |
407 void FillFixedArrayWithValue(ElementsKind kind, compiler::Node* array, | 429 void FillFixedArrayWithValue(ElementsKind kind, compiler::Node* array, |
408 compiler::Node* from_index, | 430 compiler::Node* from_index, |
409 compiler::Node* to_index, | 431 compiler::Node* to_index, |
410 Heap::RootListIndex value_root_index, | 432 Heap::RootListIndex value_root_index, |
411 ParameterMode mode = INTEGER_PARAMETERS); | 433 ParameterMode mode = INTEGER_PARAMETERS); |
412 | 434 |
413 // Copies all elements from |from_array| of |length| size to | 435 // Copies all elements from |from_array| of |length| size to |
414 // |to_array| of the same size respecting the elements kind. | 436 // |to_array| of the same size respecting the elements kind. |
415 void CopyFixedArrayElements( | 437 void CopyFixedArrayElements( |
416 ElementsKind kind, compiler::Node* from_array, compiler::Node* to_array, | 438 ElementsKind kind, compiler::Node* from_array, compiler::Node* to_array, |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 Label* bailout); | 1008 Label* bailout); |
987 | 1009 |
988 static const int kElementLoopUnrollThreshold = 8; | 1010 static const int kElementLoopUnrollThreshold = 8; |
989 }; | 1011 }; |
990 | 1012 |
991 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1013 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
992 | 1014 |
993 } // namespace internal | 1015 } // namespace internal |
994 } // namespace v8 | 1016 } // namespace v8 |
995 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1017 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |