Ignore:
Timestamp:
Sep 22, 2015, 5:21:31 AM (10 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r189616.
https://bugs.webkit.org/show_bug.cgi?id=149456

suspected cause of multiple regressions (Requested by kling on
#webkit).

Reverted changeset:

"[JSC] Weak should only accept cell pointees."
https://bugs.webkit.org/show_bug.cgi?id=148955
http://trac.webkit.org/changeset/189616

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/WeakImpl.h

    r189616 r190113  
    11/*
    2  * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747
    4848    WeakImpl();
    49     WeakImpl(JSCell&, WeakHandleOwner*, void* context);
     49    WeakImpl(JSValue, WeakHandleOwner*, void* context);
    5050
    51     State state() const;
     51    State state();
    5252    void setState(State);
    5353
    54     JSCell* cell();
     54    const JSValue& jsValue();
    5555    WeakHandleOwner* weakHandleOwner();
    5656    void* context();
    5757
    58     static WeakImpl* asWeakImpl(JSCell**);
     58    static WeakImpl* asWeakImpl(JSValue*);
    5959
    6060private:
    61     friend class WeakBlock;
    62 
    63     JSCell* m_cell { nullptr };
    64     WeakHandleOwner* m_weakHandleOwner { nullptr };
    65     void* m_context { nullptr };
     61    const JSValue m_jsValue;
     62    WeakHandleOwner* m_weakHandleOwner;
     63    void* m_context;
    6664};
    6765
    6866inline WeakImpl::WeakImpl()
     67    : m_weakHandleOwner(0)
     68    , m_context(0)
    6969{
    7070    setState(Deallocated);
    7171}
    7272
    73 inline WeakImpl::WeakImpl(JSCell& cell, WeakHandleOwner* weakHandleOwner, void* context)
    74     : m_cell(&cell)
     73inline WeakImpl::WeakImpl(JSValue jsValue, WeakHandleOwner* weakHandleOwner, void* context)
     74    : m_jsValue(jsValue)
    7575    , m_weakHandleOwner(weakHandleOwner)
    7676    , m_context(context)
    7777{
    7878    ASSERT(state() == Live);
     79    ASSERT(m_jsValue && m_jsValue.isCell());
    7980}
    8081
    81 inline WeakImpl::State WeakImpl::state() const
     82inline WeakImpl::State WeakImpl::state()
    8283{
    8384    return static_cast<State>(reinterpret_cast<uintptr_t>(m_weakHandleOwner) & StateMask);
     
    9091}
    9192
    92 inline JSCell* WeakImpl::cell()
     93inline const JSValue& WeakImpl::jsValue()
    9394{
    94     return m_cell;
     95    return m_jsValue;
    9596}
    9697
     
    105106}
    106107
    107 inline WeakImpl* WeakImpl::asWeakImpl(JSCell** slot)
     108inline WeakImpl* WeakImpl::asWeakImpl(JSValue* slot)
    108109{
    109     return reinterpret_cast_ptr<WeakImpl*>(reinterpret_cast_ptr<char*>(slot));
     110    return reinterpret_cast_ptr<WeakImpl*>(reinterpret_cast_ptr<char*>(slot) + OBJECT_OFFSETOF(WeakImpl, m_jsValue));
    110111}
    111112
Note: See TracChangeset for help on using the changeset viewer.