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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 | 1101 |
1102 compiler::Node* Typeof(compiler::Node* value, compiler::Node* context); | 1102 compiler::Node* Typeof(compiler::Node* value, compiler::Node* context); |
1103 | 1103 |
1104 compiler::Node* InstanceOf(compiler::Node* object, compiler::Node* callable, | 1104 compiler::Node* InstanceOf(compiler::Node* object, compiler::Node* callable, |
1105 compiler::Node* context); | 1105 compiler::Node* context); |
1106 | 1106 |
1107 // TypedArray/ArrayBuffer helpers | 1107 // TypedArray/ArrayBuffer helpers |
1108 compiler::Node* IsDetachedBuffer(compiler::Node* buffer); | 1108 compiler::Node* IsDetachedBuffer(compiler::Node* buffer); |
1109 | 1109 |
1110 private: | 1110 private: |
| 1111 friend class CodeStubArguments; |
| 1112 |
1111 enum ElementSupport { kOnlyProperties, kSupportElements }; | 1113 enum ElementSupport { kOnlyProperties, kSupportElements }; |
1112 | 1114 |
1113 void DescriptorLookupLinear(compiler::Node* unique_name, | 1115 void DescriptorLookupLinear(compiler::Node* unique_name, |
1114 compiler::Node* descriptors, compiler::Node* nof, | 1116 compiler::Node* descriptors, compiler::Node* nof, |
1115 Label* if_found, Variable* var_name_index, | 1117 Label* if_found, Variable* var_name_index, |
1116 Label* if_not_found); | 1118 Label* if_not_found); |
1117 compiler::Node* CallGetterIfAccessor(compiler::Node* value, | 1119 compiler::Node* CallGetterIfAccessor(compiler::Node* value, |
1118 compiler::Node* details, | 1120 compiler::Node* details, |
1119 compiler::Node* context, | 1121 compiler::Node* context, |
1120 compiler::Node* receiver, | 1122 compiler::Node* receiver, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 | 1203 |
1202 compiler::Node* AllocateConsString(Heap::RootListIndex map_root_index, | 1204 compiler::Node* AllocateConsString(Heap::RootListIndex map_root_index, |
1203 compiler::Node* length, | 1205 compiler::Node* length, |
1204 compiler::Node* first, | 1206 compiler::Node* first, |
1205 compiler::Node* second, | 1207 compiler::Node* second, |
1206 AllocationFlags flags); | 1208 AllocationFlags flags); |
1207 | 1209 |
1208 static const int kElementLoopUnrollThreshold = 8; | 1210 static const int kElementLoopUnrollThreshold = 8; |
1209 }; | 1211 }; |
1210 | 1212 |
| 1213 class CodeStubArguments { |
| 1214 public: |
| 1215 // |argc| specifies the number of arguments passed to the builtin excluding |
| 1216 // the receiver. |
| 1217 CodeStubArguments(CodeStubAssembler* assembler, compiler::Node* argc, |
| 1218 CodeStubAssembler::ParameterMode mode = |
| 1219 CodeStubAssembler::INTPTR_PARAMETERS); |
| 1220 |
| 1221 compiler::Node* GetReceiver(); |
| 1222 |
| 1223 // |index| is zero-based and does not include the receiver |
| 1224 compiler::Node* AtIndex(compiler::Node* index, |
| 1225 CodeStubAssembler::ParameterMode mode = |
| 1226 CodeStubAssembler::INTPTR_PARAMETERS); |
| 1227 |
| 1228 compiler::Node* AtIndex(int index); |
| 1229 |
| 1230 typedef std::function<void(CodeStubAssembler* assembler, compiler::Node* arg)> |
| 1231 ForEachBodyFunction; |
| 1232 |
| 1233 // Iteration doesn't include the receiver. |first| and |last| are zero-based. |
| 1234 void ForEach(ForEachBodyFunction body, compiler::Node* first = nullptr, |
| 1235 compiler::Node* last = nullptr, |
| 1236 CodeStubAssembler::ParameterMode mode = |
| 1237 CodeStubAssembler::INTPTR_PARAMETERS) { |
| 1238 CodeStubAssembler::VariableList list(0, assembler_->zone()); |
| 1239 ForEach(list, body, first, last); |
| 1240 } |
| 1241 |
| 1242 // Iteration doesn't include the receiver. |first| and |last| are zero-based. |
| 1243 void ForEach(const CodeStubAssembler::VariableList& vars, |
| 1244 ForEachBodyFunction body, compiler::Node* first = nullptr, |
| 1245 compiler::Node* last = nullptr, |
| 1246 CodeStubAssembler::ParameterMode mode = |
| 1247 CodeStubAssembler::INTPTR_PARAMETERS); |
| 1248 |
| 1249 void PopAndReturn(compiler::Node* value); |
| 1250 |
| 1251 private: |
| 1252 compiler::Node* GetArguments(); |
| 1253 |
| 1254 CodeStubAssembler* assembler_; |
| 1255 compiler::Node* argc_; |
| 1256 compiler::Node* arguments_; |
| 1257 compiler::Node* fp_; |
| 1258 }; |
| 1259 |
1211 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) | 1260 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
1212 #ifdef ENABLE_SLOW_DCHECKS | 1261 #ifdef ENABLE_SLOW_DCHECKS |
1213 #define CSA_SLOW_ASSERT(x) \ | 1262 #define CSA_SLOW_ASSERT(x) \ |
1214 if (FLAG_enable_slow_asserts) { \ | 1263 if (FLAG_enable_slow_asserts) { \ |
1215 Assert((x), #x, __FILE__, __LINE__); \ | 1264 Assert((x), #x, __FILE__, __LINE__); \ |
1216 } | 1265 } |
1217 #else | 1266 #else |
1218 #define CSA_SLOW_ASSERT(x) | 1267 #define CSA_SLOW_ASSERT(x) |
1219 #endif | 1268 #endif |
1220 | 1269 |
1221 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1270 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1222 | 1271 |
1223 } // namespace internal | 1272 } // namespace internal |
1224 } // namespace v8 | 1273 } // namespace v8 |
1225 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1274 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |