diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/API/JSBase.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/API/JSBase.cpp')
-rw-r--r-- | Source/JavaScriptCore/API/JSBase.cpp | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/Source/JavaScriptCore/API/JSBase.cpp b/Source/JavaScriptCore/API/JSBase.cpp index 6b2a907f1..506561573 100644 --- a/Source/JavaScriptCore/API/JSBase.cpp +++ b/Source/JavaScriptCore/API/JSBase.cpp @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -28,23 +28,18 @@ #include "JSBasePrivate.h" #include "APICast.h" +#include "APIShims.h" #include "CallFrame.h" #include "Completion.h" -#include "Exception.h" -#include "GCActivityCallback.h" #include "InitializeThreading.h" #include "JSGlobalObject.h" #include "JSLock.h" #include "JSObject.h" #include "OpaqueJSString.h" -#include "JSCInlines.h" +#include "Operations.h" #include "SourceCode.h" #include <wtf/text/StringHash.h> -#if ENABLE(REMOTE_INSPECTOR) -#include "JSGlobalObjectInspectorController.h" -#endif - using namespace JSC; JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) @@ -54,7 +49,7 @@ JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef th return 0; } ExecState* exec = toJS(ctx); - JSLockHolder locker(exec); + APIEntryShim entryShim(exec); JSObject* jsThisObject = toJS(thisObject); @@ -62,22 +57,14 @@ JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef th // evaluate sets "this" to the global object if it is NULL JSGlobalObject* globalObject = exec->vmEntryGlobalObject(); - SourceCode source = makeSource(script->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); + SourceCode source = makeSource(script->string(), sourceURL->string(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); - NakedPtr<Exception> evaluationException; - JSValue returnValue = profiledEvaluate(globalObject->globalExec(), ProfilingReason::API, source, jsThisObject, evaluationException); + JSValue evaluationException; + JSValue returnValue = evaluate(globalObject->globalExec(), source, jsThisObject, &evaluationException); if (evaluationException) { if (exception) - *exception = toRef(exec, evaluationException->value()); -#if ENABLE(REMOTE_INSPECTOR) - // FIXME: If we have a debugger attached we could learn about ParseError exceptions through - // ScriptDebugServer::sourceParsed and this path could produce a duplicate warning. The - // Debugger path is currently ignored by inspector. - // NOTE: If we don't have a debugger, this SourceCode will be forever lost to the inspector. - // We could stash it in the inspector in case an inspector is ever opened. - globalObject->inspectorController().reportAPIException(exec, evaluationException); -#endif + *exception = toRef(exec, evaluationException); return 0; } @@ -95,11 +82,11 @@ bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourc return false; } ExecState* exec = toJS(ctx); - JSLockHolder locker(exec); + APIEntryShim entryShim(exec); startingLineNumber = std::max(1, startingLineNumber); - SourceCode source = makeSource(script->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); + SourceCode source = makeSource(script->string(), sourceURL->string(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first())); JSValue syntaxException; bool isValidSyntax = checkSyntax(exec->vmEntryGlobalObject()->globalExec(), source, &syntaxException); @@ -107,10 +94,6 @@ bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourc if (!isValidSyntax) { if (exception) *exception = toRef(exec, syntaxException); -#if ENABLE(REMOTE_INSPECTOR) - Exception* exception = Exception::create(exec->vm(), syntaxException); - exec->vmEntryGlobalObject()->inspectorController().reportAPIException(exec, exception); -#endif return false; } @@ -128,7 +111,7 @@ void JSGarbageCollect(JSContextRef ctx) return; ExecState* exec = toJS(ctx); - JSLockHolder locker(exec); + APIEntryShim entryShim(exec, false); exec->vm().heap.reportAbandonedObjectGraph(); } @@ -140,13 +123,11 @@ void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) return; } ExecState* exec = toJS(ctx); - JSLockHolder locker(exec); - - exec->vm().heap.deprecatedReportExtraMemory(size); + APIEntryShim entryShim(exec); + exec->vm().heap.reportExtraMemoryCost(size); } extern "C" JS_EXPORT void JSSynchronousGarbageCollectForDebugging(JSContextRef); -extern "C" JS_EXPORT void JSSynchronousEdenCollectForDebugging(JSContextRef); void JSSynchronousGarbageCollectForDebugging(JSContextRef ctx) { @@ -154,20 +135,10 @@ void JSSynchronousGarbageCollectForDebugging(JSContextRef ctx) return; ExecState* exec = toJS(ctx); - JSLockHolder locker(exec); + APIEntryShim entryShim(exec); exec->vm().heap.collectAllGarbage(); } -void JSSynchronousEdenCollectForDebugging(JSContextRef ctx) -{ - if (!ctx) - return; - - ExecState* exec = toJS(ctx); - JSLockHolder locker(exec); - exec->vm().heap.collect(EdenCollection); -} - void JSDisableGCTimer(void) { GCActivityCallback::s_shouldCreateGCTimer = false; |