| Index: src/unique.h
|
| diff --git a/src/unique.h b/src/unique.h
|
| index 96a5329754a44589f8346d5ce0f0bc23f20adeac..206fd4e7c678b231f073bc58d0e7664659e4452b 100644
|
| --- a/src/unique.h
|
| +++ b/src/unique.h
|
| @@ -29,6 +29,7 @@
|
| #define V8_HYDROGEN_UNIQUE_H_
|
|
|
| #include "handles.h"
|
| +#include "objects.h"
|
| #include "utils.h"
|
| #include "zone.h"
|
|
|
| @@ -53,13 +54,20 @@ class UniqueSet;
|
| template <typename T>
|
| class Unique V8_FINAL {
|
| public:
|
| - // TODO(titzer): make private and introduce some builder/owner class.
|
| + // TODO(titzer): make private and introduce a factory.
|
| explicit Unique(Handle<T> handle) {
|
| if (handle.is_null()) {
|
| raw_address_ = NULL;
|
| } else {
|
| + // This is a best-effort check to prevent comparing Unique<T>'s created
|
| + // in different GC eras; we require heap allocation to be disallowed at
|
| + // creation time.
|
| + // NOTE: we currently consider maps to be non-movable, so no special
|
| + // assurance is required for creating a Unique<Map>.
|
| + // TODO(titzer): other immortable immovable objects are also fine.
|
| + ASSERT(!AllowHeapAllocation::IsAllowed() || handle->IsMap());
|
| raw_address_ = reinterpret_cast<Address>(*handle);
|
| - ASSERT_NE(raw_address_, NULL);
|
| + ASSERT_NE(raw_address_, NULL); // Non-null should imply non-zero address.
|
| }
|
| handle_ = handle;
|
| }
|
| @@ -69,7 +77,7 @@ class Unique V8_FINAL {
|
| : raw_address_(raw_address), handle_(handle) { }
|
|
|
| // Constructor for handling automatic up casting.
|
| - // Ex. Unique<JSFunction> can be passed when Unique<Object> is expected.
|
| + // Eg. Unique<JSFunction> can be passed when Unique<Object> is expected.
|
| template <class S> Unique(Unique<S> uniq) {
|
| #ifdef DEBUG
|
| T* a = NULL;
|
| @@ -78,7 +86,7 @@ class Unique V8_FINAL {
|
| USE(a);
|
| #endif
|
| raw_address_ = uniq.raw_address_;
|
| - handle_ = uniq.handle_; // Creates a new handle sharing the same location.
|
| + handle_ = uniq.handle_;
|
| }
|
|
|
| template <typename U>
|
|
|