diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp b/Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp index 01c070451..15f19f55b 100644 --- a/Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp +++ b/Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2013, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -29,44 +29,44 @@ #include "config.h" #include "JSSegmentedVariableObject.h" -#include "Operations.h" +#include "JSCInlines.h" namespace JSC { -int JSSegmentedVariableObject::findRegisterIndex(void* registerAddress) +ScopeOffset JSSegmentedVariableObject::findVariableIndex(void* variableAddress) { - for (int i = m_registers.size(); i--;) { - if (&m_registers[i] != registerAddress) + ConcurrentJITLocker locker(m_lock); + + for (unsigned i = m_variables.size(); i--;) { + if (&m_variables[i] != variableAddress) continue; - return i; + return ScopeOffset(i); } CRASH(); - return -1; + return ScopeOffset(); } -int JSSegmentedVariableObject::addRegisters(int numberOfRegistersToAdd) +ScopeOffset JSSegmentedVariableObject::addVariables(unsigned numberOfVariablesToAdd, JSValue initialValue) { - ASSERT(numberOfRegistersToAdd >= 0); + ConcurrentJITLocker locker(m_lock); - size_t oldSize = m_registers.size(); - m_registers.grow(oldSize + numberOfRegistersToAdd); + size_t oldSize = m_variables.size(); + m_variables.grow(oldSize + numberOfVariablesToAdd); - for (size_t i = numberOfRegistersToAdd; i--;) - m_registers[oldSize + i].setWithoutWriteBarrier(jsUndefined()); + for (size_t i = numberOfVariablesToAdd; i--;) + m_variables[oldSize + i].setWithoutWriteBarrier(initialValue); - return static_cast<int>(oldSize); + return ScopeOffset(oldSize); } void JSSegmentedVariableObject::visitChildren(JSCell* cell, SlotVisitor& slotVisitor) { JSSegmentedVariableObject* thisObject = jsCast<JSSegmentedVariableObject*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); - COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); - ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); JSSymbolTableObject::visitChildren(thisObject, slotVisitor); - for (unsigned i = thisObject->m_registers.size(); i--;) - slotVisitor.append(&thisObject->m_registers[i]); + for (unsigned i = thisObject->m_variables.size(); i--;) + slotVisitor.append(&thisObject->m_variables[i]); } } // namespace JSC |