Title: [150160] trunk/Source
Revision
150160
Author
[email protected]
Date
2013-05-15 17:29:25 -0700 (Wed, 15 May 2013)

Log Message

RefCountedArray needs to use vector initialisers for its backing store
https://bugs.webkit.org/show_bug.cgi?id=116194

Reviewed by Gavin Barraclough.

Source/_javascript_Core:

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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (150159 => 150160)


--- trunk/Source/_javascript_Core/ChangeLog	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-05-16 00:29:25 UTC (rev 150160)
@@ -1,3 +1,30 @@
+2013-05-15  Oliver Hunt  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed, rolling out r150051.

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (150159 => 150160)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2013-05-16 00:29:25 UTC (rev 150160)
@@ -40,6 +40,7 @@
 #include "Operations.h"
 #include "Options.h"
 #include "StrongInlines.h"
+#include "UnlinkedCodeBlock.h"
 #include <wtf/text/WTFString.h>
 
 using namespace std;

Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (150159 => 150160)


--- trunk/Source/_javascript_Core/interpreter/CallFrame.h	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h	2013-05-16 00:29:25 UTC (rev 150160)
@@ -70,7 +70,7 @@
         void clearException() { vm().exception = JSValue(); }
         void clearSupplementaryExceptionInfo()
         {
-            vm().exceptionStack = RefCountedArray<StackFrame>();
+            vm().clearExceptionStack();
         }
 
         JSValue exception() const { return vm().exception; }

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (150159 => 150160)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-05-16 00:29:25 UTC (rev 150160)
@@ -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);
         }
     }
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (150159 => 150160)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2013-05-16 00:29:25 UTC (rev 150160)
@@ -592,7 +592,7 @@
         vm.resetDateCache();
     }
     // Clear the exception stack between entries
-    vm.exceptionStack = RefCountedArray<StackFrame>();
+    vm.clearExceptionStack();
 }
 
 void slowValidateCell(JSGlobalObject* globalObject)

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (150159 => 150160)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2013-05-16 00:29:25 UTC (rev 150160)
@@ -514,6 +514,11 @@
     m_regExpCache->invalidateCode();
     heap.collectAllGarbage();
 }
+
+void VM::clearExceptionStack()
+{
+    m_exceptionStack = RefCountedArray<StackFrame>();
+}
     
 void releaseExecutableMemory(VM& vm)
 {

Modified: trunk/Source/_javascript_Core/runtime/VM.h (150159 => 150160)


--- trunk/Source/_javascript_Core/runtime/VM.h	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2013-05-16 00:29:25 UTC (rev 150160)
@@ -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;

Modified: trunk/Source/WTF/ChangeLog (150159 => 150160)


--- trunk/Source/WTF/ChangeLog	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/WTF/ChangeLog	2013-05-16 00:29:25 UTC (rev 150160)
@@ -1,3 +1,17 @@
+2013-05-15  Oliver Hunt  <[email protected]>
+
+        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  <[email protected]>
 
         WebKit doesn't support MSVS2003 any more, remove preprocessor checks for older versions.

Modified: trunk/Source/WTF/wtf/RefCountedArray.h (150159 => 150160)


--- trunk/Source/WTF/wtf/RefCountedArray.h	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/WTF/wtf/RefCountedArray.h	2013-05-16 00:29:25 UTC (rev 150160)
@@ -83,7 +83,7 @@
         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 @@
             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 @@
             return;
         if (--Header::fromPayload(m_data)->refCount)
             return;
+        VectorTypeOperations<T>::destruct(begin(), end());
         fastFree(Header::fromPayload(m_data));
     }
     

Modified: trunk/Source/WebCore/ChangeLog (150159 => 150160)


--- trunk/Source/WebCore/ChangeLog	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/WebCore/ChangeLog	2013-05-16 00:29:25 UTC (rev 150160)
@@ -1,3 +1,15 @@
+2013-05-15  Oliver Hunt  <[email protected]>
+
+        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  <[email protected]>
 
         ScriptedAnimationController::setThrottled should extend MinimumAnimationInterval

Modified: trunk/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp (150159 => 150160)


--- trunk/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp	2013-05-16 00:28:59 UTC (rev 150159)
+++ trunk/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp	2013-05-16 00:29:25 UTC (rev 150160)
@@ -93,7 +93,7 @@
 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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to