diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-20 13:01:08 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-20 13:01:08 +0200 |
commit | 49233e234e5c787396cadb2cea33b31ae0cd65c1 (patch) | |
tree | 5410cb9a8fd53168bb60d62c54b654d86f03c38d /Source/JavaScriptCore/runtime/JSVariableObject.h | |
parent | b211c645d8ab690f713515dfdc84d80b11c27d2c (diff) | |
download | qtwebkit-49233e234e5c787396cadb2cea33b31ae0cd65c1.tar.gz |
Imported WebKit commit 3a8c29f35d00659d2ce7a0ccdfa8304f14e82327 (http://svn.webkit.org/repository/webkit/trunk@120813)
New snapshot with Windows build fixes
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSVariableObject.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSVariableObject.h | 90 |
1 files changed, 8 insertions, 82 deletions
diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.h b/Source/JavaScriptCore/runtime/JSVariableObject.h index ea2798457..46fe72684 100644 --- a/Source/JavaScriptCore/runtime/JSVariableObject.h +++ b/Source/JavaScriptCore/runtime/JSVariableObject.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,7 @@ #define JSVariableObject_h #include "JSObject.h" +#include "JSSymbolTableObject.h" #include "Register.h" #include "SymbolTable.h" #include <wtf/UnusedParam.h> @@ -41,40 +42,25 @@ namespace JSC { class LLIntOffsetsExtractor; class Register; - class JSVariableObject : public JSNonFinalObject { + class JSVariableObject : public JSSymbolTableObject { friend class JIT; friend class LLIntOffsetsExtractor; public: - typedef JSNonFinalObject Base; - - SymbolTable& symbolTable() const { return *m_symbolTable; } - - JS_EXPORT_PRIVATE static void destroy(JSCell*); - - static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); - - JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName); - JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - - bool isDynamicScope(bool& requiresDynamicChecks) const; + typedef JSSymbolTableObject Base; WriteBarrier<Unknown>& registerAt(int index) const { return m_registers[index]; } WriteBarrier<Unknown>* const * addressOfRegisters() const { return &m_registers; } static size_t offsetOfRegisters() { return OBJECT_OFFSETOF(JSVariableObject, m_registers); } - static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) - { - return Structure::create(globalData, globalObject, prototype, TypeInfo(VariableObjectType, StructureFlags), &s_info); - } - + JS_EXPORT_PRIVATE static void destroy(JSCell*); + protected: - static const unsigned StructureFlags = OverridesGetPropertyNames | JSNonFinalObject::StructureFlags; + static const unsigned StructureFlags = JSSymbolTableObject::StructureFlags; JSVariableObject(JSGlobalData& globalData, Structure* structure, SymbolTable* symbolTable, Register* registers) - : JSNonFinalObject(globalData, structure) - , m_symbolTable(symbolTable) + : JSSymbolTableObject(globalData, structure, symbolTable) , m_registers(reinterpret_cast<WriteBarrier<Unknown>*>(registers)) { } @@ -82,76 +68,16 @@ namespace JSC { void finishCreation(JSGlobalData& globalData) { Base::finishCreation(globalData); - ASSERT(m_symbolTable); COMPILE_ASSERT(sizeof(WriteBarrier<Unknown>) == sizeof(Register), Register_should_be_same_size_as_WriteBarrier); } PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts); void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray); - bool symbolTableGet(PropertyName, PropertySlot&); - JS_EXPORT_PRIVATE bool symbolTableGet(PropertyName, PropertyDescriptor&); - bool symbolTableGet(PropertyName, PropertySlot&, bool& slotIsWriteable); - bool symbolTablePut(ExecState*, PropertyName, JSValue, bool shouldThrow); - bool symbolTablePutWithAttributes(JSGlobalData&, PropertyName, JSValue, unsigned attributes); - - SymbolTable* m_symbolTable; // Maps name -> offset from "r" in register file. WriteBarrier<Unknown>* m_registers; // "r" in the register file. OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file. }; - inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot) - { - SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); - if (!entry.isNull()) { - slot.setValue(registerAt(entry.getIndex()).get()); - return true; - } - return false; - } - - inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot, bool& slotIsWriteable) - { - SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); - if (!entry.isNull()) { - slot.setValue(registerAt(entry.getIndex()).get()); - slotIsWriteable = !entry.isReadOnly(); - return true; - } - return false; - } - - inline bool JSVariableObject::symbolTablePut(ExecState* exec, PropertyName propertyName, JSValue value, bool shouldThrow) - { - JSGlobalData& globalData = exec->globalData(); - ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); - - SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); - if (entry.isNull()) - return false; - if (entry.isReadOnly()) { - if (shouldThrow) - throwTypeError(exec, StrictModeReadonlyPropertyWriteError); - return true; - } - registerAt(entry.getIndex()).set(globalData, this, value); - return true; - } - - inline bool JSVariableObject::symbolTablePutWithAttributes(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) - { - ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); - - SymbolTable::iterator iter = symbolTable().find(propertyName.publicName()); - if (iter == symbolTable().end()) - return false; - SymbolTableEntry& entry = iter->second; - ASSERT(!entry.isNull()); - entry.setAttributes(attributes); - registerAt(entry.getIndex()).set(globalData, this, value); - return true; - } - inline PassOwnArrayPtr<WriteBarrier<Unknown> > JSVariableObject::copyRegisterArray(JSGlobalData& globalData, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts) { OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[count]); |