Reviewers: titzer,
Description:
Make unsafe Unique<T> constructor private.
The constructor taking an artificial raw address was only used as a
workaround in TurboFan. It should only be accessible by constructor
functions internal to Unique<T>.
[email protected]
Please review this at https://codereview.chromium.org/1326493002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+7, -10 lines):
M src/unique.h
Index: src/unique.h
diff --git a/src/unique.h b/src/unique.h
index
68fb86956cd2f15a2030055b802a4d5d6ca82765..68a45963b860ed8ff0d50e14f679ff2b5698e4a7
100644
--- a/src/unique.h
+++ b/src/unique.h
@@ -32,7 +32,7 @@ class UniqueSet;
// Careful! Comparison of two Uniques is only correct if both were created
// in the same "era" of GC or if at least one is a non-movable object.
template <typename T>
-class Unique {
+class Unique final {
public:
Unique<T>() : raw_address_(NULL) {}
@@ -54,10 +54,6 @@ class Unique {
handle_ = handle;
}
- // TODO(titzer): this is a hack to migrate to Unique<T> incrementally.
- Unique(Address raw_address, Handle<T> handle)
- : raw_address_(raw_address), handle_(handle) { }
-
// Constructor for handling automatic up casting.
// Eg. Unique<JSFunction> can be passed when Unique<Object> is expected.
template <class S> Unique(Unique<S> uniq) {
@@ -129,15 +125,16 @@ class Unique {
return Unique<T>(reinterpret_cast<Address>(*handle), handle);
}
- friend class UniqueSet<T>; // Uses internal details for speed.
- template <class U>
- friend class Unique; // For comparing raw_address values.
+ private:
+ Unique(Address raw_address, Handle<T> handle)
+ : raw_address_(raw_address), handle_(handle) {}
- protected:
Address raw_address_;
Handle<T> handle_;
- friend class SideEffectsTracker;
+ friend class UniqueSet<T>; // Uses internal details for speed.
+ template <class U>
+ friend class Unique; // For comparing raw_address values.
};
template <typename T>
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.