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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 Node* AllocateFixedArray(ElementsKind kind, Node* capacity, | 558 Node* AllocateFixedArray(ElementsKind kind, Node* capacity, |
559 ParameterMode mode = INTPTR_PARAMETERS, | 559 ParameterMode mode = INTPTR_PARAMETERS, |
560 AllocationFlags flags = kNone); | 560 AllocationFlags flags = kNone); |
561 | 561 |
562 // Perform CreateArrayIterator (ES6 #sec-createarrayiterator). | 562 // Perform CreateArrayIterator (ES6 #sec-createarrayiterator). |
563 Node* CreateArrayIterator(Node* array, Node* array_map, Node* array_type, | 563 Node* CreateArrayIterator(Node* array, Node* array_map, Node* array_type, |
564 Node* context, IterationKind mode); | 564 Node* context, IterationKind mode); |
565 | 565 |
566 Node* AllocateJSArrayIterator(Node* array, Node* array_map, Node* map); | 566 Node* AllocateJSArrayIterator(Node* array, Node* array_map, Node* map); |
567 | 567 |
| 568 Node* AllocateJSIteratorResult(Node* context, Node* value, Node* done); |
| 569 Node* AllocateJSIteratorResult(Node* context, Node* value, bool done) { |
| 570 return AllocateJSIteratorResult(context, value, BooleanConstant(done)); |
| 571 } |
| 572 |
568 void FillFixedArrayWithValue(ElementsKind kind, Node* array, Node* from_index, | 573 void FillFixedArrayWithValue(ElementsKind kind, Node* array, Node* from_index, |
569 Node* to_index, | 574 Node* to_index, |
570 Heap::RootListIndex value_root_index, | 575 Heap::RootListIndex value_root_index, |
571 ParameterMode mode = INTPTR_PARAMETERS); | 576 ParameterMode mode = INTPTR_PARAMETERS); |
572 | 577 |
573 // Copies all elements from |from_array| of |length| size to | 578 // Copies all elements from |from_array| of |length| size to |
574 // |to_array| of the same size respecting the elements kind. | 579 // |to_array| of the same size respecting the elements kind. |
575 void CopyFixedArrayElements( | 580 void CopyFixedArrayElements( |
576 ElementsKind kind, Node* from_array, Node* to_array, Node* length, | 581 ElementsKind kind, Node* from_array, Node* to_array, Node* length, |
577 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, | 582 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 | 1135 |
1131 Node* Typeof(Node* value, Node* context); | 1136 Node* Typeof(Node* value, Node* context); |
1132 | 1137 |
1133 Node* GetSuperConstructor(Node* value, Node* context); | 1138 Node* GetSuperConstructor(Node* value, Node* context); |
1134 | 1139 |
1135 Node* InstanceOf(Node* object, Node* callable, Node* context); | 1140 Node* InstanceOf(Node* object, Node* callable, Node* context); |
1136 | 1141 |
1137 // Debug helpers | 1142 // Debug helpers |
1138 Node* IsDebugActive(); | 1143 Node* IsDebugActive(); |
1139 | 1144 |
| 1145 // Useful tools for PrintF-style debugging CSA builtins. |
| 1146 void ReleasePrint(const char* c_str) { |
| 1147 std::string std_str(c_str); |
| 1148 std_str += '\n'; |
| 1149 Handle<String> str = |
| 1150 factory()->NewStringFromAsciiChecked(std_str.c_str(), TENURED); |
| 1151 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), HeapConstant(str)); |
| 1152 } |
| 1153 |
| 1154 void ReleaseDebugPrint(Node* object) { |
| 1155 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), object); |
| 1156 } |
| 1157 |
| 1158 void Print(const char* c_str) { |
| 1159 #ifdef DEBUG |
| 1160 ReleasePrint(c_str); |
| 1161 #endif |
| 1162 } |
| 1163 |
| 1164 void DebugPrint(Node* object) { |
| 1165 #ifdef DEBUG |
| 1166 ReleaseDebugPrint(object); |
| 1167 #endif |
| 1168 } |
| 1169 |
1140 // TypedArray/ArrayBuffer helpers | 1170 // TypedArray/ArrayBuffer helpers |
1141 Node* IsDetachedBuffer(Node* buffer); | 1171 Node* IsDetachedBuffer(Node* buffer); |
1142 | 1172 |
1143 Node* ElementOffsetFromIndex(Node* index, ElementsKind kind, | 1173 Node* ElementOffsetFromIndex(Node* index, ElementsKind kind, |
1144 ParameterMode mode, int base_size = 0); | 1174 ParameterMode mode, int base_size = 0); |
1145 | 1175 |
1146 Node* AllocateFunctionWithMapAndContext(Node* map, Node* shared_info, | 1176 Node* AllocateFunctionWithMapAndContext(Node* map, Node* shared_info, |
1147 Node* context); | 1177 Node* context); |
1148 | 1178 |
1149 // Promise helpers | 1179 // Promise helpers |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 } | 1303 } |
1274 #else | 1304 #else |
1275 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1305 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
1276 #endif | 1306 #endif |
1277 | 1307 |
1278 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1308 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1279 | 1309 |
1280 } // namespace internal | 1310 } // namespace internal |
1281 } // namespace v8 | 1311 } // namespace v8 |
1282 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1312 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |