diff options
Diffstat (limited to 'JavaScriptCore/runtime/PropertySlot.h')
-rw-r--r-- | JavaScriptCore/runtime/PropertySlot.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/JavaScriptCore/runtime/PropertySlot.h b/JavaScriptCore/runtime/PropertySlot.h index 7af60ce..15d9034 100644 --- a/JavaScriptCore/runtime/PropertySlot.h +++ b/JavaScriptCore/runtime/PropertySlot.h @@ -23,7 +23,6 @@ #include "Identifier.h" #include "JSValue.h" -#include "JSImmediate.h" #include "Register.h" #include <wtf/Assertions.h> #include <wtf/NotFound.h> @@ -39,16 +38,16 @@ namespace JSC { class PropertySlot { public: PropertySlot() - : m_offset(WTF::notFound) { clearBase(); + clearOffset(); clearValue(); } explicit PropertySlot(const JSValue base) : m_slotBase(base) - , m_offset(WTF::notFound) { + clearOffset(); clearValue(); } @@ -79,21 +78,12 @@ namespace JSC { return m_offset; } - void putValue(JSValue value) - { - if (m_getValue == JSC_VALUE_SLOT_MARKER) { - *m_data.valueSlot = value; - return; - } - ASSERT(m_getValue == JSC_REGISTER_SLOT_MARKER); - *m_data.registerSlot = JSValue(value); - } - void setValueSlot(JSValue* valueSlot) { ASSERT(valueSlot); - m_getValue = JSC_VALUE_SLOT_MARKER; clearBase(); + clearOffset(); + m_getValue = JSC_VALUE_SLOT_MARKER; m_data.valueSlot = valueSlot; } @@ -117,8 +107,9 @@ namespace JSC { void setValue(JSValue value) { ASSERT(value); - m_getValue = JSC_VALUE_SLOT_MARKER; clearBase(); + clearOffset(); + m_getValue = JSC_VALUE_SLOT_MARKER; m_value = value; m_data.valueSlot = &m_value; } @@ -126,8 +117,9 @@ namespace JSC { void setRegisterSlot(Register* registerSlot) { ASSERT(registerSlot); - m_getValue = JSC_REGISTER_SLOT_MARKER; clearBase(); + clearOffset(); + m_getValue = JSC_REGISTER_SLOT_MARKER; m_data.registerSlot = registerSlot; } @@ -157,13 +149,11 @@ namespace JSC { void setUndefined() { - clearBase(); setValue(jsUndefined()); } JSValue slotBase() const { - ASSERT(m_slotBase); return m_slotBase; } @@ -188,6 +178,13 @@ namespace JSC { #endif } + void clearOffset() + { + // Clear offset even in release builds, in case this PropertySlot has been used before. + // (For other data members, we don't need to clear anything because reuse would meaningfully overwrite them.) + m_offset = WTF::notFound; + } + unsigned index() const { return m_data.index; } private: |