Commit Graph

286 Commits

Author SHA1 Message Date
Igor Bukanov
0eff99d625 bug 737624 - memory-only encoding/decoding of scripts and functions. r=:luke
The patch shrinks the API presented in jsxdrapi.h down to 4 functions to
encode/decode scripts and interpreted functions to/from the memory. The
newly introduced implementation header vm/Xdr.h replaces the former
JSXDRState with the template class XDRState parametrized by the enum
type with two constants, XDR_ENCODE and XDR_DECODE. This way a compiler
can fully eliminate the former runtime checks for the decoding/encoding
mode. As a drawback this required to explicitly instantiate the xdr
implementation as I do not want to put all the xdr code to header files.

The memory-only XDR allows to avoid coping filename and to-be-atomized
chars to a temporary buffer as the code can just access the buffer
directly. Another change is that new XDRScript takes as a parameter its
parent script. This allowed to avoid keeping filename in XDRState and
simplify the filename management.

Another change is the removal of JS_HAS_HDR. As CloneScript uses XDR to
copy a script, JS_HAS_XDR cannot be disabled.
2012-02-20 11:58:00 +01:00
Igor Bukanov
c7c6b4d07a bug 730221 - delegating serialization of script principals to the embedding. r=:luke,:bz
Currently to serialize principals stored in JSScript we have a rather complex
schema. First there is the transcode callback that the embedding must provide
to transcode principals using XDR API. Second we use rather complex glue code
to implement that callback in terms of writing/reading nsIObjectOutputStream/
nsIObjectInputStream. This glue code is duplicated in 3 places. All this can
be avoided if we simply delegate transcoding of principals to the caller. In
addition, at least in the case of the cached startup scripts we do not even
need to transcode the principals as the the cached scripts always have the
system principal so we can skip all the transcode complexity there.

The patch implemnts this idea. In particular, the code in JS engine
responsible for transcoding of principals is replaced by the single API
function JS_XDRSetPrincipals that the embedding can use to set principals for
decoded scripts and functions. Then the startup cache uses this to set the
principals for the decoded script to the system principals. The other two
places in nsJSContext::Serialize and  XBL_SerializeFunction that need to
serialize principals together with a function or script now uses common
utilities in nsXPConnect so the serialization complexity resides in the single
 place.
2012-02-13 14:10:04 +01:00
Igor Bukanov
4797d46af3 bug 728250 - remove JSPrincipals::codebase. r=:luke,:bz
In just 2 cases where JSPrincipals::codebase is used it can be reconstructed from the values stored in the associated nsJSPrincipal. In addition the patch makes nsJSprincipals to inherit both from nsIPrincipal and JSPrincipals allowing to use static_cast to convert between nsIPrincipal and JSPrincipals pointers and to drop many cases of manual JSPrincipal reference counting.
2012-03-09 10:48:50 +01:00
David Mandelin
232a121344 Bug 733260 followup: use uint32_t for array and string lengths, r=luke 2012-03-06 15:52:55 -08:00
David Mandelin
4038954f95 Bug 733260: remove typedef jsuint, r=luke 2012-03-05 18:43:45 -08:00
Bobby Holley
9462576942 Bug 720580 - Stop passing aExtraPtr to InitClassesWithNewWrapedGlobal. r=mrbkap
We only ever pass null here anyway, and this whole infrastructure is going away real soon now.
2012-03-05 15:22:44 -08:00
Bobby Holley
3ce325ec9b Bug 720580 - Remove unnecessary aIID parameter from nsIXPConnect::InitClassesWithNewWrappedGlobal. r=mrbkap 2012-03-05 15:22:44 -08:00
David Mandelin
f0690b22d1 Bug 730511: remove obsolete typedefs intN, uintN, r=luke 2012-02-28 15:11:11 -08:00
Luke Wagner
6ce7c1d803 Bug 729584 - mozJSComponentLoader::ImportInto needs to wrap exceptions (r=bholley) 2012-02-23 13:50:01 -08:00
Igor Bukanov
18eb7777e9 bug 723021 - moving native stack limits into runtime. r=luke 2012-01-31 23:28:22 +01:00
Luke Wagner
afdd78c326 Bug 675078 - rm JSThreadData and JSThread (JSRuntime is now officially single-threaded) (r=igor,rs=mccr8) 2011-07-18 14:54:48 -07:00
Matt Brubeck
5491d5a546 Back out 79deba022227 (bug 675078) because of Win debug mochitest-other failures 2012-01-24 17:32:30 -08:00
Luke Wagner
9912c99d35 Bug 675078 - rm JSThreadData and JSThread (JSRuntime is now officially single-threaded) (r=igor) 2011-07-18 14:54:48 -07:00
Ms2ger
d8a8e3ccf9 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey 2012-01-02 19:05:19 +01:00
Matt Brubeck
748c1019b6 Merge mozilla-central and mozilla-inbound 2011-12-28 11:17:19 -08:00
Josh Matthews
1e25e2c536 Bug 463122 - Propagate mozJSComponentLoader exceptions that occur while executing the script. r=mrbkap 2011-12-28 11:55:11 -05:00
Ms2ger
50803e1f02 Bug 713550 - Move Base64 code on nsXPConnect to XPCOM / xpcpublic.h; r=bholley+khuey 2011-12-28 09:13:38 +01:00
Jeff Walden
edbb60f3de Bug 711647 - Add MOZ_DELETE to a bunch of deliberately-not-implemented methods across the tree. r=dbaron 2011-12-16 14:42:07 -05:00
Ms2ger
5e96005775 Bug 705188 - Use IDL for mozIJSSubScriptLoader::LoadSubScript, {xpcIJSModuleLoader,nsIXPCComponents_Utils}::Import; r=bz 2011-12-18 11:09:16 +01:00
John Schoenick
a1cdb05405 Bug 687679 - Rename JS_CompileFile to JS_CompileUTF8File, fix users. r=jorendorff,jst 2011-12-16 11:08:59 -08:00
Ms2ger
ec54627bab Backed out changeset ba447ace2594 (bug 687679) for bustage. 2011-12-16 21:17:16 +01:00
John Schoenick
02925f4636 Bug 687679 - Rename JS_CompileFile to JS_CompileUTF8File, fix users. r=jorendorff,jst 2011-12-16 11:08:59 -08:00
Mike Hommey
20838ba061 Bug 695843 part 9 - Use FileLocations in the component manager. r=bsmedberg 2011-11-08 18:10:51 +01:00
Mike Hommey
9e54006ebd Bug 695843 part 8 - Properly handle jar-in-jars when importing modules. r=mrbkap 2011-12-08 11:03:36 +01:00
Mike Hommey
adb2c37b6f Bug 695843 part 7 - Use the URI string as the key for the various mozJSComponentLoader hashtables. r=mrbkap 2011-11-08 18:08:49 +01:00
Ryan VanderMeulen
cc01f0f444 Bug 705401 - Remove the rest of TraceVis. r=dvander 2011-11-28 16:08:25 -08:00
Ms2ger
294f8e171a Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley 2011-11-26 11:05:59 +01:00
Justin Lebar
f3070c142a Bug 586010 - Send dump() output to Android device log. r=bz 2011-11-09 19:27:08 -05:00
Luke Wagner
9cd47c906a Bug 650411 - assert in debug/release builds that JSRuntime is only used in a single-threaded manner (r=jorendorff,sr=dmandelin) 2011-07-01 14:11:31 -07:00
Ted Mielczarek
4f1897720b bug 695685 - Make JS module/component dump go to stdout and flush. r=mrbkap 2011-10-19 10:01:24 -04:00
Ehsan Akhgari
478ad1a412 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Landing on a CLOSED TREE
2011-10-17 10:59:28 -04:00
Bobby Holley
f4c64adc5a Bug 688012 - Manual fixup of multi-line c++ cast alignment. r=mrbkap 2011-10-14 10:52:49 -07:00
Bobby Holley
6d4a5a196d Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
xpcfix -epc `find | grep -P "cpp$|h$" | perl -pe 's/\n/ /'`

This is a conservative pass, which doesn't catch absolutely all cases. But it should be good enough.
2011-10-14 10:52:48 -07:00
Bobby Holley
374c22c159 Bug 688012 - Fix alignment of arguments and tests relative to parens. r=mrbkap
xpcfix -puc `find | grep -P "cpp$|h$" | perl -pe 's/\n/ /'`

Some of these changes aren't quite ideal, but it's the best my tooling can do and I think it's very much a step in the right direction. This is necessary to do first, because doing if(foo) -> if (foo) changes the location of parentheses, which affects how other things should be aligned. So this has to be built into the tooling, and we might as well take care of the pre-existing issues first.
2011-10-14 10:52:48 -07:00
Bobby Holley
15bfa97022 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
xpcfix -w `find | grep -P "cpp$|h$" | perl -pe 's/\n/ /'`

git diff -w verifies that this patch contains no non-whitespace changes.
2011-10-14 10:52:47 -07:00
Bobby Holley
ec90124839 Bug 691411 - Move js/src/xpconnect to js/xpconnect and rename source files while we're at it. r=khuey, sr=mrbkap 2011-10-14 10:52:47 -07:00