author | Igor Bukanov <igor@mir2.org> |
Thu, 23 Dec 2010 22:41:57 +0100 | |
changeset 59931 | a42ff92a089eca76048a40430969c3df1bb9b99c |
parent 59930 | 5641d5c42b7c5b97b984d4aece75d1766fd510d0 |
child 59932 | 36d679f4570598c83e241be3656934f01bf76bed |
push id | 17820 |
push user | cleary@mozilla.com |
push date | Tue, 04 Jan 2011 21:40:57 +0000 |
treeherder | mozilla-central@969691cfe40e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | adrake |
bugs | 619641 |
milestone | 2.0b8pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/jsd/jsd_scpt.c | file | annotate | diff | comparison | revisions | |
js/jsd/jsd_stak.c | file | annotate | diff | comparison | revisions | |
js/jsd/jsd_val.c | file | annotate | diff | comparison | revisions | |
js/src/Makefile.in | file | annotate | diff | comparison | revisions | |
js/src/jsfriendapi.cpp | file | annotate | diff | comparison | revisions | |
js/src/jsfriendapi.h | file | annotate | diff | comparison | revisions |
--- a/js/jsd/jsd_scpt.c +++ b/js/jsd/jsd_scpt.c @@ -35,16 +35,17 @@ * * ***** END LICENSE BLOCK ***** */ /* * JavaScript Debugging support - Script support */ #include "jsd.h" +#include "jsfriendapi.h" /* Comment this out to disable (NT specific) dumping as we go */ /* ** #ifdef DEBUG ** #define JSD_DUMP 1 ** #endif */ @@ -499,17 +500,19 @@ jsd_GetScriptFilename(JSDContext* jsdc, JSString* jsd_GetScriptFunctionName(JSDContext* jsdc, JSDScript *jsdscript) { JSString* str; if( ! jsdscript->function ) return NULL; str = JS_GetFunctionId(jsdscript->function); - return str ? str : JS_GetEmptyString(jsdc->jsrt); + + /* For compatibility we return "anonymous", not an empty string here. */ + return str ? str : JS_GetAnonymousString(jsdc->jsrt); } uintN jsd_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript) { return jsdscript->lineBase; }
--- a/js/jsd/jsd_stak.c +++ b/js/jsd/jsd_stak.c @@ -35,16 +35,17 @@ * * ***** END LICENSE BLOCK ***** */ /* * JavaScript Debugging support - Call stack support */ #include "jsd.h" +#include "jsfriendapi.h" #ifdef DEBUG void JSD_ASSERT_VALID_THREAD_STATE(JSDThreadState* jsdthreadstate) { JS_ASSERT(jsdthreadstate); JS_ASSERT(jsdthreadstate->stackDepth > 0); } @@ -364,18 +365,27 @@ jsd_GetNameForStackFrame(JSDContext* jsd JSString *rv = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { JSFunction *fun = JS_GetFrameFunction (jsdthreadstate->context, jsdframe->fp); - if (fun) + if( fun ) + { rv = JS_GetFunctionId (fun); + + /* + * For compatibility we return "anonymous", not an empty string + * here. + */ + if( !rv ) + rv = JS_GetAnonymousString(jsdc->jsrt); + } } JSD_UNLOCK_THREADSTATES(jsdc); return rv; } JSBool jsd_IsStackFrameDebugger(JSDContext* jsdc,
--- a/js/jsd/jsd_val.c +++ b/js/jsd/jsd_val.c @@ -36,18 +36,17 @@ * ***** END LICENSE BLOCK ***** */ /* * JavaScript Debugging support - Value and Property support */ #include "jsd.h" #include "jsapi.h" -#include "jspubtd.h" -#include "jsprvtd.h" +#include "jsfriendapi.h" #ifdef DEBUG void JSD_ASSERT_VALID_VALUE(JSDValue* jsdval) { JS_ASSERT(jsdval); JS_ASSERT(jsdval->nref > 0); if(!JS_CLIST_IS_EMPTY(&jsdval->props)) { @@ -268,18 +267,20 @@ jsd_GetValueFunctionName(JSDContext* jsd exceptionState = JS_SaveExceptionState(cx); fun = JS_ValueToFunction(cx, jsdval->val); JS_RestoreExceptionState(cx, exceptionState); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); if(!fun) return NULL; jsdval->funName = JS_GetFunctionId(fun); + + /* For compatibility we return "anonymous", not an empty string here. */ if (!jsdval->funName) - jsdval->funName = JS_GetEmptyString(jsdc->jsrt); + jsdval->funName = JS_GetAnonymousString(jsdc->jsrt); } return jsdval->funName; } /***************************************************************************/ JSDValue* jsd_NewValue(JSDContext* jsdc, jsval val)
--- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -129,27 +129,28 @@ CPPSRCS = \ jsanalyze.cpp \ jsapi.cpp \ jsarena.cpp \ jsarray.cpp \ jsatom.cpp \ jsbool.cpp \ jsclone.cpp \ jscntxt.cpp \ + jscompartment.cpp \ jsdate.cpp \ jsdbgapi.cpp \ jsdhash.cpp \ jsdtoa.cpp \ jsemit.cpp \ jsexn.cpp \ + jsfriendapi.cpp \ jsfun.cpp \ jsgc.cpp \ jsgcchunk.cpp \ jsgcstats.cpp \ - jscompartment.cpp \ jshash.cpp \ jsinterp.cpp \ jsinvoke.cpp \ jsiter.cpp \ jslock.cpp \ jslog2.cpp \ jsmath.cpp \ jsnativestack.cpp \ @@ -194,16 +195,17 @@ INSTALLED_HEADERS = \ jscntxt.h \ jscompat.h \ jsdate.h \ jsdbgapi.h \ jsdhash.h \ jsdtoa.h \ jsemit.h \ jsfun.h \ + jsfriendapi.h \ jsgc.h \ jscell.h \ jsgcchunk.h \ jsgcstats.h \ jscompartment.h \ jshash.h \ jsinterp.h \ jsinttypes.h \
new file mode 100644 --- /dev/null +++ b/js/src/jsfriendapi.cpp @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=4 sw=4 et tw=99: + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is SpiderMonkey code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "jscntxt.h" +#include "jsfriendapi.h" + +JS_FRIEND_API(JSString *) +JS_GetAnonymousString(JSRuntime *rt) +{ + JS_ASSERT(rt->state == JSRTS_UP); + return ATOM_TO_STRING(rt->atomState.anonymousAtom); +}
new file mode 100644 --- /dev/null +++ b/js/src/jsfriendapi.h @@ -0,0 +1,53 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * + * The Original Code is SpiderMonkey code. + * + * The Initial Developer of the Original Code is + * Mozilla Corporation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef jsfriendapi_h___ +#define jsfriendapi_h___ + +#include "jspubtd.h" +#include "jsprvtd.h" + +JS_BEGIN_EXTERN_C + +extern JS_FRIEND_API(JSString *) +JS_GetAnonymousString(JSRuntime *rt); + +JS_END_EXTERN_C + +#endif /* jsfriendapi_h___ */