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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 // Implements DescriptorArray::GetKey. | 1447 // Implements DescriptorArray::GetKey. |
1448 Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number); | 1448 Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number); |
1449 | 1449 |
1450 static const int kElementLoopUnrollThreshold = 8; | 1450 static const int kElementLoopUnrollThreshold = 8; |
1451 }; | 1451 }; |
1452 | 1452 |
1453 class CodeStubArguments { | 1453 class CodeStubArguments { |
1454 public: | 1454 public: |
1455 typedef compiler::Node Node; | 1455 typedef compiler::Node Node; |
1456 | 1456 |
1457 // |argc| is an uint32 value which specifies the number of arguments passed | 1457 // |argc| is an intptr value which specifies the number of arguments passed |
1458 // to the builtin excluding the receiver. | 1458 // to the builtin excluding the receiver. |
1459 CodeStubArguments(CodeStubAssembler* assembler, Node* argc) | 1459 CodeStubArguments(CodeStubAssembler* assembler, Node* argc) |
1460 : CodeStubArguments(assembler, argc, nullptr, | 1460 : CodeStubArguments(assembler, argc, nullptr, |
1461 CodeStubAssembler::INTPTR_PARAMETERS) {} | 1461 CodeStubAssembler::INTPTR_PARAMETERS) {} |
| 1462 // |argc| is either a smi or intptr depending on |param_mode| |
1462 CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp, | 1463 CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp, |
1463 CodeStubAssembler::ParameterMode param_mode); | 1464 CodeStubAssembler::ParameterMode param_mode); |
1464 | 1465 |
1465 Node* GetReceiver() const; | 1466 Node* GetReceiver() const; |
1466 | 1467 |
1467 Node* AtIndexPtr(Node* index, CodeStubAssembler::ParameterMode mode = | 1468 Node* AtIndexPtr(Node* index, CodeStubAssembler::ParameterMode mode = |
1468 CodeStubAssembler::INTPTR_PARAMETERS) const; | 1469 CodeStubAssembler::INTPTR_PARAMETERS) const; |
1469 | 1470 |
1470 // |index| is zero-based and does not include the receiver | 1471 // |index| is zero-based and does not include the receiver |
1471 Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode = | 1472 Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode = |
1472 CodeStubAssembler::INTPTR_PARAMETERS) const; | 1473 CodeStubAssembler::INTPTR_PARAMETERS) const; |
1473 | 1474 |
1474 Node* AtIndex(int index) const; | 1475 Node* AtIndex(int index) const; |
1475 | 1476 |
| 1477 Node* GetOptionalArgumentValue(int index, Node* default_value); |
| 1478 |
1476 Node* GetLength() const { return argc_; } | 1479 Node* GetLength() const { return argc_; } |
1477 | 1480 |
1478 typedef std::function<void(Node* arg)> ForEachBodyFunction; | 1481 typedef std::function<void(Node* arg)> ForEachBodyFunction; |
1479 | 1482 |
1480 // Iteration doesn't include the receiver. |first| and |last| are zero-based. | 1483 // Iteration doesn't include the receiver. |first| and |last| are zero-based. |
1481 void ForEach(const ForEachBodyFunction& body, Node* first = nullptr, | 1484 void ForEach(const ForEachBodyFunction& body, Node* first = nullptr, |
1482 Node* last = nullptr, CodeStubAssembler::ParameterMode mode = | 1485 Node* last = nullptr, CodeStubAssembler::ParameterMode mode = |
1483 CodeStubAssembler::INTPTR_PARAMETERS) { | 1486 CodeStubAssembler::INTPTR_PARAMETERS) { |
1484 CodeStubAssembler::VariableList list(0, assembler_->zone()); | 1487 CodeStubAssembler::VariableList list(0, assembler_->zone()); |
1485 ForEach(list, body, first, last); | 1488 ForEach(list, body, first, last); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 } | 1575 } |
1573 #else | 1576 #else |
1574 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1577 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
1575 #endif | 1578 #endif |
1576 | 1579 |
1577 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1580 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1578 | 1581 |
1579 } // namespace internal | 1582 } // namespace internal |
1580 } // namespace v8 | 1583 } // namespace v8 |
1581 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1584 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |