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