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
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index aaec1c2..4113085 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,30 @@
+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.
diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index f74d52e..b42db47 100644
--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -40,6 +40,7 @@
#include "Operations.h"
#include "Options.h"
#include "StrongInlines.h"
+#include "UnlinkedCodeBlock.h"
#include <wtf/text/WTFString.h>
using namespace std;
diff --git a/Source/JavaScriptCore/interpreter/CallFrame.h b/Source/JavaScriptCore/interpreter/CallFrame.h
index 6f29f17..c09132c 100644
--- a/Source/JavaScriptCore/interpreter/CallFrame.h
+++ b/Source/JavaScriptCore/interpreter/CallFrame.h
@@ -70,7 +70,7 @@
void clearException() { vm().exception = JSValue(); }
void clearSupplementaryExceptionInfo()
{
- vm().exceptionStack = RefCountedArray<StackFrame>();
+ vm().clearExceptionStack();
}
JSValue exception() const { return vm().exception; }
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp
index 99ed411..18aca43 100644
--- a/Source/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp
@@ -694,7 +694,7 @@
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 @@
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);
}
}
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
index 38ca836..e272e09 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -592,7 +592,7 @@
vm.resetDateCache();
}
// Clear the exception stack between entries
- vm.exceptionStack = RefCountedArray<StackFrame>();
+ vm.clearExceptionStack();
}
void slowValidateCell(JSGlobalObject* globalObject)
diff --git a/Source/JavaScriptCore/runtime/VM.cpp b/Source/JavaScriptCore/runtime/VM.cpp
index cac3ddc..7e7c0b2 100644
--- a/Source/JavaScriptCore/runtime/VM.cpp
+++ b/Source/JavaScriptCore/runtime/VM.cpp
@@ -514,6 +514,11 @@
m_regExpCache->invalidateCode();
heap.collectAllGarbage();
}
+
+void VM::clearExceptionStack()
+{
+ m_exceptionStack = RefCountedArray<StackFrame>();
+}
void releaseExecutableMemory(VM& vm)
{
diff --git a/Source/JavaScriptCore/runtime/VM.h b/Source/JavaScriptCore/runtime/VM.h
index 480acb864..af1c525 100644
--- a/Source/JavaScriptCore/runtime/VM.h
+++ b/Source/JavaScriptCore/runtime/VM.h
@@ -326,7 +326,8 @@
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 @@
#endif
bool m_inDefineOwnProperty;
RefPtr<CodeCache> m_codeCache;
+ RefCountedArray<StackFrame> m_exceptionStack;
TypedArrayDescriptor m_int8ArrayDescriptor;
TypedArrayDescriptor m_int16ArrayDescriptor;