⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 150160 in webkit


Ignore:
Timestamp:
May 15, 2013, 5:29:25 PM (13 years ago)
Author:
oliver@apple.com
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/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):

Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r150148 r150160  
     12013-05-15  Oliver Hunt  <oliver@apple.com>
     2
     3        RefCountedArray needs to use vector initialisers for its backing store
     4        https://bugs.webkit.org/show_bug.cgi?id=116194
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        Use an out of line function to clear the exception stack to avoid
     9        needing to include otherwise unnecessary headers all over the place.
     10
     11        Everything else is just being updated to use that.
     12
     13        * bytecompiler/BytecodeGenerator.cpp:
     14        * interpreter/CallFrame.h:
     15        (JSC::ExecState::clearSupplementaryExceptionInfo):
     16        * interpreter/Interpreter.cpp:
     17        (JSC::Interpreter::addStackTraceIfNecessary):
     18        (JSC::Interpreter::throwException):
     19        * runtime/JSGlobalObject.cpp:
     20        (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
     21        * runtime/VM.cpp:
     22        (JSC):
     23        (JSC::VM::clearExceptionStack):
     24        * runtime/VM.h:
     25        (VM):
     26        (JSC::VM::exceptionStack):
     27
    1282013-05-15  Commit Queue  <commit-queue@webkit.org>
    229
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r149496 r150160  
    4141#include "Options.h"
    4242#include "StrongInlines.h"
     43#include "UnlinkedCodeBlock.h"
    4344#include <wtf/text/WTFString.h>
    4445
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r148696 r150160  
    7171        void clearSupplementaryExceptionInfo()
    7272        {
    73             vm().exceptionStack = RefCountedArray<StackFrame>();
     73            vm().clearExceptionStack();
    7474        }
    7575
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r149836 r150160  
    695695    Vector<StackFrame> stackTrace;
    696696    getStackTrace(&callFrame->vm(), stackTrace);
    697     vm->exceptionStack = RefCountedArray<StackFrame>(stackTrace);
     697    vm->exceptionStack() = RefCountedArray<StackFrame>(stackTrace);
    698698    if (stackTrace.isEmpty() || !error.isObject())
    699699        return;
    … …  
    746746        isTermination = isTerminatedExecutionException(exception);
    747747    } else {
    748         if (!callFrame->vm().exceptionStack.size()) {
     748        if (!callFrame->vm().exceptionStack().size()) {
    749749            Vector<StackFrame> stack;
    750750            Interpreter::getStackTrace(&callFrame->vm(), stack);
    751             callFrame->vm().exceptionStack = RefCountedArray<StackFrame>(stack);
     751            callFrame->vm().exceptionStack() = RefCountedArray<StackFrame>(stack);
    752752        }
    753753    }
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r149836 r150160  
    593593    }
    594594    // Clear the exception stack between entries
    595     vm.exceptionStack = RefCountedArray<StackFrame>();
     595    vm.clearExceptionStack();
    596596}
    597597
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r149836 r150160  
    515515    heap.collectAllGarbage();
    516516}
     517
     518void VM::clearExceptionStack()
     519{
     520    m_exceptionStack = RefCountedArray<StackFrame>();
     521}
    517522   
    518523void releaseExecutableMemory(VM& vm)
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r149836 r150160  
    327327
    328328        JSValue exception;
    329         RefCountedArray<StackFrame> exceptionStack;
     329        JS_EXPORT_PRIVATE void clearExceptionStack();
     330        RefCountedArray<StackFrame>& exceptionStack() { return m_exceptionStack; }
    330331
    331332        const ClassInfo* const jsArrayClassInfo;
    … …  
    492493        bool m_inDefineOwnProperty;
    493494        RefPtr<CodeCache> m_codeCache;
     495        RefCountedArray<StackFrame> m_exceptionStack;
    494496
    495497        TypedArrayDescriptor m_int8ArrayDescriptor;
  • trunk/Source/WTF/ChangeLog

    r150134 r150160  
     12013-05-15  Oliver Hunt  <oliver@apple.com>
     2
     3        RefCountedArray needs to use vector initialisers for its backing store
     4        https://bugs.webkit.org/show_bug.cgi?id=116194
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        Use VectorOperations to operate on the backing store
     9
     10        * wtf/RefCountedArray.h:
     11        (WTF::RefCountedArray::RefCountedArray):
     12        (WTF::RefCountedArray::operator=):
     13        (WTF::RefCountedArray::~RefCountedArray):
     14
    1152013-05-15  Nico Weber  <thakis@chromium.org>
    216
  • trunk/Source/WTF/wtf/RefCountedArray.h

    r146964 r150160  
    8484        Header::fromPayload(m_data)->length = other.size();
    8585        ASSERT(Header::fromPayload(m_data)->length == other.size());
    86         memcpy(m_data, other.begin(), sizeof(T) * other.size());
     86        VectorTypeOperations<T>::uninitializedCopy(other.begin(), other.end(), m_data);
    8787    }
    8888   
    … …  
    9898        if (--Header::fromPayload(oldData)->refCount)
    9999            return *this;
     100        VectorTypeOperations<T>::destruct(oldData, oldData + Header::fromPayload(oldData)->length);
    100101        fastFree(Header::fromPayload(oldData));
    101102        return *this;
    … …  
    108109        if (--Header::fromPayload(m_data)->refCount)
    109110            return;
     111        VectorTypeOperations<T>::destruct(begin(), end());
    110112        fastFree(Header::fromPayload(m_data));
    111113    }
  • trunk/Source/WebCore/ChangeLog

    r150159 r150160  
     12013-05-15  Oliver Hunt  <oliver@apple.com>
     2
     3        RefCountedArray needs to use vector initialisers for its backing store
     4        https://bugs.webkit.org/show_bug.cgi?id=116194
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        Update to use new functions for operating on the exception stack.
     9
     10        * bindings/js/ScriptCallStackFactory.cpp:
     11        (WebCore::createScriptCallStackFromException):
     12
    1132013-05-15  Gavin Barraclough  <barraclough@apple.com>
    214
  • trunk/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp

    r149131 r150160  
    9494{
    9595    Vector<ScriptCallFrame> frames;
    96     RefCountedArray<StackFrame> stackTrace = exec->vm().exceptionStack;
     96    RefCountedArray<StackFrame> stackTrace = exec->vm().exceptionStack();
    9797    for (size_t i = 0; i < stackTrace.size() && i < maxStackSize; i++) {
    9898        if (!stackTrace[i].callee && frames.size())
Note: See TracChangeset for help on using the changeset viewer.