| Index: src/heap/spaces.h
|
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h
|
| index 5be9c3a11fdfbe4d7659786217ff74dd83304bd0..a710fa9b91986b8ded53372e489f10b6a8ac6d60 100644
|
| --- a/src/heap/spaces.h
|
| +++ b/src/heap/spaces.h
|
| @@ -1608,16 +1608,19 @@ class AllocationResult {
|
| public:
|
| // Implicit constructor from Object*.
|
| AllocationResult(Object* object) // NOLINT
|
| - : object_(object),
|
| - retry_space_(INVALID_SPACE) {}
|
| + : object_(object) {
|
| + // AllocationResults can't return Smis, which are used to represent
|
| + // failure and the space to retry in.
|
| + CHECK(!object->IsSmi());
|
| + }
|
|
|
| - AllocationResult() : object_(NULL), retry_space_(INVALID_SPACE) {}
|
| + AllocationResult() : object_(Smi::FromInt(NEW_SPACE)) {}
|
|
|
| static inline AllocationResult Retry(AllocationSpace space = NEW_SPACE) {
|
| return AllocationResult(space);
|
| }
|
|
|
| - inline bool IsRetry() { return retry_space_ != INVALID_SPACE; }
|
| + inline bool IsRetry() { return object_->IsSmi(); }
|
|
|
| template <typename T>
|
| bool To(T** obj) {
|
| @@ -1633,18 +1636,20 @@ class AllocationResult {
|
|
|
| AllocationSpace RetrySpace() {
|
| DCHECK(IsRetry());
|
| - return retry_space_;
|
| + return static_cast<AllocationSpace>(Smi::cast(object_)->value());
|
| }
|
|
|
| private:
|
| explicit AllocationResult(AllocationSpace space)
|
| - : object_(NULL), retry_space_(space) {}
|
| + : object_(Smi::FromInt(static_cast<int>(space))) {}
|
|
|
| Object* object_;
|
| - AllocationSpace retry_space_;
|
| };
|
|
|
|
|
| +STATIC_ASSERT(sizeof(AllocationResult) == kPointerSize);
|
| +
|
| +
|
| class PagedSpace : public Space {
|
| public:
|
| // Creates a space with a maximum capacity, and an id.
|
|
|