Commit 0526e102 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

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>.

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1326493002

Cr-Commit-Position: refs/heads/master@{#30464}
parent 6eb83769
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment