Changeset 208968 in webkit


Ignore:
Timestamp:
Nov 22, 2016 12:52:05 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Fix exception scope verification failures in JSC profiler files.
https://bugs.webkit.org/show_bug.cgi?id=164971

Reviewed by Saam Barati.

  • profiler/ProfilerBytecodeSequence.cpp:

(JSC::Profiler::BytecodeSequence::addSequenceProperties):

  • profiler/ProfilerCompilation.cpp:

(JSC::Profiler::Compilation::toJS):

  • profiler/ProfilerDatabase.cpp:

(JSC::Profiler::Database::toJS):
(JSC::Profiler::Database::toJSON):

  • profiler/ProfilerOSRExitSite.cpp:

(JSC::Profiler::OSRExitSite::toJS):

  • profiler/ProfilerOriginStack.cpp:

(JSC::Profiler::OriginStack::toJS):

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r208966 r208968  
     12016-11-18  Mark Lam  <mark.lam@apple.com>
     2
     3        Fix exception scope verification failures in JSC profiler files.
     4        https://bugs.webkit.org/show_bug.cgi?id=164971
     5
     6        Reviewed by Saam Barati.
     7
     8        * profiler/ProfilerBytecodeSequence.cpp:
     9        (JSC::Profiler::BytecodeSequence::addSequenceProperties):
     10        * profiler/ProfilerCompilation.cpp:
     11        (JSC::Profiler::Compilation::toJS):
     12        * profiler/ProfilerDatabase.cpp:
     13        (JSC::Profiler::Database::toJS):
     14        (JSC::Profiler::Database::toJSON):
     15        * profiler/ProfilerOSRExitSite.cpp:
     16        (JSC::Profiler::OSRExitSite::toJS):
     17        * profiler/ProfilerOriginStack.cpp:
     18        (JSC::Profiler::OriginStack::toJS):
     19
    1202016-11-22  Mark Lam  <mark.lam@apple.com>
    221
  • trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp

    r208761 r208968  
    8383    JSArray* header = constructEmptyArray(exec, 0);
    8484    RETURN_IF_EXCEPTION(scope, void());
    85     for (unsigned i = 0; i < m_header.size(); ++i)
     85    for (unsigned i = 0; i < m_header.size(); ++i) {
    8686        header->putDirectIndex(exec, i, jsString(exec, String::fromUTF8(m_header[i])));
     87        RETURN_IF_EXCEPTION(scope, void());
     88    }
    8789    result->putDirect(vm, exec->propertyNames().header, header);
    8890   
    8991    JSArray* sequence = constructEmptyArray(exec, 0);
    9092    RETURN_IF_EXCEPTION(scope, void());
    91     for (unsigned i = 0; i < m_sequence.size(); ++i)
     93    for (unsigned i = 0; i < m_sequence.size(); ++i) {
    9294        sequence->putDirectIndex(exec, i, m_sequence[i].toJS(exec));
     95        RETURN_IF_EXCEPTION(scope, void());
     96    }
    9397    result->putDirect(vm, exec->propertyNames().bytecode, sequence);
    9498}
  • trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp

    r206386 r208968  
    118118    auto scope = DECLARE_THROW_SCOPE(vm);
    119119    JSObject* result = constructEmptyObject(exec);
    120     RETURN_IF_EXCEPTION(scope, JSValue());
     120    RETURN_IF_EXCEPTION(scope, { });
    121121    result->putDirect(vm, exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id()));
    122122    result->putDirect(vm, exec->propertyNames().compilationKind, jsString(exec, String::fromUTF8(toCString(m_kind))));
    123123   
    124124    JSArray* profiledBytecodes = constructEmptyArray(exec, 0);
    125     RETURN_IF_EXCEPTION(scope, JSValue());
    126     for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i)
    127         profiledBytecodes->putDirectIndex(exec, i, m_profiledBytecodes[i].toJS(exec));
     125    RETURN_IF_EXCEPTION(scope, { });
     126    for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i) {
     127        auto value = m_profiledBytecodes[i].toJS(exec);
     128        RETURN_IF_EXCEPTION(scope, { });
     129        profiledBytecodes->putDirectIndex(exec, i, value);
     130        RETURN_IF_EXCEPTION(scope, { });
     131    }
    128132    result->putDirect(vm, exec->propertyNames().profiledBytecodes, profiledBytecodes);
    129133   
    130134    JSArray* descriptions = constructEmptyArray(exec, 0);
    131     RETURN_IF_EXCEPTION(scope, JSValue());
    132     for (unsigned i = 0; i < m_descriptions.size(); ++i)
    133         descriptions->putDirectIndex(exec, i, m_descriptions[i].toJS(exec));
     135    RETURN_IF_EXCEPTION(scope, { });
     136    for (unsigned i = 0; i < m_descriptions.size(); ++i) {
     137        auto value = m_descriptions[i].toJS(exec);
     138        RETURN_IF_EXCEPTION(scope, { });
     139        descriptions->putDirectIndex(exec, i, value);
     140        RETURN_IF_EXCEPTION(scope, { });
     141    }
    134142    result->putDirect(vm, exec->propertyNames().descriptions, descriptions);
    135143   
    136144    JSArray* counters = constructEmptyArray(exec, 0);
    137     RETURN_IF_EXCEPTION(scope, JSValue());
     145    RETURN_IF_EXCEPTION(scope, { });
    138146    for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) {
    139147        JSObject* counterEntry = constructEmptyObject(exec);
    140         counterEntry->putDirect(vm, exec->propertyNames().origin, it->key.toJS(exec));
     148        RETURN_IF_EXCEPTION(scope, { });
     149        auto value = it->key.toJS(exec);
     150        RETURN_IF_EXCEPTION(scope, { });
     151        counterEntry->putDirect(vm, exec->propertyNames().origin, value);
    141152        counterEntry->putDirect(vm, exec->propertyNames().executionCount, jsNumber(it->value->count()));
    142153        counters->push(exec, counterEntry);
     154        RETURN_IF_EXCEPTION(scope, { });
    143155    }
    144156    result->putDirect(vm, exec->propertyNames().counters, counters);
    145157   
    146158    JSArray* exitSites = constructEmptyArray(exec, 0);
    147     RETURN_IF_EXCEPTION(scope, JSValue());
    148     for (unsigned i = 0; i < m_osrExitSites.size(); ++i)
    149         exitSites->putDirectIndex(exec, i, m_osrExitSites[i].toJS(exec));
     159    RETURN_IF_EXCEPTION(scope, { });
     160    for (unsigned i = 0; i < m_osrExitSites.size(); ++i) {
     161        auto value = m_osrExitSites[i].toJS(exec);
     162        RETURN_IF_EXCEPTION(scope, { });
     163        exitSites->putDirectIndex(exec, i, value);
     164        RETURN_IF_EXCEPTION(scope, { });
     165    }
    150166    result->putDirect(vm, exec->propertyNames().osrExitSites, exitSites);
    151167   
    152168    JSArray* exits = constructEmptyArray(exec, 0);
    153     RETURN_IF_EXCEPTION(scope, JSValue());
    154     for (unsigned i = 0; i < m_osrExits.size(); ++i)
     169    RETURN_IF_EXCEPTION(scope, { });
     170    for (unsigned i = 0; i < m_osrExits.size(); ++i) {
    155171        exits->putDirectIndex(exec, i, m_osrExits[i].toJS(exec));
     172        RETURN_IF_EXCEPTION(scope, { });
     173    }
    156174    result->putDirect(vm, exec->propertyNames().osrExits, exits);
    157175   
  • trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp

    r206459 r208968  
    105105   
    106106    JSArray* bytecodes = constructEmptyArray(exec, 0);
    107     RETURN_IF_EXCEPTION(scope, JSValue());
    108     for (unsigned i = 0; i < m_bytecodes.size(); ++i)
    109         bytecodes->putDirectIndex(exec, i, m_bytecodes[i].toJS(exec));
     107    RETURN_IF_EXCEPTION(scope, { });
     108    for (unsigned i = 0; i < m_bytecodes.size(); ++i) {
     109        auto value = m_bytecodes[i].toJS(exec);
     110        RETURN_IF_EXCEPTION(scope, { });
     111        bytecodes->putDirectIndex(exec, i, value);
     112        RETURN_IF_EXCEPTION(scope, { });
     113    }
    110114    result->putDirect(vm, exec->propertyNames().bytecodes, bytecodes);
    111115   
    112116    JSArray* compilations = constructEmptyArray(exec, 0);
    113     RETURN_IF_EXCEPTION(scope, JSValue());
    114     for (unsigned i = 0; i < m_compilations.size(); ++i)
    115         compilations->putDirectIndex(exec, i, m_compilations[i]->toJS(exec));
     117    RETURN_IF_EXCEPTION(scope, { });
     118    for (unsigned i = 0; i < m_compilations.size(); ++i) {
     119        auto value = m_compilations[i]->toJS(exec);
     120        RETURN_IF_EXCEPTION(scope, { });
     121        compilations->putDirectIndex(exec, i, value);
     122        RETURN_IF_EXCEPTION(scope, { });
     123    }
    116124    result->putDirect(vm, exec->propertyNames().compilations, compilations);
    117125   
    118126    JSArray* events = constructEmptyArray(exec, 0);
    119     RETURN_IF_EXCEPTION(scope, JSValue());
    120     for (unsigned i = 0; i < m_events.size(); ++i)
    121         events->putDirectIndex(exec, i, m_events[i].toJS(exec));
     127    RETURN_IF_EXCEPTION(scope, { });
     128    for (unsigned i = 0; i < m_events.size(); ++i) {
     129        auto value = m_events[i].toJS(exec);
     130        RETURN_IF_EXCEPTION(scope, { });
     131        events->putDirectIndex(exec, i, value);
     132        RETURN_IF_EXCEPTION(scope, { });
     133    }
    122134    result->putDirect(vm, exec->propertyNames().events, events);
    123135   
     
    127139String Database::toJSON() const
    128140{
     141    auto scope = DECLARE_THROW_SCOPE(m_vm);
    129142    JSGlobalObject* globalObject = JSGlobalObject::create(
    130143        m_vm, JSGlobalObject::createStructure(m_vm, jsNull()));
    131    
    132     return JSONStringify(globalObject->globalExec(), toJS(globalObject->globalExec()), 0);
     144
     145    auto value = toJS(globalObject->globalExec());
     146    RETURN_IF_EXCEPTION(scope, String());
     147    scope.release();
     148    return JSONStringify(globalObject->globalExec(), value, 0);
    133149}
    134150
  • trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp

    r206386 r208968  
    4040    auto scope = DECLARE_THROW_SCOPE(vm);
    4141    JSArray* result = constructEmptyArray(exec, 0);
    42     RETURN_IF_EXCEPTION(scope, JSValue());
    43     for (unsigned i = 0; i < m_codeAddresses.size(); ++i)
     42    RETURN_IF_EXCEPTION(scope, { });
     43    for (unsigned i = 0; i < m_codeAddresses.size(); ++i) {
    4444        result->putDirectIndex(exec, i, jsString(exec, toString(RawPointer(m_codeAddresses[i]))));
     45        RETURN_IF_EXCEPTION(scope, { });
     46    }
    4547    return result;
    4648}
  • trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp

    r206386 r208968  
    104104    auto scope = DECLARE_THROW_SCOPE(vm);
    105105    JSArray* result = constructEmptyArray(exec, 0);
    106     RETURN_IF_EXCEPTION(scope, JSValue());
     106    RETURN_IF_EXCEPTION(scope, { });
    107107   
    108     for (unsigned i = 0; i < m_stack.size(); ++i)
     108    for (unsigned i = 0; i < m_stack.size(); ++i) {
    109109        result->putDirectIndex(exec, i, m_stack[i].toJS(exec));
     110        RETURN_IF_EXCEPTION(scope, { });
     111    }
    110112   
    111113    return result;
Note: See TracChangeset for help on using the changeset viewer.