diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
commit | 881da28418d380042aa95a97f0cbd42560a64f7c (patch) | |
tree | a794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp | |
parent | 7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff) | |
parent | 0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff) | |
download | qtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz |
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
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 |