Commit 90a10c58 authored by oliver@apple.com's avatar oliver@apple.com

RefCountedArray needs to use vector initialisers for its backing store

https://bugs.webkit.org/show_bug.cgi?id=116194

Reviewed by Gavin Barraclough.

Source/JavaScriptCore:

Use an out of line function to clear the exception stack to avoid
needing to include otherwise unnecessary headers all over the place.

Everything else is just being updated to use that.

* bytecompiler/BytecodeGenerator.cpp:
* interpreter/CallFrame.h:
(JSC::ExecState::clearSupplementaryExceptionInfo):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::addStackTraceIfNecessary):
(JSC::Interpreter::throwException):
* runtime/JSGlobalObject.cpp:
(JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
* runtime/VM.cpp:
(JSC):
(JSC::VM::clearExceptionStack):
* runtime/VM.h:
(VM):
(JSC::VM::exceptionStack):

Source/WebCore:

Update to use new functions for operating on the exception stack.

* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStackFromException):

Source/WTF:

Use VectorOperations to operate on the backing store

* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):
(WTF::RefCountedArray::operator=):
(WTF::RefCountedArray::~RefCountedArray):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 43007c46
2013-05-15 Oliver Hunt <oliver@apple.com>
RefCountedArray needs to use vector initialisers for its backing store
https://bugs.webkit.org/show_bug.cgi?id=116194
Reviewed by Gavin Barraclough.
Use an out of line function to clear the exception stack to avoid
needing to include otherwise unnecessary headers all over the place.
Everything else is just being updated to use that.
* bytecompiler/BytecodeGenerator.cpp:
* interpreter/CallFrame.h:
(JSC::ExecState::clearSupplementaryExceptionInfo):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::addStackTraceIfNecessary):
(JSC::Interpreter::throwException):
* runtime/JSGlobalObject.cpp:
(JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
* runtime/VM.cpp:
(JSC):
(JSC::VM::clearExceptionStack):
* runtime/VM.h:
(VM):
(JSC::VM::exceptionStack):
2013-05-15 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r150051.
......
......@@ -40,6 +40,7 @@
#include "Operations.h"
#include "Options.h"
#include "StrongInlines.h"
#include "UnlinkedCodeBlock.h"
#include <wtf/text/WTFString.h>
using namespace std;
......
......@@ -70,7 +70,7 @@ namespace JSC {
void clearException() { vm().exception = JSValue(); }
void clearSupplementaryExceptionInfo()
{
vm().exceptionStack = RefCountedArray<StackFrame>();
vm().clearExceptionStack();
}
JSValue exception() const { return vm().exception; }
......
......@@ -694,7 +694,7 @@ void Interpreter::addStackTraceIfNecessary(CallFrame* callFrame, JSValue error)
Vector<StackFrame> stackTrace;
getStackTrace(&callFrame->vm(), stackTrace);
vm->exceptionStack = RefCountedArray<StackFrame>(stackTrace);
vm->exceptionStack() = RefCountedArray<StackFrame>(stackTrace);
if (stackTrace.isEmpty() || !error.isObject())
return;
......@@ -745,10 +745,10 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
isTermination = isTerminatedExecutionException(exception);
} else {
if (!callFrame->vm().exceptionStack.size()) {
if (!callFrame->vm().exceptionStack().size()) {
Vector<StackFrame> stack;
Interpreter::getStackTrace(&callFrame->vm(), stack);
callFrame->vm().exceptionStack = RefCountedArray<StackFrame>(stack);
callFrame->vm().exceptionStack() = RefCountedArray<StackFrame>(stack);
}
}
......
......@@ -592,7 +592,7 @@ DynamicGlobalObjectScope::DynamicGlobalObjectScope(VM& vm, JSGlobalObject* dynam
vm.resetDateCache();
}
// Clear the exception stack between entries
vm.exceptionStack = RefCountedArray<StackFrame>();
vm.clearExceptionStack();
}
void slowValidateCell(JSGlobalObject* globalObject)
......
......@@ -514,6 +514,11 @@ void VM::releaseExecutableMemory()
m_regExpCache->invalidateCode();
heap.collectAllGarbage();
}
void VM::clearExceptionStack()
{
m_exceptionStack = RefCountedArray<StackFrame>();
}
void releaseExecutableMemory(VM& vm)
{
......
......@@ -326,7 +326,8 @@ namespace JSC {
NativeExecutable* getHostFunction(NativeFunction, NativeFunction constructor);
JSValue exception;
RefCountedArray<StackFrame> exceptionStack;
JS_EXPORT_PRIVATE void clearExceptionStack();
RefCountedArray<StackFrame>& exceptionStack() { return m_exceptionStack; }
const ClassInfo* const jsArrayClassInfo;
const ClassInfo* const jsFinalObjectClassInfo;
......@@ -491,6 +492,7 @@ namespace JSC {
#endif
bool m_inDefineOwnProperty;
RefPtr<CodeCache> m_codeCache;
RefCountedArray<StackFrame> m_exceptionStack;
TypedArrayDescriptor m_int8ArrayDescriptor;
TypedArrayDescriptor m_int16ArrayDescriptor;
......
2013-05-15 Oliver Hunt <oliver@apple.com>
RefCountedArray needs to use vector initialisers for its backing store
https://bugs.webkit.org/show_bug.cgi?id=116194
Reviewed by Gavin Barraclough.
Use VectorOperations to operate on the backing store
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):
(WTF::RefCountedArray::operator=):
(WTF::RefCountedArray::~RefCountedArray):
2013-05-15 Nico Weber <thakis@chromium.org>
WebKit doesn't support MSVS2003 any more, remove preprocessor checks for older versions.
......
......@@ -83,7 +83,7 @@ public:
Header::fromPayload(m_data)->refCount = 1;
Header::fromPayload(m_data)->length = other.size();
ASSERT(Header::fromPayload(m_data)->length == other.size());
memcpy(m_data, other.begin(), sizeof(T) * other.size());
VectorTypeOperations<T>::uninitializedCopy(other.begin(), other.end(), m_data);
}
RefCountedArray& operator=(const RefCountedArray& other)
......@@ -97,6 +97,7 @@ public:
return *this;
if (--Header::fromPayload(oldData)->refCount)
return *this;
VectorTypeOperations<T>::destruct(oldData, oldData + Header::fromPayload(oldData)->length);
fastFree(Header::fromPayload(oldData));
return *this;
}
......@@ -107,6 +108,7 @@ public:
return;
if (--Header::fromPayload(m_data)->refCount)
return;
VectorTypeOperations<T>::destruct(begin(), end());
fastFree(Header::fromPayload(m_data));
}
......
2013-05-15 Oliver Hunt <oliver@apple.com>
RefCountedArray needs to use vector initialisers for its backing store
https://bugs.webkit.org/show_bug.cgi?id=116194
Reviewed by Gavin Barraclough.
Update to use new functions for operating on the exception stack.
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStackFromException):
2013-05-15 Gavin Barraclough <barraclough@apple.com>
ScriptedAnimationController::setThrottled should extend MinimumAnimationInterval
......
......@@ -93,7 +93,7 @@ PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t m
PassRefPtr<ScriptCallStack> createScriptCallStackFromException(JSC::ExecState* exec, JSC::JSValue& exception, size_t maxStackSize)
{
Vector<ScriptCallFrame> frames;
RefCountedArray<StackFrame> stackTrace = exec->vm().exceptionStack;
RefCountedArray<StackFrame> stackTrace = exec->vm().exceptionStack();
for (size_t i = 0; i < stackTrace.size() && i < maxStackSize; i++) {
if (!stackTrace[i].callee && frames.size())
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment