| 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 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 | 1221 |
| 1222 static const int kElementLoopUnrollThreshold = 8; | 1222 static const int kElementLoopUnrollThreshold = 8; |
| 1223 }; | 1223 }; |
| 1224 | 1224 |
| 1225 class CodeStubArguments { | 1225 class CodeStubArguments { |
| 1226 public: | 1226 public: |
| 1227 typedef compiler::Node Node; | 1227 typedef compiler::Node Node; |
| 1228 | 1228 |
| 1229 // |argc| is an uint32 value which specifies the number of arguments passed | 1229 // |argc| is an uint32 value which specifies the number of arguments passed |
| 1230 // to the builtin excluding the receiver. | 1230 // to the builtin excluding the receiver. |
| 1231 CodeStubArguments(CodeStubAssembler* assembler, Node* argc); | 1231 CodeStubArguments(CodeStubAssembler* assembler, Node* argc) |
| 1232 : CodeStubArguments(assembler, argc, nullptr, |
| 1233 CodeStubAssembler::INTPTR_PARAMETERS) {} |
| 1234 CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp, |
| 1235 CodeStubAssembler::ParameterMode param_mode); |
| 1232 | 1236 |
| 1233 Node* GetReceiver() const; | 1237 Node* GetReceiver() const; |
| 1234 | 1238 |
| 1239 Node* AtIndexPtr(Node* index, CodeStubAssembler::ParameterMode mode = |
| 1240 CodeStubAssembler::INTPTR_PARAMETERS) const; |
| 1241 |
| 1235 // |index| is zero-based and does not include the receiver | 1242 // |index| is zero-based and does not include the receiver |
| 1236 Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode = | 1243 Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode = |
| 1237 CodeStubAssembler::INTPTR_PARAMETERS) const; | 1244 CodeStubAssembler::INTPTR_PARAMETERS) const; |
| 1238 | 1245 |
| 1239 Node* AtIndex(int index) const; | 1246 Node* AtIndex(int index) const; |
| 1240 | 1247 |
| 1241 Node* GetLength() const { return argc_; } | 1248 Node* GetLength() const { return argc_; } |
| 1242 | 1249 |
| 1243 typedef std::function<void(Node* arg)> ForEachBodyFunction; | 1250 typedef std::function<void(Node* arg)> ForEachBodyFunction; |
| 1244 | 1251 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1255 const ForEachBodyFunction& body, Node* first = nullptr, | 1262 const ForEachBodyFunction& body, Node* first = nullptr, |
| 1256 Node* last = nullptr, CodeStubAssembler::ParameterMode mode = | 1263 Node* last = nullptr, CodeStubAssembler::ParameterMode mode = |
| 1257 CodeStubAssembler::INTPTR_PARAMETERS); | 1264 CodeStubAssembler::INTPTR_PARAMETERS); |
| 1258 | 1265 |
| 1259 void PopAndReturn(Node* value); | 1266 void PopAndReturn(Node* value); |
| 1260 | 1267 |
| 1261 private: | 1268 private: |
| 1262 Node* GetArguments(); | 1269 Node* GetArguments(); |
| 1263 | 1270 |
| 1264 CodeStubAssembler* assembler_; | 1271 CodeStubAssembler* assembler_; |
| 1272 CodeStubAssembler::ParameterMode argc_mode_; |
| 1265 Node* argc_; | 1273 Node* argc_; |
| 1266 Node* arguments_; | 1274 Node* arguments_; |
| 1267 Node* fp_; | 1275 Node* fp_; |
| 1268 }; | 1276 }; |
| 1269 | 1277 |
| 1270 #ifdef DEBUG | 1278 #ifdef DEBUG |
| 1271 #define CSA_ASSERT(csa, x) \ | 1279 #define CSA_ASSERT(csa, x) \ |
| 1272 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) | 1280 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) |
| 1273 #define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ | 1281 #define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ |
| 1274 (csa)->Assert( \ | 1282 (csa)->Assert( \ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1296 } | 1304 } |
| 1297 #else | 1305 #else |
| 1298 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1306 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
| 1299 #endif | 1307 #endif |
| 1300 | 1308 |
| 1301 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1309 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 1302 | 1310 |
| 1303 } // namespace internal | 1311 } // namespace internal |
| 1304 } // namespace v8 | 1312 } // namespace v8 |
| 1305 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1313 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |