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