Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: src/heap/spaces.h

Issue 699473002: 429168: fix for PdfJs regression (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/serialize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698