34 Commits

Author SHA1 Message Date
graydon%mozilla.com
3998c66e23 Bug 333078: XPCOM cycle collector
r=brendan, sicking, bz, dbaron, bsmedberg


git-svn-id: svn://10.0.0.236/trunk@217781 18797224-902f-48f8-a5cc-f745e15eee43
2007-01-04 22:31:26 +00:00
igor.bukanov%gmail.com
78871b5335 Bug 363057: Propagating cx to MakeStringImmutable so it can properly report out-of-memory. r=brendan
git-svn-id: svn://10.0.0.236/trunk@217038 18797224-902f-48f8-a5cc-f745e15eee43
2006-12-16 01:27:48 +00:00
brendan%mozilla.org
5d91ffeec1 Hack around compare-and-swap prob (353962, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@215993 18797224-902f-48f8-a5cc-f745e15eee43
2006-11-28 19:53:56 +00:00
vladimir%pobox.com
ece4ca3cad backing out bug 333078, xpcom cycle collector due to perf issues
git-svn-id: svn://10.0.0.236/trunk@215718 18797224-902f-48f8-a5cc-f745e15eee43
2006-11-22 23:18:16 +00:00
vladimir%pobox.com
260a2b3959 b=333078, xpcom cycle collector -- patch from graydon@mozilla.com, r=many
git-svn-id: svn://10.0.0.236/trunk@215695 18797224-902f-48f8-a5cc-f745e15eee43
2006-11-22 19:23:02 +00:00
brendan%mozilla.org
b159ef957a Patch from Feng Qian <feng.qian.moz@gmail.com> with assist from Igor, based on ancient patch from me, to factor per-thread state from JSContext into JSThread to support per-thread lock-free GC allocation (312238, r=me).
git-svn-id: svn://10.0.0.236/trunk@194574 18797224-902f-48f8-a5cc-f745e15eee43
2006-04-18 01:41:54 +00:00
timeless%mozdev.org
866c1e854f Bug 127760 - complete patch file for OpenUNIX and OpenServer ports
js patch
patch by kean@armory.com r=shaver


git-svn-id: svn://10.0.0.236/trunk@177675 18797224-902f-48f8-a5cc-f745e15eee43
2005-08-12 23:39:46 +00:00
brendan%mozilla.org
e1d64a36be Initial E4X check-in, configured off (246441, rs=shaver).
git-svn-id: svn://10.0.0.236/trunk@163236 18797224-902f-48f8-a5cc-f745e15eee43
2004-10-05 10:19:07 +00:00
gerv%gerv.net
123c4a9492 Bug 205418 - Relicense Spidermonkey (js/src) to MPL/LGPL/GPL. Patch by gerv; r,a=brendan.
git-svn-id: svn://10.0.0.236/trunk@149331 18797224-902f-48f8-a5cc-f745e15eee43
2003-11-15 00:11:16 +00:00
brendan%mozilla.org
e510eeea3f Heal a now-bogus assertion under JS_LOCK_OBJ/JS_LOCK_SCOPE.
git-svn-id: svn://10.0.0.236/trunk@149217 18797224-902f-48f8-a5cc-f745e15eee43
2003-11-12 22:14:25 +00:00
brendan%mozilla.org
8bb2395e5f Remove JS_UnsealObject, optimize locking of sealed objects, shrink JSContext by two JSArenaPool members (224306, r=shaver).
git-svn-id: svn://10.0.0.236/trunk@149134 18797224-902f-48f8-a5cc-f745e15eee43
2003-11-11 01:28:17 +00:00
mkaply%us.ibm.com
da4cdd7619 rs=leaf
Remove XP_OS2_VACPP from the tree


git-svn-id: svn://10.0.0.236/trunk@145083 18797224-902f-48f8-a5cc-f745e15eee43
2003-07-22 21:08:40 +00:00
timeless%mac.com
69ae314807 Bug 106386 rid source of misspellings
r=db48x sr=blake a=asa


git-svn-id: svn://10.0.0.236/trunk@116832 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-19 04:30:17 +00:00
brendan%mozilla.org
66979b2420 No strict warnings without the strict option, and other js1.5/mozilla1.0 tidying (129972, r=shaver, sr=jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116505 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-14 00:14:48 +00:00
mkaply%us.ibm.com
7bdb802715 #105476
r=os2team, sr=brendan@mozilla.org
Add ASM implementation of js_CompareAndSwap for OS/2 VACPP


git-svn-id: svn://10.0.0.236/trunk@107572 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-07 05:20:33 +00:00
brendan%mozilla.org
2163e55b8e Add mutable (growable or dependent, two subtypes) strings to solve O(n^2) and O(n^3) growth rates (56940, r=rogerl, sr=jband&shaver).
git-svn-id: svn://10.0.0.236/trunk@106213 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-25 00:26:38 +00:00
gerv%gerv.net
ae1d5501a1 Oops.
git-svn-id: svn://10.0.0.236/trunk@103236 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-20 00:02:59 +00:00
scc%mozilla.org
2281a4d137 bug #98089: ripped new license
git-svn-id: svn://10.0.0.236/trunk@103230 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-19 22:39:41 +00:00
brendan%mozilla.org
e4c21a8200 - Add JS_GetReservedSlot, JS_SetReservedSlot, and JSCLASS_HAS_RESERVED_SLOTS(n)
to the JS API, for per class extra slots beyond JSSLOT_PRIVATE (or starting
  there for a class that lacks JSCLASS_HAS_PRIVATE).  To avoid penalizing all
  instances, these slots are allocated only upon first property-owned slot
  allocation, or upon first JS_SetReservedSlot.

  This entailed adding getRequiredSlot and setRequiredSlot hooks to the
  JSObjectOps struct, and making obj->slots self-describing, a la BSTR.  It
  also afforded me a chance to clean up obj->slots locking so that non-native
  JSObjectOps didn't risk unlocked accesses!  Now there are thread-safe hooks
  for all uses of obj.

  First consumer is the new, DOM-glue-unifying XPConnect, which needs two
  slots per wrapped function.  Hence the change to js_FunctionClass.flags'
  initializer.

- Commented the heck out of JSClass and JSObjectOps function typedefs in
  jspubtd.h.  I hope embedders see these comments!

- Fix JS_XDRValue's default case to handle int exclusively, there is no other
  possible type (and therefore no JSMSG_BAD_JVAL_TYPE error).

- Clean up tabs in select old, tab-ridden files and sections.

- s/\<fh\>/file/g for stdio FILE * canonical variable names.


git-svn-id: svn://10.0.0.236/trunk@91396 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 01:53:24 +00:00
brendan%mozilla.org
1f9562bcf1 Don't fatten a flyweight lock unnecessarily in JS_SetPrototype; misc. cleanups (63097, r=mccabe, sr=jband).
git-svn-id: svn://10.0.0.236/trunk@83914 18797224-902f-48f8-a5cc-f745e15eee43
2000-12-20 22:36:01 +00:00
brendan%mozilla.org
0079469b4e A bit over-aggressive with that static keyword last time...
git-svn-id: svn://10.0.0.236/trunk@83233 18797224-902f-48f8-a5cc-f745e15eee43
2000-12-04 04:34:18 +00:00
brendan%mozilla.org
c359b1ea49 Fix NSPR_LOCK ifdefs (for JS_NO_THIN_LOCKS mode, enabled due to a configure.in bug on gcc/sparc5 systems). Fixes speedracer build bustage.
git-svn-id: svn://10.0.0.236/trunk@83230 18797224-902f-48f8-a5cc-f745e15eee43
2000-12-04 04:02:27 +00:00
brendan%mozilla.org
ff9815b123 All this r=mccabe, r=beard, and sr=jband -- many thanks to all who helped,
especially to jband for his great stress-test setup and particularly helpful
(in terms of reproducing bugs in draft patches) MP and laptop machines.

- Radical(*) object (scope) locking optimization: don't lock if a scope is
  accessed on the context that exclusively owns it (initially, the context
  on which the scope was created).  Once a scope becomes shared among more
  than one owner-context, give it the usual thin or fat lock, per existing
  jslock.c code.

  I did this at the memory cost of another word per JSScope, ownercx, which
  raised scope size from 12 to 13 words if !DEBUG.  I also added a linked
  list head pointer, rt->scopeSharingTodo, and a scopeSharingDone condition
  variable to JSRuntime, and a scopeToShare pointer to JSContext that's
  necessary for deadlock avoidance.

  The rt->scopeSharingTodo list links JSScopes through the scope->u.link
  union arm, which overlays the pre-existing scope->count (now u.count)
  member.  This list holds scopes still exclusively owned by a context, but
  wanted by js_LockScope calls active on other threads.  Those calls wait
  on the rt->scopeSharingDone condition, which is notified every time an
  owner-context ends the request running on it, in which code active on
  that context may be using scope freely until end of request.

  The code that waits on rt->scopeSharingDone must first suspend any and
  all requests active on the calling context, and resume those contexts
  after the wait is notified.  This means a GC could happen while the
  thread locking a scope owned by another thread's context blocks; all
  calls to JS_LOCK_OBJ must therefore first home fp->sp above any live
  operands, e.g.  The interpreter takes care to do that already.

  To avoid AB-BA deadlocks, if a js_LockScope attempt on one context finds
  that the owner-context of the scope is already waiting on a scope owned
  by the current context (or indirectly depending on such a scope lock),
  the attempt converts the scope from lock-free exclusive ownership to
  shared ownership (thin or fat lock).

- Fix js_SetupLocks and the js_LockGlobal/js_UnlockGlobal code to avoid
  divmod instruction costs, strength-reducing to bit-mask instructions.

- The radical lock-free scope change required care in handling the 0=>1
  and 1=>0 transitions of cx->requestDepth, which was till now thread-local
  because part of the JSContext not manipulated by other threads.  It's
  still updated only by cx's thread, but it is read by other threads in
  the course of attempting to claim exclusive ownership of a scope for more
  lock-free JS object operations.

- The JS_SuspendRequest and JS_ResumeRequest APIs have changed incompatibly
  to require their caller to save and restore the requestCount found when
  JS_SuspendRequest is called.  This is necessary to avoid deadlock; sorry
  for the incompatible change.

- Fixed various nits in jslock.[ch], including using Init/Finish rather
  than New/Destroy for the methods that take a JSThinLock and initialize
  and finish/free its members.  Another example: JS_ATOMIC_ADDREF is now
  JS_ATOMIC_INCREMENT and JS_ATOMIC_DECREMENT, so the two cases can be
  mapped to PR_AtomicIncrement and PR_AtomicDecrement.  This entailed
  changing jsrefcount from jsword to int32 (PRInt32).

- No need to use JS_ATOMIC_INCREMENT on JSScopeProperty.nrefs, as it is
  always and everywhere protected by the property's JSScope.lock.

- Cleaned up gratuitous casts in jscntxt.c by using &cx->links, etc.

- The lock used for mutual exclusion around both request begin and end vs.
  GC synchronization is rt->gcLock, and this lock now also protects all
  scope->ownercx pointer changes from non-null (exclusive) to null (shared),
  the rt->scopeSharingTodo/scope->u.link list operations, and of course the
  rt->scopeSharingDone condition.

  But this means that js_GC cannot hold rt->gcLock across the bulk of its
  body, in particular the mark phase, during which JS_GetPrivate calls,
  e.g., may need to "promote" scope locks from lock-free to thin or fat,
  because doing so would double-trip.  There never was any good reason to
  hold rt->gcLock so long, of course -- locks are for mutual exclusion, not
  for waiting or notifying a thread -- those operations require a condition,
  rt->gcDone, which we already use along with rt->gcLevel to keep racing GC
  attempts at bay.

  So now that rt->gcLock does not protect the mark phase, the enumeration
  of rt->gcRootsHash can race badly with JS_RemoveRootRT, an API that may
  legitimately be called outside of a request, without even a context.  It
  turns out that people may be cheating on the request model even with
  JS_AddRoot, JS_AddNamedRoot, and JS_RemoveRoot calls, so we must make
  all of those interlock with the GC using gcLevel and gcDone, unless they
  are called on the gcThread.

  Also, since bug 49816 was fixed, there has been no need for a separate
  finalize phase, or for rt->gcFinalVec.  Finalizers can no longer allocate
  newborn GC-things that might be swept (because unmarked), or double-trip
  on rt->gcLock (which is no longer held).  So js_GC finalizes as it sweeps,
  just as it did in days of old.

- I added comments to jslock.h making it plain that callers of JS_LOCK_OBJ
  and JS_UNLOCK_OBJ must either be implementations of js_ObjectOps hooks,
  or code reachable only from those hooks; or else must be predicated on
  OBJ_IS_NATIVE tests.  It turns out jsinterp.c's CACHED_GET and CACHED_SET
  macros neglected to do such tests, limiting the ability of JS embeddings
  to implement JSObjectOps with their own non-JSScope JSObjectMap subclass.
  Fixed, small performance hit that the lock-free optimization should more
  than make up for.

- jslock.c now gives a #error if you try to compile it on a platform that
  lacks a compare-and-swap instruction.  The #error says to use NSPR locks.
  Before this change, some platforms would emulate compare-and-swap using
  a global PRLock, which is always worse in runtime than using per-scope
  PRLocks.


git-svn-id: svn://10.0.0.236/trunk@83229 18797224-902f-48f8-a5cc-f745e15eee43
2000-12-04 02:43:31 +00:00
alla%lysator.liu.se
927efbdbd2 Implement js_CompareAndSwap for GCC x86 (Linux, FreeBSD etc). This gives us fast thin locks on Linux. bug 20357 r=brendan a=brendan
This version should now work on older binutils too.


git-svn-id: svn://10.0.0.236/trunk@78514 18797224-902f-48f8-a5cc-f745e15eee43
2000-09-08 12:13:39 +00:00
alla%lysator.liu.se
bd1dd0e2eb Reverting last change.
git-svn-id: svn://10.0.0.236/trunk@78510 18797224-902f-48f8-a5cc-f745e15eee43
2000-09-08 09:28:56 +00:00
alla%lysator.liu.se
0c68dc2002 Implement js_CompareAndSwap for GCC x86 (Linux, FreeBSD etc). This gives us fast thin locks on linux.
bug 20357, r=brendan a=brendan


git-svn-id: svn://10.0.0.236/trunk@78509 18797224-902f-48f8-a5cc-f745e15eee43
2000-09-08 08:59:37 +00:00
brendan%mozilla.org
5ecfd2355f Why didn't the lack of this break Linux, where I tested?
git-svn-id: svn://10.0.0.236/trunk@74160 18797224-902f-48f8-a5cc-f745e15eee43
2000-07-13 05:56:28 +00:00
brendan%mozilla.org
bed10de2c0 Fixed getter/setters, pave way for brutal sharing (15146, r=shaver@mozilla.org,rogerl@netscape.com)
git-svn-id: svn://10.0.0.236/trunk@52487 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-02 02:23:50 +00:00
dmose%mozilla.org
ec2434440d update license boilerplate to NPL-1.1 dual-licensed with the GPL. a=brendan, r=brendan.
git-svn-id: svn://10.0.0.236/trunk@49258 18797224-902f-48f8-a5cc-f745e15eee43
1999-09-28 23:12:09 +00:00
brendan%mozilla.org
e0f64c2c6e Fix warnings reported at http://tinderbox.mozilla.org/SeaMonkey/warnings.html, mostly unsigned/signed bothers.
git-svn-id: svn://10.0.0.236/trunk@41445 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-28 06:48:44 +00:00
fur%netscape.com
dc0c8d45d1 Merge changes from SpiderMonkey140_BRANCH. Note: none of the
added files participate in the client build.


git-svn-id: svn://10.0.0.236/trunk@29432 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-27 15:18:57 +00:00
fur%netscape.com
e655606d45 Checkpoint JS1.4 from JS_STABLE_10131998_BRANCH. Changes include:
+ merging of js/src and js/ref
 + elimination of most dependencies on NSPR
 + JS1.4 feature additions and accumulated bug fixes

More details are in last week's mozilla status report.


git-svn-id: svn://10.0.0.236/trunk@12797 18797224-902f-48f8-a5cc-f745e15eee43
1998-10-14 10:22:38 +00:00
fur
6e3cdaec31 Initial checkin of JavaScript 1.3, migrated from JSFUN13_BRANCH in /m/src repository
git-svn-id: svn://10.0.0.236/trunk@578 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-24 00:31:11 +00:00
ltabb
8ed5afe62c Free the lizard
git-svn-id: svn://10.0.0.236/trunk@10 18797224-902f-48f8-a5cc-f745e15eee43
1998-03-28 02:44:41 +00:00