Chromium Code Reviews| Index: src/compiler/code-stub-assembler.h |
| diff --git a/src/compiler/code-stub-assembler.h b/src/compiler/code-stub-assembler.h |
| index 2ab13764c46acdb4e67bcc78cf9306d832e57e30..c50f2e5565ea7f1835cef139c0aa798a14c015c4 100644 |
| --- a/src/compiler/code-stub-assembler.h |
| +++ b/src/compiler/code-stub-assembler.h |
| @@ -68,6 +68,27 @@ class Schedule; |
| V(Word64Ror) \ |
| V(UintPtrGreaterThanOrEqual) |
| +enum AllocationFlags : uint8_t { |
|
Benedikt Meurer
2016/02/25 13:00:40
Can you move this into the CodeStubAssembler?
epertoso
2016/02/25 13:26:54
Done.
|
| + kNone = 0, |
| + kTagObject = 1, |
|
Benedikt Meurer
2016/02/25 13:00:41
Don't add kTagObject here. This is terrible in the
epertoso
2016/02/25 13:26:54
OK.
|
| + kDoubleAlignment = 1 << 1, |
| + kPretenured = 1 << 2 |
| +}; |
| + |
| +inline AllocationFlags operator|(AllocationFlags lhs, AllocationFlags rhs) { |
|
Benedikt Meurer
2016/02/25 13:00:40
Use base::Flags and DEFINE_OPERATORS_FOR_FLAGS her
epertoso
2016/02/25 13:26:53
Done.
|
| + return static_cast<AllocationFlags>(static_cast<uint8_t>(lhs) | |
| + static_cast<uint8_t>(rhs)); |
| +} |
| + |
| +inline AllocationFlags operator&(AllocationFlags lhs, AllocationFlags rhs) { |
| + return static_cast<AllocationFlags>(static_cast<uint8_t>(lhs) & |
| + static_cast<uint8_t>(rhs)); |
| +} |
| + |
| +inline AllocationFlags operator~(AllocationFlags arg) { |
| + return static_cast<AllocationFlags>(~static_cast<uint8_t>(arg)); |
| +} |
| + |
| class CodeStubAssembler { |
| public: |
| // |result_size| specifies the number of results returned by the stub. |
| @@ -211,6 +232,9 @@ class CodeStubAssembler { |
| int additional_offset = 0); |
| Node* LoadFixedArrayElementConstantIndex(Node* object, int index); |
| + // Allocate in new space. |
| + Node* Allocate(int size, AllocationFlags flags); |
| + |
| protected: |
| // Protected helpers which delegate to RawMachineAssembler. |
| Graph* graph(); |
| @@ -229,6 +253,11 @@ class CodeStubAssembler { |
| Node* SmiShiftBitsConstant(); |
| + Node* AllocateRawAligned(Node* size_in_bytes, AllocationFlags flags, |
| + Node* top_address, Node* limit_address); |
| + Node* AllocateRawUnaligned(Node* size_in_bytes, AllocationFlags flags, |
| + Node* top_adddress, Node* limit_address); |
| + |
| base::SmartPointer<RawMachineAssembler> raw_assembler_; |
| Code::Flags flags_; |
| const char* name_; |