Changeset 209018 in webkit


Ignore:
Timestamp:
Nov 28, 2016 2:21:29 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Fix exception scope verification failures in miscellaneous files.
https://bugs.webkit.org/show_bug.cgi?id=165055

Reviewed by Saam Barati.

  • runtime/MathObject.cpp:

(JSC::mathProtoFuncIMul):

  • runtime/ModuleLoaderPrototype.cpp:

(JSC::moduleLoaderPrototypeParseModule):
(JSC::moduleLoaderPrototypeRequestedModules):

  • runtime/NativeErrorConstructor.cpp:

(JSC::Interpreter::constructWithNativeErrorConstructor):

  • runtime/NumberConstructor.cpp:

(JSC::constructWithNumberConstructor):

  • runtime/SetConstructor.cpp:

(JSC::constructSet):

  • runtime/SetIteratorPrototype.cpp:

(JSC::SetIteratorPrototypeFuncNext):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::putEntry):
(JSC::SparseArrayEntry::put):

  • runtime/TemplateRegistry.cpp:

(JSC::TemplateRegistry::getTemplateObject):

Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r209015 r209018  
     12016-11-26  Mark Lam  <mark.lam@apple.com>
     2
     3        Fix exception scope verification failures in miscellaneous files.
     4        https://bugs.webkit.org/show_bug.cgi?id=165055
     5
     6        Reviewed by Saam Barati.
     7
     8        * runtime/MathObject.cpp:
     9        (JSC::mathProtoFuncIMul):
     10        * runtime/ModuleLoaderPrototype.cpp:
     11        (JSC::moduleLoaderPrototypeParseModule):
     12        (JSC::moduleLoaderPrototypeRequestedModules):
     13        * runtime/NativeErrorConstructor.cpp:
     14        (JSC::Interpreter::constructWithNativeErrorConstructor):
     15        * runtime/NumberConstructor.cpp:
     16        (JSC::constructWithNumberConstructor):
     17        * runtime/SetConstructor.cpp:
     18        (JSC::constructSet):
     19        * runtime/SetIteratorPrototype.cpp:
     20        (JSC::SetIteratorPrototypeFuncNext):
     21        * runtime/SparseArrayValueMap.cpp:
     22        (JSC::SparseArrayValueMap::putEntry):
     23        (JSC::SparseArrayEntry::put):
     24        * runtime/TemplateRegistry.cpp:
     25        (JSC::TemplateRegistry::getTemplateObject):
     26
    1272016-11-28  Mark Lam  <mark.lam@apple.com>
    228
  • trunk/Source/JavaScriptCore/runtime/MathObject.cpp

    r208209 r209018  
    298298    int32_t left = exec->argument(0).toInt32(exec);
    299299    RETURN_IF_EXCEPTION(scope, encodedJSValue());
     300    scope.release();
    300301    int32_t right = exec->argument(1).toInt32(exec);
    301302    return JSValue::encode(jsNumber(left * right));
  • trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp

    r206653 r209018  
    134134
    135135    ModuleAnalyzer moduleAnalyzer(exec, moduleKey, sourceCode, moduleProgramNode->varDeclarations(), moduleProgramNode->lexicalVariables());
     136    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    136137    JSModuleRecord* moduleRecord = moduleAnalyzer.analyze(*moduleProgramNode);
    137138
     
    144145    auto scope = DECLARE_THROW_SCOPE(vm);
    145146    JSModuleRecord* moduleRecord = jsDynamicCast<JSModuleRecord*>(exec->argument(0));
    146     if (!moduleRecord)
     147    if (!moduleRecord) {
     148        scope.release();
    147149        return JSValue::encode(constructEmptyArray(exec, nullptr));
     150    }
    148151
    149152    JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size());
    150153    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    151154    size_t i = 0;
    152     for (auto& key : moduleRecord->requestedModules())
     155    for (auto& key : moduleRecord->requestedModules()) {
    153156        result->putDirectIndex(exec, i++, jsString(exec, key.get()));
    154 
     157        RETURN_IF_EXCEPTION(scope, encodedJSValue());
     158    }
    155159    return JSValue::encode(result);
    156160}
  • trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp

    r206386 r209018  
    7070    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7171    ASSERT(errorStructure);
     72    scope.release();
    7273    return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
    7374}
  • trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp

    r206386 r209018  
    8989    auto scope = DECLARE_THROW_SCOPE(vm);
    9090    double n = exec->argumentCount() ? exec->uncheckedArgument(0).toNumber(exec) : 0;
     91    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9192    Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), exec->lexicalGlobalObject()->numberObjectStructure());
    9293    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    9394
    94     NumberObject* object = NumberObject::create(exec->vm(), structure);
    95     object->setInternalValue(exec->vm(), jsNumber(n));
     95    NumberObject* object = NumberObject::create(vm, structure);
     96    object->setInternalValue(vm, jsNumber(n));
    9697    return JSValue::encode(object);
    9798}
  • trunk/Source/JavaScriptCore/runtime/SetConstructor.cpp

    r206386 r209018  
    6969        return JSValue::encode(set);
    7070
    71     JSValue adderFunction = set->get(exec, exec->propertyNames().add);
     71    JSValue adderFunction = set->get(exec, vm.propertyNames->add);
    7272    RETURN_IF_EXCEPTION(scope, encodedJSValue());
    7373
    7474    CallData adderFunctionCallData;
    7575    CallType adderFunctionCallType = getCallData(adderFunction, adderFunctionCallData);
    76     if (adderFunctionCallType == CallType::None)
     76    if (UNLIKELY(adderFunctionCallType == CallType::None))
    7777        return JSValue::encode(throwTypeError(exec, scope));
    7878
     79    scope.release();
    7980    forEachInIterable(exec, iterable, [&](VM&, ExecState* exec, JSValue nextValue) {
    8081        MarkedArgumentBuffer arguments;
  • trunk/Source/JavaScriptCore/runtime/SetIteratorPrototype.cpp

    r205520 r209018  
    11/*
    2  * Copyright (C) 2013 Apple, Inc. All rights reserved.
     2 * Copyright (C) 2013, 2016 Apple, Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5757        return JSValue::encode(throwTypeError(callFrame, scope, ASCIILiteral("Cannot call SetIterator.next() on a non-SetIterator object")));
    5858
    59     if (iterator->next(callFrame, result))
     59    if (iterator->next(callFrame, result)) {
     60        scope.release();
    6061        return JSValue::encode(createIteratorResultObject(callFrame, result, false));
     62    }
     63    scope.release();
    6164    return JSValue::encode(createIteratorResultObject(callFrame, jsUndefined(), true));
    6265}
  • trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp

    r207859 r209018  
    106106    }
    107107   
     108    scope.release();
    108109    return entry.put(exec, array, this, value, shouldThrow);
    109110}
     
    167168    }
    168169
     170    scope.release();
    169171    return callSetter(exec, thisValue, Base::get(), value, shouldThrow ? StrictMode : NotStrictMode);
    170172}
  • trunk/Source/JavaScriptCore/runtime/TemplateRegistry.cpp

    r208953 r209018  
    6060    for (unsigned index = 0; index < count; ++index) {
    6161        templateObject->putDirectIndex(exec, index, jsString(exec, templateKey.cookedStrings()[index]), ReadOnly | DontDelete, PutDirectIndexLikePutDirect);
     62        RETURN_IF_EXCEPTION(scope, nullptr);
    6263        rawObject->putDirectIndex(exec, index, jsString(exec, templateKey.rawStrings()[index]), ReadOnly | DontDelete, PutDirectIndexLikePutDirect);
     64        RETURN_IF_EXCEPTION(scope, nullptr);
    6365    }
    6466
     
    6668    ASSERT(!scope.exception());
    6769
    68     templateObject->putDirect(vm, exec->propertyNames().raw, rawObject, ReadOnly | DontEnum | DontDelete);
     70    templateObject->putDirect(vm, vm.propertyNames->raw, rawObject, ReadOnly | DontEnum | DontDelete);
    6971
    7072    // Template JSArray hold the reference to JSTemplateRegistryKey to make TemplateRegistryKey pointer live until this JSArray is collected.
Note: See TracChangeset for help on using the changeset viewer.