Commit 0944553e authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Global handles: Remove independent handle infrastructure

Bug: chromium:780749
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I4c993e2147494795402f141049eed30801dfb913
Reviewed-on: https://chromium-review.googlesource.com/782519Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49568}
parent cede838f
...@@ -9113,7 +9113,6 @@ class Internals { ...@@ -9113,7 +9113,6 @@ class Internals {
static const int kNodeStateIsWeakValue = 2; static const int kNodeStateIsWeakValue = 2;
static const int kNodeStateIsPendingValue = 3; static const int kNodeStateIsPendingValue = 3;
static const int kNodeStateIsNearDeathValue = 4; static const int kNodeStateIsNearDeathValue = 4;
static const int kNodeIsIndependentShift = 3;
static const int kNodeIsActiveShift = 4; static const int kNodeIsActiveShift = 4;
static const int kFirstNonstringType = 0x80; static const int kFirstNonstringType = 0x80;
...@@ -9312,16 +9311,11 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) { ...@@ -9312,16 +9311,11 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
M::Copy(that, this); M::Copy(that, this);
} }
template <class T> template <class T>
bool PersistentBase<T>::IsIndependent() const { bool PersistentBase<T>::IsIndependent() const {
typedef internal::Internals I; return true;
if (this->IsEmpty()) return false;
return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
I::kNodeIsIndependentShift);
} }
template <class T> template <class T>
bool PersistentBase<T>::IsNearDeath() const { bool PersistentBase<T>::IsNearDeath() const {
typedef internal::Internals I; typedef internal::Internals I;
...@@ -9402,13 +9396,7 @@ void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const { ...@@ -9402,13 +9396,7 @@ void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
} }
template <class T> template <class T>
void PersistentBase<T>::MarkIndependent() { void PersistentBase<T>::MarkIndependent() {}
typedef internal::Internals I;
if (this->IsEmpty()) return;
I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
true,
I::kNodeIsIndependentShift);
}
template <class T> template <class T>
void PersistentBase<T>::MarkActive() { void PersistentBase<T>::MarkActive() {
......
...@@ -41,8 +41,6 @@ class GlobalHandles::Node { ...@@ -41,8 +41,6 @@ class GlobalHandles::Node {
STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue); STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue);
STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue); STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue);
STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue); STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue);
STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) ==
Internals::kNodeIsIndependentShift);
STATIC_ASSERT(static_cast<int>(IsActive::kShift) == STATIC_ASSERT(static_cast<int>(IsActive::kShift) ==
Internals::kNodeIsActiveShift); Internals::kNodeIsActiveShift);
} }
...@@ -54,7 +52,6 @@ class GlobalHandles::Node { ...@@ -54,7 +52,6 @@ class GlobalHandles::Node {
object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue); object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue);
class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId;
index_ = 0; index_ = 0;
set_independent(false);
set_active(false); set_active(false);
set_in_new_space_list(false); set_in_new_space_list(false);
parameter_or_next_free_.next_free = nullptr; parameter_or_next_free_.next_free = nullptr;
...@@ -76,7 +73,6 @@ class GlobalHandles::Node { ...@@ -76,7 +73,6 @@ class GlobalHandles::Node {
DCHECK(state() == FREE); DCHECK(state() == FREE);
object_ = object; object_ = object;
class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId;
set_independent(false);
set_active(false); set_active(false);
set_state(NORMAL); set_state(NORMAL);
parameter_or_next_free_.parameter = nullptr; parameter_or_next_free_.parameter = nullptr;
...@@ -96,7 +92,6 @@ class GlobalHandles::Node { ...@@ -96,7 +92,6 @@ class GlobalHandles::Node {
// Zap the values for eager trapping. // Zap the values for eager trapping.
object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue); object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue);
class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId;
set_independent(false);
set_active(false); set_active(false);
weak_callback_ = nullptr; weak_callback_ = nullptr;
DecreaseBlockUses(); DecreaseBlockUses();
...@@ -123,13 +118,6 @@ class GlobalHandles::Node { ...@@ -123,13 +118,6 @@ class GlobalHandles::Node {
flags_ = NodeState::update(flags_, state); flags_ = NodeState::update(flags_, state);
} }
bool is_independent() {
return IsIndependent::decode(flags_);
}
void set_independent(bool v) {
flags_ = IsIndependent::update(flags_, v);
}
bool is_active() { bool is_active() {
return IsActive::decode(flags_); return IsActive::decode(flags_);
} }
...@@ -194,12 +182,6 @@ class GlobalHandles::Node { ...@@ -194,12 +182,6 @@ class GlobalHandles::Node {
set_state(PENDING); set_state(PENDING);
} }
// Independent flag accessors.
void MarkIndependent() {
DCHECK(IsInUse());
set_independent(true);
}
// Callback parameter accessors. // Callback parameter accessors.
void set_parameter(void* parameter) { void set_parameter(void* parameter) {
DCHECK(IsInUse()); DCHECK(IsInUse());
...@@ -344,7 +326,7 @@ class GlobalHandles::Node { ...@@ -344,7 +326,7 @@ class GlobalHandles::Node {
// Placed first to avoid offset computation. // Placed first to avoid offset computation.
Object* object_; Object* object_;
// Next word stores class_id, index, state, and independent. // Next word stores class_id, index, and state.
// Note: the most aligned fields should go first. // Note: the most aligned fields should go first.
// Wrapper class ID. // Wrapper class ID.
...@@ -353,10 +335,7 @@ class GlobalHandles::Node { ...@@ -353,10 +335,7 @@ class GlobalHandles::Node {
// Index in the containing handle block. // Index in the containing handle block.
uint8_t index_; uint8_t index_;
// This stores three flags (independent, partially_dependent and
// in_new_space_list) and a State.
class NodeState : public BitField<State, 0, 3> {}; class NodeState : public BitField<State, 0, 3> {};
class IsIndependent : public BitField<bool, 3, 1> {};
// The following two fields are mutually exclusive // The following two fields are mutually exclusive
class IsActive : public BitField<bool, 4, 1> {}; class IsActive : public BitField<bool, 4, 1> {};
class IsInNewSpaceList : public BitField<bool, 5, 1> {}; class IsInNewSpaceList : public BitField<bool, 5, 1> {};
...@@ -600,16 +579,6 @@ void* GlobalHandles::ClearWeakness(Object** location) { ...@@ -600,16 +579,6 @@ void* GlobalHandles::ClearWeakness(Object** location) {
return Node::FromLocation(location)->ClearWeakness(); return Node::FromLocation(location)->ClearWeakness();
} }
void GlobalHandles::MarkIndependent(Object** location) {
Node::FromLocation(location)->MarkIndependent();
}
bool GlobalHandles::IsIndependent(Object** location) {
return Node::FromLocation(location)->is_independent();
}
bool GlobalHandles::IsNearDeath(Object** location) { bool GlobalHandles::IsNearDeath(Object** location) {
return Node::FromLocation(location)->IsNearDeath(); return Node::FromLocation(location)->IsNearDeath();
} }
......
...@@ -97,11 +97,6 @@ class GlobalHandles { ...@@ -97,11 +97,6 @@ class GlobalHandles {
// Clear the weakness of a global handle. // Clear the weakness of a global handle.
static void* ClearWeakness(Object** location); static void* ClearWeakness(Object** location);
// Mark the reference to this object independent.
static void MarkIndependent(Object** location);
static bool IsIndependent(Object** location);
// Tells whether global handle is near death. // Tells whether global handle is near death.
static bool IsNearDeath(Object** location); static bool IsNearDeath(Object** location);
...@@ -158,8 +153,7 @@ class GlobalHandles { ...@@ -158,8 +153,7 @@ class GlobalHandles {
void MarkNewSpaceWeakUnmodifiedObjectsPending( void MarkNewSpaceWeakUnmodifiedObjectsPending(
WeakSlotCallbackWithHeap is_dead); WeakSlotCallbackWithHeap is_dead);
// Iterates over weak independent or unmodified handles. // Iterates over weak unmodified handles. See the note above.
// See the note above.
void IterateNewSpaceWeakUnmodifiedRootsForFinalizers(RootVisitor* v); void IterateNewSpaceWeakUnmodifiedRootsForFinalizers(RootVisitor* v);
void IterateNewSpaceWeakUnmodifiedRootsForPhantomHandles( void IterateNewSpaceWeakUnmodifiedRootsForPhantomHandles(
RootVisitor* v, WeakSlotCallbackWithHeap should_reset_handle); RootVisitor* v, WeakSlotCallbackWithHeap should_reset_handle);
......
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