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 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 // Implements DescriptorArray::GetKey. | 1461 // Implements DescriptorArray::GetKey. |
1462 Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number); | 1462 Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number); |
1463 | 1463 |
1464 static const int kElementLoopUnrollThreshold = 8; | 1464 static const int kElementLoopUnrollThreshold = 8; |
1465 }; | 1465 }; |
1466 | 1466 |
1467 class CodeStubArguments { | 1467 class CodeStubArguments { |
1468 public: | 1468 public: |
1469 typedef compiler::Node Node; | 1469 typedef compiler::Node Node; |
1470 | 1470 |
1471 // |argc| is an uint32 value which specifies the number of arguments passed | 1471 // |argc| is an intptr value which specifies the number of arguments passed |
1472 // to the builtin excluding the receiver. | 1472 // to the builtin excluding the receiver. |
1473 CodeStubArguments(CodeStubAssembler* assembler, Node* argc) | 1473 CodeStubArguments(CodeStubAssembler* assembler, Node* argc) |
1474 : CodeStubArguments(assembler, argc, nullptr, | 1474 : CodeStubArguments(assembler, argc, nullptr, |
1475 CodeStubAssembler::INTPTR_PARAMETERS) {} | 1475 CodeStubAssembler::INTPTR_PARAMETERS) {} |
| 1476 // |argc| is either a smi or intptr depending on |param_mode| |
1476 CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp, | 1477 CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp, |
1477 CodeStubAssembler::ParameterMode param_mode); | 1478 CodeStubAssembler::ParameterMode param_mode); |
1478 | 1479 |
1479 Node* GetReceiver() const; | 1480 Node* GetReceiver() const; |
1480 | 1481 |
1481 Node* AtIndexPtr(Node* index, CodeStubAssembler::ParameterMode mode = | 1482 Node* AtIndexPtr(Node* index, CodeStubAssembler::ParameterMode mode = |
1482 CodeStubAssembler::INTPTR_PARAMETERS) const; | 1483 CodeStubAssembler::INTPTR_PARAMETERS) const; |
1483 | 1484 |
1484 // |index| is zero-based and does not include the receiver | 1485 // |index| is zero-based and does not include the receiver |
1485 Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode = | 1486 Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode = |
1486 CodeStubAssembler::INTPTR_PARAMETERS) const; | 1487 CodeStubAssembler::INTPTR_PARAMETERS) const; |
1487 | 1488 |
1488 Node* AtIndex(int index) const; | 1489 Node* AtIndex(int index) const; |
1489 | 1490 |
| 1491 Node* GetOptionalArgumentValue(int index, Node* default_value); |
| 1492 |
1490 Node* GetLength() const { return argc_; } | 1493 Node* GetLength() const { return argc_; } |
1491 | 1494 |
1492 typedef std::function<void(Node* arg)> ForEachBodyFunction; | 1495 typedef std::function<void(Node* arg)> ForEachBodyFunction; |
1493 | 1496 |
1494 // Iteration doesn't include the receiver. |first| and |last| are zero-based. | 1497 // Iteration doesn't include the receiver. |first| and |last| are zero-based. |
1495 void ForEach(const ForEachBodyFunction& body, Node* first = nullptr, | 1498 void ForEach(const ForEachBodyFunction& body, Node* first = nullptr, |
1496 Node* last = nullptr, CodeStubAssembler::ParameterMode mode = | 1499 Node* last = nullptr, CodeStubAssembler::ParameterMode mode = |
1497 CodeStubAssembler::INTPTR_PARAMETERS) { | 1500 CodeStubAssembler::INTPTR_PARAMETERS) { |
1498 CodeStubAssembler::VariableList list(0, assembler_->zone()); | 1501 CodeStubAssembler::VariableList list(0, assembler_->zone()); |
1499 ForEach(list, body, first, last); | 1502 ForEach(list, body, first, last); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 } | 1589 } |
1587 #else | 1590 #else |
1588 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1591 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
1589 #endif | 1592 #endif |
1590 | 1593 |
1591 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1594 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1592 | 1595 |
1593 } // namespace internal | 1596 } // namespace internal |
1594 } // namespace v8 | 1597 } // namespace v8 |
1595 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1598 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |