diff options
Diffstat (limited to 'JavaScriptGlue')
22 files changed, 386 insertions, 83 deletions
diff --git a/JavaScriptGlue/ChangeLog b/JavaScriptGlue/ChangeLog index c74b808..502a764 100644 --- a/JavaScriptGlue/ChangeLog +++ b/JavaScriptGlue/ChangeLog @@ -1,3 +1,211 @@ +2009-08-07 Oliver Hunt <oliver@apple.com> + + Reviewed by Sam Weinig. + + Stack overflow crash in JavaScript garbage collector mark pass + https://bugs.webkit.org/show_bug.cgi?id=12216 + + Make JSGlue interact with the new iterative mark logic. + + * JSValueWrapper.cpp: + (JSValueWrapper::JSObjectMark): + Unfortunately JSGlue exposes recursive marking so we can only flatten + the recursion. We just create a local mark stack if necessary and mark + the given object iteratively from this point. + * UserObjectImp.cpp: + (UserObjectImp::markChildren): + * UserObjectImp.h: + +2009-08-06 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Sam Weinig. + + Add explicit dependencies for our build verification scripts to ensure that they always run after linking has completed. + + * JavaScriptGlue.xcodeproj/project.pbxproj: + +2009-07-27 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=27735 + Give a helpful name to JSLock constructor argument + + * JSBase.cpp: + (JSBase::Release): + * JSUtils.cpp: + (JSObjectKJSValue): + (KJSValueToCFTypeInternal): + (unprotectGlobalObject): + * JSValueWrapper.cpp: + (JSValueWrapper::JSObjectCopyPropertyNames): + (JSValueWrapper::JSObjectCopyProperty): + (JSValueWrapper::JSObjectSetProperty): + (JSValueWrapper::JSObjectCallFunction): + (JSValueWrapper::JSObjectCopyCFValue): + * JavaScriptGlue.cpp: + (JSRunCreate): + (JSRunEvaluate): + (JSRunCheckSyntax): + (JSCollect): + (JSLockInterpreter): + (JSUnlockInterpreter): + +2009-07-10 Adam Roben <aroben@apple.com> + + Sort all our Xcode projects + + Accomplished using sort-Xcode-project-file. + + Requested by Dave Kilzer. + + * JavaScriptGlue.xcodeproj/project.pbxproj: + +2009-07-08 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein + + - fix <rdar://problem/6971484> REGRESSION (r30534): "Scrolling Credits" + effect does not scroll on iMovie 7.1.4 on Tiger + + In <http://trac.webkit.org/changeset/30534>, the prototype of + JSObject::put() which UserObjectImp had been overriding changed, but + UserObjectImp wasn't updated, so its override was no longer getting + called after that. + + * UserObjectImp.cpp: + (UserObjectImp::put): Match the current prototype of JSObject::put(). + The PutPropertySlot argument is unused. + * UserObjectImp.h: Ditto. + +2009-06-19 Zoltan Horvath <hzoltan@inf.u-szeged.hu> + + Reviewed by Darin Adler. + + Add FastAllocBase.h to JavaScriptGlue's ForwardingHeaders/wtf, because it's needed by HashCountedSet.h on MAC. + + * ForwardingHeaders/wtf/FastAllocBase.h: Added. + +2009-06-02 Mark Rowe <mrowe@apple.com> + + Reviewed by Anders Carlsson. + + Remove workaround that was added to address <rdar://problem/5488678> as it no longer affects our Tiger builds. + + * Configurations/Base.xcconfig: + +2009-05-25 David Levin <levin@chromium.org> + + Reviewed by Maciej Stachowiak and Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=25126 + + Added forwarding headers. + + * ForwardingHeaders/wtf/CrossThreadRefCounted.h: Added. + * ForwardingHeaders/wtf/OwnFastMallocPtr.h: Added. + +2009-05-23 David Kilzer <ddkilzer@apple.com> + + Part 1 of 2: Bug 25495: Implement PassOwnPtr and replace uses of std::auto_ptr + + <https://bugs.webkit.org/show_bug.cgi?id=25495> + + Reviewed by Oliver Hunt. + + * ForwardingHeaders/wtf/OwnPtrCommon.h: Added. + * ForwardingHeaders/wtf/PassOwnPtr.h: Added. + +2009-05-14 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Darin Adler. + + <rdar://problem/6681868> When building with Xcode 3.1.3 should be using gcc 4.2 + + The meaning of XCODE_VERSION_ACTUAL is more sensible in newer versions of Xcode. + Update our logic to select the compiler version to use the more appropriate XCODE_VERSION_MINOR + if the version of Xcode supports it, and fall back to XCODE_VERSION_ACTUAL if not. + + * Configurations/Base.xcconfig: + +2009-05-07 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Add calling convention annotation + + * JSObject.cpp: + +2009-05-01 Geoffrey Garen <ggaren@apple.com> + + Rubber Stamped by Sam Weinig. + + Renamed JSValuePtr => JSValue. + + * JSObject.cpp: + (nativeCallFunction): + * JSUtils.cpp: + (KJSValueToJSObject): + (JSObjectKJSValue): + (KJSValueToCFTypeInternal): + (KJSValueToCFType): + * JSUtils.h: + * JSValueWrapper.cpp: + (JSValueWrapper::JSValueWrapper): + (JSValueWrapper::GetValue): + (JSValueWrapper::JSObjectCopyProperty): + (JSValueWrapper::JSObjectSetProperty): + (JSValueWrapper::JSObjectCallFunction): + * JSValueWrapper.h: + * UserObjectImp.cpp: + (UserObjectImp::callAsFunction): + (UserObjectImp::userObjectGetter): + (UserObjectImp::getOwnPropertySlot): + (UserObjectImp::put): + (UserObjectImp::toPrimitive): + * UserObjectImp.h: + (UserObjectImp::createStructure): + +2009-04-29 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Clean up ArgList to be a trivial type + + Start using MarkedArgumentBuffer to create argument lists for function calls + + * JSValueWrapper.cpp: + (JSValueWrapper::JSObjectCallFunction): + +2009-04-28 Geoffrey Garen <ggaren@apple.com> + + Rubber stamped by Beth Dakin. + + Missed one. + + * UserObjectImp.cpp: + (UserObjectImp::callAsFunction): + +2009-04-21 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Mark Rowe. + + Tiger crash fix: Put VM tags in their own header file, and fixed up the + #ifdefs so they're not used on Tiger. + + * ForwardingHeaders/wtf/VMTags.h: Copied from JavaScriptGlue/ForwardingHeaders/wtf/HashTraits.h. + +2009-04-20 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Tim Hatcher. + + Add licenses for xcconfig files. + + * Configurations/Base.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/JavaScriptGlue.xcconfig: + * Configurations/Version.xcconfig: + 2009-03-13 Mark Rowe <mrowe@apple.com> Rubber-stamped by Dan Bernstein. diff --git a/JavaScriptGlue/Configurations/Base.xcconfig b/JavaScriptGlue/Configurations/Base.xcconfig index c7eee79..6f28a0d 100644 --- a/JavaScriptGlue/Configurations/Base.xcconfig +++ b/JavaScriptGlue/Configurations/Base.xcconfig @@ -1,3 +1,26 @@ +// Copyright (C) 2009 Apple Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// 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 +// 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 +// 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 +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -9,6 +32,7 @@ GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_SYMBOL_SEPARATION = NO; GCC_FAST_OBJC_DISPATCH = YES; +GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -48,21 +72,10 @@ STRIP_INSTALLED_PRODUCT_normal = YES; STRIP_INSTALLED_PRODUCT_debug = NO; -GCC_VERSION = $(GCC_VERSION_$(XCODE_VERSION_ACTUAL)); +// Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0. +// Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version +// number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and +// XCODE_VERSION_ACTUAL for the full version number. +GCC_VERSION = $(GCC_VERSION_$(XCODE_VERSION_MINOR)); +GCC_VERSION_ = $(GCC_VERSION_$(XCODE_VERSION_ACTUAL)); GCC_VERSION_0310 = 4.2; - - -// <rdar://problem/5488678>: Production builds on 10.4 PowerPC need to have debugging symbols disabled to prevent a huge STABS section being generated. -// Xcode on 10.4 does not define MAC_OS_X_VERSION_MAJOR, so the default Mac OS X version is treated as 10.4. -GCC_GENERATE_DEBUGGING_SYMBOLS = $(GCC_GENERATE_DEBUGGING_SYMBOLS_$(CURRENT_ARCH)); -GCC_GENERATE_DEBUGGING_SYMBOLS_i386 = YES; -GCC_GENERATE_DEBUGGING_SYMBOLS_x86_64 = YES; -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc64 = YES; -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc = $(GCC_GENERATE_DEBUGGING_SYMBOLS_$(CURRENT_ARCH)_$(CONFIGURATION)); -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc_Debug = YES; -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc_Release = YES; -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc_Production = $(GCC_GENERATE_DEBUGGING_SYMBOLS_$(CURRENT_ARCH)_$(CONFIGURATION)_$(MAC_OS_X_VERSION_MAJOR)); -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc_Production_ = NO; -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc_Production_1040 = NO; -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc_Production_1050 = YES; -GCC_GENERATE_DEBUGGING_SYMBOLS_ppc_Production_1060 = YES; diff --git a/JavaScriptGlue/Configurations/DebugRelease.xcconfig b/JavaScriptGlue/Configurations/DebugRelease.xcconfig index a9c39aa..5161969 100644 --- a/JavaScriptGlue/Configurations/DebugRelease.xcconfig +++ b/JavaScriptGlue/Configurations/DebugRelease.xcconfig @@ -1,3 +1,26 @@ +// Copyright (C) 2009 Apple Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// 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 +// 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 +// 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 +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include "Base.xcconfig" ARCHS = $(ARCHS_$(MAC_OS_X_VERSION_MAJOR)); diff --git a/JavaScriptGlue/Configurations/JavaScriptGlue.xcconfig b/JavaScriptGlue/Configurations/JavaScriptGlue.xcconfig index eacdcab..8fc997d 100644 --- a/JavaScriptGlue/Configurations/JavaScriptGlue.xcconfig +++ b/JavaScriptGlue/Configurations/JavaScriptGlue.xcconfig @@ -1,3 +1,26 @@ +// Copyright (C) 2009 Apple Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// 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 +// 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 +// 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 +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include "Version.xcconfig" EXPORTED_SYMBOLS_FILE = JavaScriptGlue.exp; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS); diff --git a/JavaScriptGlue/Configurations/Version.xcconfig b/JavaScriptGlue/Configurations/Version.xcconfig index ab0aa9b..d07d57f 100644 --- a/JavaScriptGlue/Configurations/Version.xcconfig +++ b/JavaScriptGlue/Configurations/Version.xcconfig @@ -1,5 +1,28 @@ -MAJOR_VERSION = 530; -MINOR_VERSION = 5; +// Copyright (C) 2009 Apple Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// 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 +// 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 +// 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 +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +MAJOR_VERSION = 532; +MINOR_VERSION = 0; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/CrossThreadRefCounted.h b/JavaScriptGlue/ForwardingHeaders/wtf/CrossThreadRefCounted.h new file mode 100644 index 0000000..26987ef --- /dev/null +++ b/JavaScriptGlue/ForwardingHeaders/wtf/CrossThreadRefCounted.h @@ -0,0 +1 @@ +#include <JavaScriptCore/CrossThreadRefCounted.h> diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/FastAllocBase.h b/JavaScriptGlue/ForwardingHeaders/wtf/FastAllocBase.h new file mode 100644 index 0000000..421c040 --- /dev/null +++ b/JavaScriptGlue/ForwardingHeaders/wtf/FastAllocBase.h @@ -0,0 +1 @@ +#include <JavaScriptCore/FastAllocBase.h> diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/OwnFastMallocPtr.h b/JavaScriptGlue/ForwardingHeaders/wtf/OwnFastMallocPtr.h new file mode 100644 index 0000000..036d801 --- /dev/null +++ b/JavaScriptGlue/ForwardingHeaders/wtf/OwnFastMallocPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/OwnFastMallocPtr.h> diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/OwnPtrCommon.h b/JavaScriptGlue/ForwardingHeaders/wtf/OwnPtrCommon.h new file mode 100644 index 0000000..4917541 --- /dev/null +++ b/JavaScriptGlue/ForwardingHeaders/wtf/OwnPtrCommon.h @@ -0,0 +1 @@ +#include <JavaScriptCore/OwnPtrCommon.h> diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/PassOwnPtr.h b/JavaScriptGlue/ForwardingHeaders/wtf/PassOwnPtr.h new file mode 100644 index 0000000..6064e88 --- /dev/null +++ b/JavaScriptGlue/ForwardingHeaders/wtf/PassOwnPtr.h @@ -0,0 +1 @@ +#include <JavaScriptCore/PassOwnPtr.h> diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/VMTags.h b/JavaScriptGlue/ForwardingHeaders/wtf/VMTags.h new file mode 100644 index 0000000..fda3516 --- /dev/null +++ b/JavaScriptGlue/ForwardingHeaders/wtf/VMTags.h @@ -0,0 +1 @@ +#include <JavaScriptCore/VMTags.h> diff --git a/JavaScriptGlue/JSBase.cpp b/JavaScriptGlue/JSBase.cpp index 8728096..7d44abc 100644 --- a/JavaScriptGlue/JSBase.cpp +++ b/JavaScriptGlue/JSBase.cpp @@ -46,7 +46,7 @@ void JSBase::Release() { if (--fRetainCount == 0) { - JSLock lock(true); + JSLock lock(LockForReal); delete this; } } diff --git a/JavaScriptGlue/JSObject.cpp b/JavaScriptGlue/JSObject.cpp index ba970a5..1d50bce 100644 --- a/JavaScriptGlue/JSObject.cpp +++ b/JavaScriptGlue/JSObject.cpp @@ -73,7 +73,8 @@ void JSUserObject::SetProperty(CFStringRef propertyName, JSUserObject* value) } -static JSValuePtr nativeCallFunction(ExecState* exec, JSObject* functionObject, JSValuePtr thisValue, const ArgList& args) +static JSValue JSC_HOST_CALL nativeCallFunction(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args); +static JSValue nativeCallFunction(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args) { return static_cast<UserObjectImp*>(functionObject)->callAsFunction(exec, asObject(thisValue), args); } diff --git a/JavaScriptGlue/JSUtils.cpp b/JavaScriptGlue/JSUtils.cpp index e5b758e..e6078fe 100644 --- a/JavaScriptGlue/JSUtils.cpp +++ b/JavaScriptGlue/JSUtils.cpp @@ -43,7 +43,7 @@ struct ObjectImpList { CFTypeRef data; }; -static CFTypeRef KJSValueToCFTypeInternal(JSValuePtr inValue, ExecState *exec, ObjectImpList* inImps); +static CFTypeRef KJSValueToCFTypeInternal(JSValue inValue, ExecState *exec, ObjectImpList* inImps); static JSGlueGlobalObject* getThreadGlobalObject(); //-------------------------------------------------------------------------- @@ -100,7 +100,7 @@ CFStringRef IdentifierToCFString(const Identifier& inIdentifier) //-------------------------------------------------------------------------- // KJSValueToJSObject //-------------------------------------------------------------------------- -JSUserObject* KJSValueToJSObject(JSValuePtr inValue, ExecState *exec) +JSUserObject* KJSValueToJSObject(JSValue inValue, ExecState *exec) { JSUserObject* result = 0; @@ -126,11 +126,11 @@ JSUserObject* KJSValueToJSObject(JSValuePtr inValue, ExecState *exec) //-------------------------------------------------------------------------- // JSObjectKJSValue //-------------------------------------------------------------------------- -JSValuePtr JSObjectKJSValue(JSUserObject* ptr) +JSValue JSObjectKJSValue(JSUserObject* ptr) { - JSLock lock(true); + JSLock lock(LockForReal); - JSValuePtr result = jsUndefined(); + JSValue result = jsUndefined(); if (ptr) { bool handled = false; @@ -196,14 +196,14 @@ JSValuePtr JSObjectKJSValue(JSUserObject* ptr) // KJSValueToCFTypeInternal //-------------------------------------------------------------------------- // Caller is responsible for releasing the returned CFTypeRef -CFTypeRef KJSValueToCFTypeInternal(JSValuePtr inValue, ExecState *exec, ObjectImpList* inImps) +CFTypeRef KJSValueToCFTypeInternal(JSValue inValue, ExecState *exec, ObjectImpList* inImps) { if (!inValue) return 0; CFTypeRef result = 0; - JSLock lock(true); + JSLock lock(LockForReal); if (inValue.isBoolean()) { @@ -358,7 +358,7 @@ CFTypeRef KJSValueToCFTypeInternal(JSValuePtr inValue, ExecState *exec, ObjectIm return 0; } -CFTypeRef KJSValueToCFType(JSValuePtr inValue, ExecState *exec) +CFTypeRef KJSValueToCFType(JSValue inValue, ExecState *exec) { return KJSValueToCFTypeInternal(inValue, exec, 0); } @@ -394,7 +394,7 @@ static pthread_once_t globalObjectKeyOnce = PTHREAD_ONCE_INIT; static void unprotectGlobalObject(void* data) { - JSLock lock(true); + JSLock lock(LockForReal); gcUnprotect(static_cast<JSGlueGlobalObject*>(data)); } diff --git a/JavaScriptGlue/JSUtils.h b/JavaScriptGlue/JSUtils.h index fd65054..fee2663 100644 --- a/JavaScriptGlue/JSUtils.h +++ b/JavaScriptGlue/JSUtils.h @@ -54,9 +54,9 @@ UString CFStringToUString(CFStringRef inCFString); CFStringRef UStringToCFString(const UString& inUString); Identifier CFStringToIdentifier(CFStringRef inCFString, ExecState*); CFStringRef IdentifierToCFString(const Identifier& inIdentifier); -JSUserObject *KJSValueToJSObject(JSValuePtr inValue, ExecState *exec); -CFTypeRef KJSValueToCFType(JSValuePtr inValue, ExecState *exec); -JSValuePtr JSObjectKJSValue(JSUserObject* ptr); +JSUserObject *KJSValueToJSObject(JSValue inValue, ExecState *exec); +CFTypeRef KJSValueToCFType(JSValue inValue, ExecState *exec); +JSValue JSObjectKJSValue(JSUserObject* ptr); CFTypeRef GetCFNull(void); inline CFTypeRef RetainCFType(CFTypeRef x) { if (x) x = CFRetain(x); return x; } diff --git a/JavaScriptGlue/JSValueWrapper.cpp b/JavaScriptGlue/JSValueWrapper.cpp index 2f1ac09..d649d4a 100644 --- a/JavaScriptGlue/JSValueWrapper.cpp +++ b/JavaScriptGlue/JSValueWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2009 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,7 @@ #include <JavaScriptCore/PropertyNameArray.h> #include <pthread.h> -JSValueWrapper::JSValueWrapper(JSValuePtr inValue) +JSValueWrapper::JSValueWrapper(JSValue inValue) : fValue(inValue) { } @@ -41,7 +41,7 @@ JSValueWrapper::~JSValueWrapper() { } -JSValuePtr JSValueWrapper::GetValue() +JSValue JSValueWrapper::GetValue() { return fValue.get(); } @@ -66,7 +66,7 @@ void JSValueWrapper::JSObjectDispose(void *data) CFArrayRef JSValueWrapper::JSObjectCopyPropertyNames(void *data) { - JSLock lock(true); + JSLock lock(LockForReal); CFMutableArrayRef result = 0; JSValueWrapper* ptr = (JSValueWrapper*)data; @@ -101,14 +101,14 @@ CFArrayRef JSValueWrapper::JSObjectCopyPropertyNames(void *data) JSObjectRef JSValueWrapper::JSObjectCopyProperty(void *data, CFStringRef propertyName) { - JSLock lock(true); + JSLock lock(LockForReal); JSObjectRef result = 0; JSValueWrapper* ptr = (JSValueWrapper*)data; if (ptr) { ExecState* exec = getThreadGlobalExecState(); - JSValuePtr propValue = ptr->GetValue().toObject(exec)->get(exec, CFStringToIdentifier(propertyName, exec)); + JSValue propValue = ptr->GetValue().toObject(exec)->get(exec, CFStringToIdentifier(propertyName, exec)); JSValueWrapper* wrapperValue = new JSValueWrapper(propValue); JSObjectCallBacks callBacks; @@ -125,13 +125,13 @@ JSObjectRef JSValueWrapper::JSObjectCopyProperty(void *data, CFStringRef propert void JSValueWrapper::JSObjectSetProperty(void *data, CFStringRef propertyName, JSObjectRef jsValue) { - JSLock lock(true); + JSLock lock(LockForReal); JSValueWrapper* ptr = (JSValueWrapper*)data; if (ptr) { ExecState* exec = getThreadGlobalExecState(); - JSValuePtr value = JSObjectKJSValue((JSUserObject*)jsValue); + JSValue value = JSObjectKJSValue((JSUserObject*)jsValue); JSObject *objValue = ptr->GetValue().toObject(exec); PutPropertySlot slot; objValue->put(exec, CFStringToIdentifier(propertyName, exec), value, slot); @@ -140,7 +140,7 @@ void JSValueWrapper::JSObjectSetProperty(void *data, CFStringRef propertyName, J JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj, CFArrayRef args) { - JSLock lock(true); + JSLock lock(LockForReal); JSObjectRef result = 0; JSValueWrapper* ptr = (JSValueWrapper*)data; @@ -148,16 +148,16 @@ JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj { ExecState* exec = getThreadGlobalExecState(); - JSValuePtr value = JSObjectKJSValue((JSUserObject*)thisObj); + JSValue value = JSObjectKJSValue((JSUserObject*)thisObj); JSObject* ksjThisObj = value.toObject(exec); JSObject* objValue = ptr->GetValue().toObject(exec); - ArgList listArgs; + MarkedArgumentBuffer listArgs; CFIndex argCount = args ? CFArrayGetCount(args) : 0; for (CFIndex i = 0; i < argCount; i++) { JSObjectRef jsArg = (JSObjectRef)CFArrayGetValueAtIndex(args, i); - JSValuePtr kgsArg = JSObjectKJSValue((JSUserObject*)jsArg); + JSValue kgsArg = JSObjectKJSValue((JSUserObject*)jsArg); listArgs.append(kgsArg); } @@ -165,7 +165,7 @@ JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj CallType callType = objValue->getCallData(callData); if (callType == CallTypeNone) return 0; - JSValuePtr resultValue = call(exec, objValue, callType, callData, ksjThisObj, listArgs); + JSValue resultValue = call(exec, objValue, callType, callData, ksjThisObj, listArgs); JSValueWrapper* wrapperValue = new JSValueWrapper(resultValue); JSObjectCallBacks callBacks; GetJSObectCallBacks(callBacks); @@ -180,7 +180,7 @@ JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj CFTypeRef JSValueWrapper::JSObjectCopyCFValue(void *data) { - JSLock lock(true); + JSLock lock(LockForReal); CFTypeRef result = 0; JSValueWrapper* ptr = (JSValueWrapper*)data; @@ -194,8 +194,11 @@ CFTypeRef JSValueWrapper::JSObjectCopyCFValue(void *data) void JSValueWrapper::JSObjectMark(void *data) { JSValueWrapper* ptr = (JSValueWrapper*)data; - if (ptr) + if (ptr && !ptr->fValue.get().marked()) { - ptr->fValue.get().mark(); + // This results in recursive marking but will be otherwise safe and correct. + MarkStack markStack; + markStack.append(ptr->fValue.get()); + markStack.drain(); } } diff --git a/JavaScriptGlue/JSValueWrapper.h b/JavaScriptGlue/JSValueWrapper.h index 0140138..cd544d0 100644 --- a/JavaScriptGlue/JSValueWrapper.h +++ b/JavaScriptGlue/JSValueWrapper.h @@ -35,15 +35,15 @@ class JSValueWrapper { public: - JSValueWrapper(JSValuePtr); + JSValueWrapper(JSValue); virtual ~JSValueWrapper(); static void GetJSObectCallBacks(JSObjectCallBacks& callBacks); - JSValuePtr GetValue(); + JSValue GetValue(); private: - ProtectedJSValuePtr fValue; + ProtectedJSValue fValue; static void JSObjectDispose(void *data); static CFArrayRef JSObjectCopyPropertyNames(void *data); diff --git a/JavaScriptGlue/JavaScriptGlue.cpp b/JavaScriptGlue/JavaScriptGlue.cpp index 3b203cc..b4f26e9 100644 --- a/JavaScriptGlue/JavaScriptGlue.cpp +++ b/JavaScriptGlue/JavaScriptGlue.cpp @@ -246,7 +246,7 @@ JSRunRef JSRunCreate(CFStringRef jsSource, JSFlags inFlags) JSRunRef result = 0; if (jsSource) { - JSLock lock(true); + JSLock lock(LockForReal); result = (JSRunRef) new JSRun(jsSource, inFlags); } return result; @@ -291,7 +291,7 @@ JSObjectRef JSRunEvaluate(JSRunRef ref) JSRun* ptr = (JSRun*)ref; if (ptr) { - JSLock lock(true); + JSLock lock(LockForReal); Completion completion = ptr->Evaluate(); if (completion.isValueCompletion()) { @@ -325,7 +325,7 @@ bool JSRunCheckSyntax(JSRunRef ref) JSRun* ptr = (JSRun*)ref; if (ptr) { - JSLock lock(true); + JSLock lock(LockForReal); result = ptr->CheckSyntax(); } return result; @@ -338,7 +338,7 @@ void JSCollect() { initializeThreading(); - JSLock lock(true); + JSLock lock(LockForReal); getThreadGlobalExecState()->heap()->collect(); } @@ -649,11 +649,11 @@ CFMutableArrayRef JSCreateJSArrayFromCFArray(CFArrayRef array) void JSLockInterpreter() { initializeThreading(); - JSLock::lock(true); + JSLock::lock(LockForReal); } void JSUnlockInterpreter() { - JSLock::unlock(true); + JSLock::unlock(LockForReal); } diff --git a/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj b/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj index de76e8d..f40be08 100644 --- a/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj +++ b/JavaScriptGlue/JavaScriptGlue.xcodeproj/project.pbxproj @@ -168,6 +168,9 @@ 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( + F11798B20262465703CA149D /* JavaScriptGlue.cpp */, + F1EB7EAB02621EAF03CA149D /* JavaScriptGlue.exp */, + F11798B30262465703CA149D /* JavaScriptGlue.h */, F11798B8026246FD03CA149D /* JSBase.cpp */, F11798B9026246FD03CA149D /* JSBase.h */, F11798BA026246FD03CA149D /* JSObject.cpp */, @@ -178,9 +181,6 @@ F11798B7026246FD03CA149D /* JSUtils.h */, F11798C80262545403CA149D /* JSValueWrapper.cpp */, F11798C90262545403CA149D /* JSValueWrapper.h */, - F11798B20262465703CA149D /* JavaScriptGlue.cpp */, - F1EB7EAB02621EAF03CA149D /* JavaScriptGlue.exp */, - F11798B30262465703CA149D /* JavaScriptGlue.h */, F11798CE0262579C03CA149D /* UserObjectImp.cpp */, F11798CF0262579C03CA149D /* UserObjectImp.h */, ); @@ -227,12 +227,12 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + DD66F3BB08F73ED700C75FD7 /* JavaScriptGlue.h in Headers */, DD66F3BC08F73ED700C75FD7 /* JSBase.h in Headers */, DD66F3BE08F73ED700C75FD7 /* JSObject.h in Headers */, DD66F3BF08F73ED700C75FD7 /* JSRun.h in Headers */, DD66F3BD08F73ED700C75FD7 /* JSUtils.h in Headers */, DD66F3C008F73ED700C75FD7 /* JSValueWrapper.h in Headers */, - DD66F3BB08F73ED700C75FD7 /* JavaScriptGlue.h in Headers */, DD66F3C108F73ED700C75FD7 /* UserObjectImp.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -265,9 +265,9 @@ DD66F3BA08F73ED700C75FD7 /* Headers */, DD66F3C208F73ED700C75FD7 /* Resources */, DD66F3C408F73ED700C75FD7 /* Sources */, + DD66F3CD08F73ED700C75FD7 /* Frameworks */, 939D055E09DA033400984996 /* Check For Global Initializers */, 5D0D53490E9862A70029E223 /* Check For Weak VTables */, - DD66F3CD08F73ED700C75FD7 /* Frameworks */, 5DA0F0C00DC2B48900EA22B4 /* Remove Headers If Needed */, ); buildRules = ( @@ -318,6 +318,7 @@ files = ( ); inputPaths = ( + "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", ); name = "Check For Weak VTables"; outputPaths = ( @@ -362,6 +363,7 @@ files = ( ); inputPaths = ( + "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", ); name = "Check For Global Initializers"; outputPaths = ( @@ -385,12 +387,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + DD66F3C608F73ED700C75FD7 /* JavaScriptGlue.cpp in Sources */, DD66F3C908F73ED700C75FD7 /* JSBase.cpp in Sources */, DD66F3CA08F73ED700C75FD7 /* JSObject.cpp in Sources */, DD66F3C708F73ED700C75FD7 /* JSRun.cpp in Sources */, DD66F3C808F73ED700C75FD7 /* JSUtils.cpp in Sources */, DD66F3CB08F73ED700C75FD7 /* JSValueWrapper.cpp in Sources */, - DD66F3C608F73ED700C75FD7 /* JavaScriptGlue.cpp in Sources */, DD66F3CC08F73ED700C75FD7 /* UserObjectImp.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/JavaScriptGlue/UserObjectImp.cpp b/JavaScriptGlue/UserObjectImp.cpp index f40a18c..4e64ab1 100644 --- a/JavaScriptGlue/UserObjectImp.cpp +++ b/JavaScriptGlue/UserObjectImp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -56,9 +56,9 @@ CallType UserObjectImp::getCallData(CallData& callData) return fJSUserObject ? fJSUserObject->getCallData(callData) : CallTypeNone; } -JSValuePtr UserObjectImp::callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args) +JSValue UserObjectImp::callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args) { - JSValuePtr result = jsUndefined(); + JSValue result = jsUndefined(); JSUserObject* jsThisObj = KJSValueToJSObject(thisObj, exec); if (jsThisObj) { CFIndex argCount = args.size(); @@ -67,7 +67,7 @@ JSValuePtr UserObjectImp::callAsFunction(ExecState *exec, JSObject *thisObj, con CFMutableArrayRef jsArgs = CFArrayCreateMutable(0, 0, &arrayCallBacks); if (jsArgs) { for (CFIndex i = 0; i < argCount; i++) { - JSUserObject* jsArg = KJSValueToJSObject(args.at(exec, i), exec); + JSUserObject* jsArg = KJSValueToJSObject(args.at(i), exec); CFArrayAppendValue(jsArgs, (void*)jsArg); jsArg->Release(); } @@ -112,7 +112,7 @@ void UserObjectImp::getPropertyNames(ExecState *exec, PropertyNameArray& propert JSObject::getPropertyNames(exec, propertyNames); } -JSValuePtr UserObjectImp::userObjectGetter(ExecState*, const Identifier& propertyName, const PropertySlot& slot) +JSValue UserObjectImp::userObjectGetter(ExecState*, const Identifier& propertyName, const PropertySlot& slot) { UserObjectImp *thisObj = static_cast<UserObjectImp *>(asObject(slot.slotBase())); // getOwnPropertySlot should have guarded against a null fJSUserObject. @@ -121,7 +121,7 @@ JSValuePtr UserObjectImp::userObjectGetter(ExecState*, const Identifier& propert CFStringRef cfPropName = IdentifierToCFString(propertyName); JSUserObject *jsResult = thisObj->fJSUserObject->CopyProperty(cfPropName); ReleaseCFType(cfPropName); - JSValuePtr result = JSObjectKJSValue(jsResult); + JSValue result = JSObjectKJSValue(jsResult); jsResult->Release(); return result; @@ -140,7 +140,7 @@ bool UserObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& proper jsResult->Release(); return true; } else { - JSValuePtr kjsValue = toPrimitive(exec); + JSValue kjsValue = toPrimitive(exec); if (!kjsValue.isUndefinedOrNull()) { JSObject* kjsObject = kjsValue.toObject(exec); if (kjsObject->getPropertySlot(exec, propertyName, slot)) @@ -150,7 +150,7 @@ bool UserObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& proper return JSObject::getOwnPropertySlot(exec, propertyName, slot); } -void UserObjectImp::put(ExecState *exec, const Identifier &propertyName, JSValuePtr value, int attr) +void UserObjectImp::put(ExecState *exec, const Identifier &propertyName, JSValue value, PutPropertySlot&) { if (!fJSUserObject) return; @@ -169,9 +169,9 @@ JSUserObject* UserObjectImp::GetJSUserObject() const return fJSUserObject; } -JSValuePtr UserObjectImp::toPrimitive(ExecState *exec, JSType) const +JSValue UserObjectImp::toPrimitive(ExecState *exec, JSType) const { - JSValuePtr result = jsUndefined(); + JSValue result = jsUndefined(); JSUserObject* jsObjPtr = KJSValueToJSObject(toObject(exec), exec); CFTypeRef cfValue = jsObjPtr ? jsObjPtr->CopyCFValue() : 0; if (cfValue) { @@ -409,9 +409,9 @@ UString UserObjectImp::toString(ExecState *exec) const return result; } -void UserObjectImp::mark() +void UserObjectImp::markChildren(MarkStack& markStack) { - JSObject::mark(); + JSObject::markChildren(markStack); if (fJSUserObject) fJSUserObject->Mark(); } diff --git a/JavaScriptGlue/UserObjectImp.h b/JavaScriptGlue/UserObjectImp.h index 04e0e48..9791658 100644 --- a/JavaScriptGlue/UserObjectImp.h +++ b/JavaScriptGlue/UserObjectImp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,26 +46,26 @@ public: virtual void getPropertyNames(ExecState*, PropertyNameArray&); - virtual JSValuePtr callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args); + virtual JSValue callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args); virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); - virtual void put(ExecState *exec, const Identifier &propertyName, JSValuePtr value, int attr = None); + virtual void put(ExecState *exec, const Identifier &propertyName, JSValue value, PutPropertySlot&); - JSValuePtr toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const; + JSValue toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const; virtual bool toBoolean(ExecState *exec) const; virtual double toNumber(ExecState *exec) const; virtual UString toString(ExecState *exec) const; - virtual void mark(); + virtual void markChildren(MarkStack&); JSUserObject *GetJSUserObject() const; - static PassRefPtr<Structure> createStructure(JSValuePtr prototype) + static PassRefPtr<Structure> createStructure(JSValue prototype) { return Structure::create(prototype, TypeInfo(ObjectType)); } private: - static JSValuePtr userObjectGetter(ExecState*, const Identifier& propertyName, const PropertySlot&); + static JSValue userObjectGetter(ExecState*, const Identifier& propertyName, const PropertySlot&); JSUserObject* fJSUserObject; }; diff --git a/JavaScriptGlue/config.h b/JavaScriptGlue/config.h index 365c463..fdbd4ae 100644 --- a/JavaScriptGlue/config.h +++ b/JavaScriptGlue/config.h @@ -4,3 +4,4 @@ #include <wtf/Platform.h> +#define JS_EXPORTDATA |