Changeset 206459 in webkit
- Timestamp:
- Sep 27, 2016, 1:32:13 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r206408 r206459 310 310 } 311 311 ExecState* exec = toJS(ctx); 312 JSLockHolder locker(exec); 312 VM& vm = exec->vm(); 313 JSLockHolder locker(vm); 314 auto scope = DECLARE_CATCH_SCOPE(vm); 313 315 314 316 JSObject* jsObject = toJS(object); … … 316 318 JSValue jsValue = toJS(exec, value); 317 319 318 if (attributes && !jsObject->hasProperty(exec, name)) { 319 PropertyDescriptor desc(jsValue, attributes); 320 jsObject->methodTable()->defineOwnProperty(jsObject, exec, name, desc, false); 321 } else { 322 PutPropertySlot slot(jsObject); 323 jsObject->methodTable()->put(jsObject, exec, name, jsValue, slot); 324 } 325 320 bool doesNotHaveProperty = attributes && !jsObject->hasProperty(exec, name); 321 if (LIKELY(!scope.exception())) { 322 if (doesNotHaveProperty) { 323 PropertyDescriptor desc(jsValue, attributes); 324 jsObject->methodTable()->defineOwnProperty(jsObject, exec, name, desc, false); 325 } else { 326 PutPropertySlot slot(jsObject); 327 jsObject->methodTable()->put(jsObject, exec, name, jsValue, slot); 328 } 329 } 326 330 handleExceptionIfNeeded(exec, exception); 327 331 } -
trunk/Source/JavaScriptCore/ChangeLog
r206440 r206459 1 2016-09-27 Mark Lam <mark.lam@apple.com> 2 3 Add some needed CatchScopes in code that should not throw. 4 https://bugs.webkit.org/show_bug.cgi?id=162584 5 6 Reviewed by Keith Miller. 7 8 Re-landing minus the jsc.cpp and ExceptionHelpers.cpp changes. I'll address 9 those in a subsequent patch if the need manifests again in my testing. 10 11 * API/JSObjectRef.cpp: 12 (JSObjectSetProperty): 13 - This function already handles exceptions in its own way. We're honoring this 14 contract and catching exceptions and passing it to the handler. 15 16 * interpreter/Interpreter.cpp: 17 (JSC::notifyDebuggerOfUnwinding): 18 - The debugger should not be throwing any exceptions. 19 20 * profiler/ProfilerDatabase.cpp: 21 (JSC::Profiler::Database::save): 22 - If an exception was thrown while saving the database, there's nothing we can 23 really do about it anyway. Just fail nicely and return false. This is in line 24 with existing error checking code in Database::save() that returns false if 25 it's not able to open the file to save to. 26 27 * runtime/JSModuleLoader.cpp: 28 (JSC::JSModuleLoader::finishCreation): 29 - The existing code already RELEASE_ASSERT that no exception was thrown. 30 Hence, it's appropriate to use a CatchScope here. 31 32 * runtime/SamplingProfiler.cpp: 33 (JSC::SamplingProfiler::StackFrame::nameFromCallee): 34 - The sampling profiler is doing a VMInquiry get here. It should never throw an 35 exception. Hence, we'll just use a CatchScope and assert accordingly. 36 1 37 2016-09-27 Jer Noble <jer.noble@apple.com> 2 38 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r206408 r206459 584 584 { 585 585 VM& vm = callFrame->vm(); 586 auto throwScope = DECLARE_THROW_SCOPE(vm);586 auto catchScope = DECLARE_CATCH_SCOPE(vm); 587 587 if (Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger()) { 588 588 SuspendExceptionScope scope(&vm); … … 591 591 else 592 592 debugger->didExecuteProgram(callFrame); 593 ASSERT_UNUSED( throwScope, !throwScope.exception());593 ASSERT_UNUSED(catchScope, !catchScope.exception()); 594 594 } 595 595 } -
trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp
r206408 r206459 135 135 bool Database::save(const char* filename) const 136 136 { 137 auto scope = DECLARE_CATCH_SCOPE(m_vm); 137 138 auto out = FilePrintStream::open(filename, "w"); 138 139 if (!out) 139 140 return false; 140 141 141 out->print(toJSON()); 142 String data = toJSON(); 143 if (UNLIKELY(scope.exception())) { 144 scope.clearException(); 145 return false; 146 } 147 out->print(data); 142 148 return true; 143 149 } -
trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
r206408 r206459 58 58 void JSModuleLoader::finishCreation(ExecState* exec, VM& vm, JSGlobalObject* globalObject) 59 59 { 60 auto scope = DECLARE_CATCH_SCOPE(vm); 61 60 62 Base::finishCreation(vm); 61 63 ASSERT(inherits(info())); 62 auto scope = DECLARE_THROW_SCOPE(vm);63 64 JSMap* map = JSMap::create(exec, vm, globalObject->mapStructure()); 64 65 RELEASE_ASSERT(!scope.exception()); -
trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp
r206408 r206459 592 592 return String(); 593 593 594 auto scope = DECLARE_CATCH_SCOPE(vm); 594 595 ExecState* exec = callee->globalObject()->globalExec(); 595 596 auto getPropertyIfPureOperation = [&] (const Identifier& ident) -> String { 596 597 PropertySlot slot(callee, PropertySlot::InternalMethodType::VMInquiry); 597 598 PropertyName propertyName(ident); 598 if (callee->getPropertySlot(exec, propertyName, slot)) { 599 bool hasProperty = callee->getPropertySlot(exec, propertyName, slot); 600 ASSERT_UNUSED(scope, !scope.exception()); 601 if (hasProperty) { 599 602 if (slot.isValue()) { 600 603 JSValue nameValue = slot.getValue(exec, propertyName);
Note:
See TracChangeset
for help on using the changeset viewer.