Граф коммитов

683 Коммитов

Автор SHA1 Сообщение Дата
Igor Bukanov 256adae7ca bug 362910 - js_GetMethod cleanup. r=brendan 2009-03-14 17:41:47 +01:00
Jason Orendorff 06f3b31e0a Bug 481218 - js_IsCallable returns false for functions. r=brendan.
--HG--
extra : rebase_source : 52d3cba36f3fa1301223cb579bd75ec7bbd5d130
2009-03-11 10:46:45 -05:00
Brendan Eich aea5682cf7 Bug 481516 - Assertion failure: pobj_ == obj2, at ../jsinterp.cpp:4276 when getting a property that is cached but shadowed (r=jorendorff). 2009-03-06 16:34:19 -08:00
Brendan Eich cb20b7a6e7 Bug 480759 - TM: trace RegExp constructors (r=gal). 2009-03-04 19:26:16 -08:00
Robert Sayre bc53f36141 Bug 476374 - JSON.parse does not support reviver argument as defined in spec. r=jorendorff 2009-03-03 12:55:11 -05:00
Andreas Gal cba1bec75b Backed out bug 480657. Massive failures across all platforms. 2009-02-28 23:40:04 -08:00
Andreas Gal 275b6b1231 Add an API to define traceable constructors (480657, r=brendan). 2009-02-28 18:18:42 -08:00
Jeff Walden f09329cc7c Kicking Windows... 2009-02-27 22:32:38 -08:00
Jeff Walden 0411f120b5 Bug 480579 - __proto__ setting does not flag delegate, breaking deep property caching assumptions. Tag-team effort of Brendan and me, r=us 2009-02-27 22:23:09 -08:00
Jeff Walden 6043733d94 Bug 474501 - JS array and object literals should define properties, not set them, to avoid calling getters or setters along the prototype chain. r=brendan 2009-02-03 23:14:36 -08:00
Jason Orendorff d3d93eccb7 Bug 460865 - Read barrier for cx->fp. r=mrbkap, r=dmandelin.
--HG--
extra : rebase_source : 19963188b2f9f96336ce6ca28dbaefccf3a639b7
2008-12-09 10:38:32 -06:00
Jeff Walden ad0b2246c2 Bug 465476 - SpiderMonkey confusion over "-0" and "0" properties of an object. r=brendan 2008-11-21 11:47:35 -08:00
Jason Orendorff c6bca4ae17 Bug 458735 - Improve internal API for traceable natives (r=brendan, nanojit r=edwsmith) 2008-10-08 17:08:33 -05:00
Jason Orendorff d7abc77776 Bug 455953 - js_DumpObject debugging function (r=crowder) 2008-09-25 11:29:12 -05:00
Brendan Eich d4ea601867 Fix build bustage: parent or proto might be not JSObject* when setting to null. r=brendan, patch by bz. 2008-09-09 12:33:28 -07:00
Brendan Eich c1ea855a9c Avoid needless prototype-shape purges (454035, r=igor). 2008-09-09 09:57:10 -07:00
Brendan Eich 213f3d7e5f Upvar, v0.1 (limited to looking up from eval in a function, to the function's args and vars). 2008-08-21 03:47:33 -07:00
Brendan Eich 082876bc3b Defer eval'ed script destruction to next GC; expose js_obj_eval for tracing. 2008-08-20 22:18:42 -07:00
shaver@mozilla.org 51d57bfb68 merge from mozilla-central 2008-08-20 08:17:17 -07:00
Brendan Eich 3e8fc934ae Object.prototype.{hasOwnProperty,propertyIsEnumerable}. 2008-08-11 17:47:05 -07:00
Brendan Eich e5b9c8fe43 Back out extra gcflag param change (859b9a23adbf), I set bad precedent and will back out previous such shortly. Want cx->gcflags instead. 2008-08-11 10:33:23 -07:00
shaver@mozilla.org d359968651 extend js_NewObjectWithGivenProto to permit specifying additional new-thing flags (such as GCX_DONT_BLOCK) 2008-08-10 22:56:10 -04:00
Brendan Eich e51da46173 Merge from mozilla-central. 2008-08-08 18:58:04 -07:00
Igor Bukanov 56f20b25f1 bug 412296 - removal of minarg support for fast native 2008-08-08 18:02:50 +02:00
Brendan Eich b7b8659826 - Export JSSLOT_ITER_* from jsiter.cpp to jsiter.h, for jstracer.cpp to use.
- Fix OBJ_GET_SLOT to be STOBJ_GET_SLOT in jsiter.cpp, no thread safety here (bug on file).
- Move JSNativeEnumerator from jsobj.cpp to jsobj.h for jstracer.cpp as well.
- Rename JOF_2BYTE JOF_UINT8 for consistency, and actually decompile it.
- Trace JSOP_FORVAR (can't do anything in JSOP_ITER, it comes before the loop).
- Shortened some guardMyLongSummerVacationWithinBounds names ;-).
- Removed/refactored to avoid dslots_ins obligation on all callers.
2008-07-30 16:32:33 -07:00
Igor Bukanov d422c4995e [Bug 446229] Fixing GCC conversion warnings within SpiderMonkey. r=brendan 2008-07-20 14:53:21 +02:00
Igor Bukanov 90b3f9fb68 Bug 443746 – Optimizing the enumeration state allocation. r=brendan 2008-07-06 21:02:44 +02:00
Brendan Eich b697b4515b Clean up for-in ops and naming nit (443039, r=igor). 2008-07-01 18:59:18 -07:00
Igor Bukanov 2f2e63b633 [Bug 411575] SM: faster js_PutCallObject, r=brendan 2008-06-30 19:17:33 +02:00
igor@mir2.org c3e69e39dd [Bug 427798] faster js_PutBlockObject(), r=brendan a1.9=shaver 2008-05-01 14:59:52 -07:00
crowder@fiverocks.com 67349a88bf Bug 428336, assertion failure after deleting eval 16 times, patch by mrbkap, r=brendan, a=mtschrep 2008-04-14 17:31:43 -07:00
igor@mir2.org 5e262850d9 [Bug 423874] Allocating functions together with JSObject. r=brendan a1.9=blocking1.9 2008-04-02 00:46:12 -07:00
igor@mir2.org a56e38ef38 [bug 424964] optimizing reserve slot allocation, r=brendan a1.9=mtschrep 2008-03-29 06:38:28 -07:00
igor@mir2.org e05006a6f0 [bug 423874] backing out as a simpler patch would do the job with less code. 2008-03-29 03:34:29 -07:00
igor@mir2.org 8c88d304f4 bug=423874 r=brendan a1.9b5=dsicore Allocating native functions together with JSObject 2008-03-21 01:19:23 -07:00
mrbkap@gmail.com f51e981013 Don't assume that chrome:// implies system principals. bug 419848, r=brendan sr=jst 2008-03-06 14:52:58 -08:00
mrbkap@gmail.com 9a51eefa28 Fix array_concat to be more generic. bug 420966, r=brendan a=beltzner 2008-03-06 12:05:18 -08:00
mrbkap@gmail.com daa1af807b Outerize |this| always. bug 418069, r/sr=jst/brendan a=beltzner 2008-02-29 16:17:38 -08:00
gavin@gavinsharp.com eb3e4a8015 Back out bug 418069 because it causes a crash on startup for Camino 2008-02-20 18:06:26 -08:00
crowder@fiverocks.com fdebdc3375 Bug 418069 - js1_5/Regress/regress-379245.js FAIL - browser - bad this, patch by mrbkap, r=brendan, sr=jst, a1.9=brendan 2008-02-20 15:28:18 -08:00
igor@mir2.org 737e1c86d9 Bug 416439. Using goto error in the interpreter to shrink code size. r,a1.9=brendan 2008-02-19 04:16:26 -08:00
shaver@mozilla.org 8de570e122 Implement optimized object-ops for dense arrays, b=322889, r+a=brendan. 2008-02-18 13:01:47 -08:00
igor@mir2.org 6721a1115f Bug 416601: property cache is properly disabled under with statements with generators. r=brendan a1.9=blocking1.9 2008-02-15 03:38:40 -08:00
shaver@mozilla.org 78086c82f0 back out for mochitest failures in prototype 2008-02-15 02:31:38 -08:00
shaver@mozilla.org 42bcfd3a28 Bug 322889: implement specialized storage and operations for JS arrays; r+a=brendan. 2008-02-15 01:48:53 -08:00
gavin@gavinsharp.com 98c6509ae0 Back out bug 322889 due to jQuery unit test failures 2008-02-14 18:41:18 -08:00
shaver@mozilla.org d2c737a91e Bug 322889: implement specialized storage and operations for JS arrays; r+a=brendan 2008-02-14 17:07:53 -08:00
shaver@mozilla.org d168ad9a94 Bug 416675: refactor JSScope locking for reuse on non-native objects. r+a=brendan. 2008-02-14 16:44:46 -08:00
brendan@mozilla.org 5fd5861767 Optimize wrapper creation via JS_NewObjectWithGivenProto, and avoid cycle-check overhead in JS_Set{Prototype,Parent} (408871, r=mrbkap). 2008-02-13 21:10:42 -08:00
brendan@mozilla.org b744a843ed Export js_CheckForStringIndex from jsobj.c for use by assert in jsinterp.c (416460, r=shaver). 2008-02-10 17:12:29 -08:00
brendan@mozilla.org 88be18b937 Return of the property cache (365851, r=shaver). 2008-02-07 15:18:45 -08:00
igor@mir2.org 8af608c998 Bug 400902: Backing out due to test failures. 2008-02-03 19:41:31 -08:00
igor@mir2.org 2c83b63220 Bug 400902: specialized arena for fast allocation of double values.r,a=brendan ab3=mtschrep 2008-02-03 18:37:22 -08:00
igor@mir2.org 3c4b2c5209 Bug 400902: backing out due to test failures. 2008-02-01 11:59:59 -08:00
igor@mir2.org 6c0dbc29f9 Bug 400902: using a specialized GC arena for doubles. r,a=brendan a1.9b3=mtschrep 2008-02-01 10:39:23 -08:00
jst@mozilla.org 2133a00277 Fixing bug 413045. Make some JS API functions faster by accessing obj->fslots[] directly when possible. r=brendan@mozilla.org, r=igor@mir2.org. 2008-01-23 14:05:43 -08:00
brendan@mozilla.org a83ad1b4dd * Menu of -D flags for enabling instrumentation, as a commented-out CFLAGS += setting for convenient testing. * js_FindProperty and js_LookupPropertyWithFlags return indexes into the scope and prototype chains, respectively, to support internal instrumentation, and to pave the way for the return of the property cache (bug 365851).. * jsutil.[ch] JSBasicStats struct and functions for computing mean/sigma/max and auto-scaling histogram. * JS_SCOPE_DEPTH_METER instrumentation for compile- and run-time scope chain length instrumentation: + At compile time, rt->hostenvScopeDepthStats and rt->lexicalScopeDepthStats meter scope chains passed into the compile and evaluate APIs. + At runtime, rt->protoLookupDepthStats and rt->scopeSearchDepthStats track steps along the prototype and scope chains until the sought-after property is found. * JS_ARENAMETER uses JSBasicStats now. * Added rt->liveScopePropsPreSweep to fix the property tree stats code that rotted when property tree sweeping moved to after the finalization phase. * Un-bitrotted some DEBUG_brendan code, turned some off for myself via XXX. * Mac OS X toolchain requires initialized data shared across dynamic library member files, outlaws common data, so initialize extern metering vars. * Old HASHMETER code in jshash.[ch] is now JS_HASHMETER-controlled and based on JSBasicStats. * DEBUG_scopemeters macro renamed JS_DUMP_SCOPE_METERS; uses JSBasicStats now. * Disentangle DEBUG and DUMP_SCOPE_STATS (now JS_DUMP_PROPTREE_STATS) and fix inconsistent thread safety for liveScopeProps (sometimes atomic-incremented, sometimes runtime-locked). * Compiler-modeled maxScopeDepth will propagate via JSScript to runtime for capability-based, interpreter-inlined cache hit qualifier bits, to bypass scope and prototype chain lookup by optimizing for common monomorphic get, set, and call site referencing a prototype property in a well-named object (no shadowing or mutation in 99.9% of the cases). 2008-01-12 16:31:31 -08:00
igor@mir2.org 2b99286186 Bug 398609: simpler handling of hidden properties, r,a=brendan 2007-11-19 09:15:45 -08:00
igor@mir2.org 16ef90a8d3 Bug 398609: backing out due to test failures. 2007-11-18 16:58:46 -08:00
igor@mir2.org 70095b9a80 Bug 398609: cleanup of hidden properties support. r,a=brendan 2007-11-18 16:36:49 -08:00
igor@mir2.org 2dde8b9ca8 Bug 398609: Backing out due to mochi test failure. 2007-11-13 07:47:28 -08:00
igor@mir2.org ba086a3cc1 Bug 398609: cleanup of hidden properties. r,a=brendan 2007-11-13 06:56:18 -08:00
igor@mir2.org a1b737906d Bug 396758: the system flag is moved from GC flags to JSObject itself. r=brendan 2007-10-01 12:11:41 -07:00
igor@mir2.org 52c026dec6 Bug 396758: taking the patch out as it broke the test cases. 2007-09-25 10:30:55 -07:00
igor@mir2.org b023149d49 Bug 396758: the system flag is moved from GC flags to JSObject itself. r=brendan 2007-09-25 10:08:41 -07:00
brendan@mozilla.org 767c4ea288 Fast (frame-less) native call optimizations (385393, r=igor). 2007-08-01 21:33:52 -07:00
brendan@mozilla.org 0427f2943d Backing out, see bug 389122 and orange or red tinderboxes. 2007-07-21 16:21:20 -07:00
brendan@mozilla.org b36bbabdb0 Fast natives and related optimizations (385393, r=igor). 2007-07-21 14:39:42 -07:00
igor@mir2.org 52a3248e98 Bug 384151: refactoring boxing of primitive values, r=brendan 2007-06-14 00:07:01 -07:00
brendan@mozilla.org 1d2da89892 Fix fun_resolve to avoid resolving hidden properties (locals/params; 382532, r=mrbkap). 2007-06-04 12:50:30 -07:00
igor@mir2.org 1ab869f5ec Bug 375270: API to trace GC things graph without running the GC. r=brendan 2007-04-16 23:53:37 -07:00
brendan%mozilla.org 0deb33f7fe Fix LOCKED_OBJ_CHECK_SLOT misnomers; tweak comment. 2007-01-09 06:27:48 +00:00
igor.bukanov%gmail.com fa9f0ba8f4 Bug 363603: JSObjectMap.nslots is removed as redundant. r=brendan 2007-01-06 22:03:06 +00:00
brendan%mozilla.org 546f5b33f3 Stage 0 patch for getter/setter optimizations (365851, r=igor). 2007-01-04 21:15:09 +00:00
igor.bukanov%gmail.com 60d4240828 Bug 331966: initial object's slots are allocated together with JSObjects, r=brendan. 2006-12-12 10:45:06 +00:00
igor.bukanov%gmail.com 8a6cd78d70 Bug 362668: JSObject.slot is no longer accessed directly. Instead code uses STOBJ_macros. r=brendan 2006-12-09 15:02:37 +00:00
mrbkap%gmail.com 26ab1065f4 XDR block objects so that when we try to XDR a let expression or array comprehension, we don't error out. bug 346019, r=brendan 2006-07-31 22:52:27 +00:00
brendan%mozilla.org 606fbd540c Fix JSOP_SETSP to trim only the current frame's scope chain (344959, r=mrbkap). 2006-07-17 23:49:36 +00:00
mrbkap%gmail.com c9b8311dda Make sure that we clean up block objects that were cloned into the scope chain for environment capture, so they don't reference dead frame pointers or dead stack slots, and instead have property-based copies of their locals. bug 343765, r=brendan 2006-07-06 20:47:02 +00:00
igor.bukanov%gmail.com 9f9ab7cc1e Bug 341877: Infrastructure to root properly native iterator states. r=brendan 2006-06-21 09:13:24 +00:00
igor.bukanov%gmail.com 8d743fde46 Bug 341877: Reverting the previous commit, the patch was broken. 2006-06-20 00:50:17 +00:00
igor.bukanov%gmail.com 2d2124eb15 Bug 341877: Infrastructure to properly mark native iterator state during GC without changing public API. r=brendan 2006-06-19 22:53:51 +00:00
igor.bukanov%gmail.com 640729a776 Bug 340129: Bulletproof rooting of objects during sharp graph construction/usage. r=mrbkap 2006-06-15 10:14:42 +00:00
igor.bukanov%gmail.com 99ed8ebc2a Bug 340129: Reverting all the commits as the tree IS CLOSED. 2006-06-13 23:06:17 +00:00
igor.bukanov%gmail.com 0a42ade42c Bug 340129: Bulletproof rooting of objects during sharp graph construction/usage. r=mrbkap 2006-06-13 22:29:31 +00:00
igor.bukanov%gmail.com 719b0db492 Bug 340129: Reverting the commit, it was the wrong patch! 2006-06-13 22:21:56 +00:00
igor.bukanov%gmail.com 59017eb846 Bug 340129: Bulletproof rooting of objects during sharp graph construction/usage. r=mrbkap 2006-06-13 22:19:55 +00:00
brendan%mozilla.org bcf6aea253 First big wave of js1.7 changes (326466, 336376, r=mrbkap). 2006-05-20 22:27:28 +00:00
brendan%mozilla.org 705725e02f Memoize standard class.prototype bindings, per ECMA-262 (304376, r=mrbkap). 2006-04-19 00:22:43 +00:00
igor%mir2.org 6997c32ab1 BUG 321985: During xdr decoding of atoms avoid creation of JSString for
the already existing atoms. r=brendan
2006-02-14 09:33:45 +00:00
mrbkap%gmail.com dc17d38af4 bug 324694: Reparameterize js_CheckPrincipalsAccess to avoid eager calls to js_AtomToPrintableString. r=brendan 2006-01-25 22:54:34 +00:00
mrbkap%gmail.com 71214f2f8d bug 313236: Consolidate some code. r=brendan 2005-10-22 01:03:06 +00:00
mrbkap%gmail.com 44834d9757 bug 311892: Add some (awful, gross) checks. r=brendan 2005-10-14 19:05:43 +00:00
mrbkap%gmail.com ac604da132 bug 311024: Make sure eval grabs the right scope object. r=brendan sr=jst 2005-10-08 00:28:45 +00:00
brendan%mozilla.org 3b5174c57b Use runtime-wide access check hook as a default per-object (296397, r=shaver, sr=jst, a=drivers). 2005-06-21 21:31:26 +00:00
brendan%mozilla.org fb36f6a978 Add JS_EnumerateResolvedStandardClasses, and fix a few lazy-standard-class-init glitches hindering it (292903, r=shaver, a=me). 2005-06-16 04:24:03 +00:00
brendan%mozilla.org 578a39586d Better fix for 296397 (r=shaver, sr=jst). 2005-06-11 01:33:44 +00:00
brendan%mozilla.org 71f828e98c Followup patch for bug 293782 etc., to unregress 137000 (r/a=shaver). 2005-05-17 01:06:35 +00:00
brendan%mozilla.org 5cd5bba496 Hide function arg/var properties, to hide pre-ECMA design decision that horks ECMA-conformance and sanity in multiple cases (293782 and its deps, r+a=shaver). 2005-05-15 18:24:31 +00:00
jst%mozilla.jstenback.com 0472c0073e Fixing bug 265174. Quiet down compiler warnings on Linux x86_64. r+sr=brendan@mozilla.org 2005-01-12 19:56:32 +00:00
brendan%mozilla.org e5f2626c46 Expand tabs. 2004-12-09 01:32:19 +00:00
brendan%mozilla.org 428b8a8546 E4X, configured off, code-complete. 2004-11-17 07:43:01 +00:00
brendan%mozilla.org 5eb78fc669 Initial E4X check-in, configured off (246441, rs=shaver). 2004-10-05 10:19:07 +00:00
brendan%mozilla.org a7487d7136 Add JSRESOLVE_DECLARING and JSRESOLVE_CLASSNAME support for better DOM quirk emulation (257602, r=shaver). 2004-09-01 20:51:39 +00:00
brendan%mozilla.org 1a78cd61c8 Give JSObjectOps.setRequiredSlot a JSBool return value so it can propagate errors (part of 245890, r=shaver). 2004-06-12 01:50:09 +00:00
brendan%mozilla.org c44082952a Back out patch for bug 245890 for now. 2004-06-09 19:39:53 +00:00
brendan%mozilla.org e4dad6cb67 Fix bug caused by bug 165201's checkin, where regexp-valued slots in function object clones might dangle after GC (245890, r=shaver). 2004-06-08 21:58:52 +00:00
gerv%gerv.net 29cfd51965 Bug 205418 - Relicense Spidermonkey (js/src) to MPL/LGPL/GPL. Patch by gerv; r,a=brendan. 2003-11-15 00:11:16 +00:00
brendan%mozilla.org 803d51df77 Fix ancient ECMA conformance bug to-do with implicit variable definition order in assignments (204919, r=rogerl, a=asa). 2003-05-14 20:57:47 +00:00
timeless%mac.com dec943eb10 Bug 106386 rid source of misspellings
r=db48x sr=blake a=asa
2002-03-19 04:30:17 +00:00
brendan%mozilla.org 57483a3082 Major footprint/perf win: share property state using a tree whose root represents empty scopes, and whose non-root nodes represent scopes with properties added in order from the root to that node; to use double hashing to map these tree-paths for per-scope property lookup; and avoid locking where possible through immutability and mostly-benign&rare race tolerance (62164, r=shaver, sr=jband). 2002-02-23 03:49:27 +00:00
brendan%mozilla.org aba15fbd2d Construct error objects to consolidate their default property setting; this entails adding JS_ConstructObjectWithArguments (123177, r=rginda, sr=shaver). 2002-02-14 07:25:34 +00:00
brendan%mozilla.org a911b05d03 Avoid all gc <> obj-lock deadlocks by letting the gc run lock-free, safe since all requests are suspended or ended when the gc runs (114712, r=shaver, sr=jband). 2002-02-08 01:55:30 +00:00
brendan%mozilla.org 8b9fb46499 Avoid ClaimScope (lock-free to -full transition) in JS_GetClass and js_FinalizeObject called from the GC (109183, r=shaver, sr=jband). 2001-11-11 21:25:13 +00:00
brendan%mozilla.org c220d0c707 Avoid recursive join/toString death (108440, r=shaver, sr=jband). 2001-11-07 00:15:44 +00:00
brendan%mozilla.org 894b19f8c3 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). 2001-10-25 00:26:38 +00:00
gerv%gerv.net 1856815ff1 Oops. 2001-09-20 00:02:59 +00:00
scc%mozilla.org bc444f528a bug #98089: ripped new license 2001-09-19 22:39:41 +00:00
brendan%mozilla.org 8952a0a28f Lazily pin the less likely atoms when resolving standard class names (77861, r=jst, sr=jband). 2001-05-23 04:02:06 +00:00
brendan%mozilla.org cd37f8447b - 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.
2001-04-05 01:53:24 +00:00
brendan%mozilla.org 0e3fd5e8ba 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.
2000-12-04 02:43:31 +00:00
brendan%mozilla.org 293ddb04d6 Add strict warning for undefined property reference (foo.bar where bar names no object in foo or its prototypes; r=jband). 2000-09-19 02:24:11 +00:00
brendan%mozilla.org c77f05ae2e Clean up JSObjectOps layering violations by adding mark and clear ops; JSClass gets a corresponding mark op so classes with unregistered roots in private data can mark them. The JS API gets a new JS_MarkGCThing entry point for JSObjectOps.mark implementors. Prerequisite check-in for bug 49816 and others (r=shaver). 2000-08-26 02:30:22 +00:00
brendan%mozilla.org f59c35edb2 Support lazy initialization of standard classes and their associated global functions/properties (46703, r=jband,rogerl). 2000-08-19 08:37:07 +00:00
brendan%mozilla.org 6afe0ed1a7 Fix JS_SetPrototype and __proto__ setting to deal with shared scopes; use JSObjectOps for setProto and setParent operations, and add spare op slots (41126, r=shaver@mozilla.org,pschwartau@netscape.com). 2000-06-27 02:37:25 +00:00
rogerl%netscape.com 1b01852975 r=brendan@mozilla.org
Bug #14462, lot's of discussin there about these changes, but here's
Brendan's description :
In order, changes in the patch are:

- Rename JSSLOT_ITR_STATE to be JSSLOT_ITER_STATE (avoid cybercrud abbreviation
as cbrcrd, no more six-char id limits!).

- Property cache tests must occur with the object's scope-lock held, to close a
race with delete (js_DestroyProperty, always called with the property's scope
locked).  Once the cache has been hit, and before the lock is released, the
property's refcount must be bumped.  This requires re-acquisition of the lock
and js_DropScopeProperty afterward.

- Reworked js_FindProperty to use a do-while loop, as cx->fp->scopeChain must be
non-null.  This avoids a gratuitous lastobj init done to "Suppress gcc warning"
in the old revision.

- Akin to the property cache hit cases in jsinterp.c and jsobj.c's
js_FindProperty, code to hold and drop the scope-property by its refcount that
was #ifdef JS_THREADSAFE must be unconditional, now that user-defined getters
and setters may delete the property id they're getting or setting.

- Fixed overlong continuation line in jsobj.h.

/be
2000-02-08 01:24:53 +00:00
brendan%mozilla.org 9d476409b6 Fixed getter/setters, pave way for brutal sharing (15146, r=shaver@mozilla.org,rogerl@netscape.com) 1999-11-02 02:23:50 +00:00
brendan%mozilla.org 526bfd1116 - Chouck's changes to grow a JSIdArray if necessary in JS_Enumerate, with my
code review and fixes (r=chouck@geocast.com).  He needs this cuz he has no
  knowledge of exact number of properties before new-style enumerating them.
- Patch up jsdbgapi.c a bit -- it needs to use OBJ_GET_ATTRIBUTES and new APIs
  to do a better job describing properties to a debugger.
- Add JSMSG_CANT_DESCRIBE_PROPS for bogus non-native error case in jsdbgapi.c.
- Fix "Inappropriate" => "invalid" in JSMSG_BAD_ARRAY_LENGTH message.
1999-10-25 19:24:03 +00:00
dmose%mozilla.org 16e0d1f95e update license boilerplate to NPL-1.1 dual-licensed with the GPL. a=brendan, r=brendan. 1999-09-28 23:12:09 +00:00
jband%netscape.com 86940cf070 changed MAP_IS_NATIVE to allow for objects that have their own jsObjectOps but still use the slots in the 'normal' manner (this is necessary for XPConnect) - same change as made on SpiderMonkey140_BRANCH 1999-02-18 05:36:16 +00:00
fur%netscape.com 7b75221d8c 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.
1998-10-14 10:22:38 +00:00
fur ddc67e87cf Initial checkin of JavaScript 1.3, migrated from JSFUN13_BRANCH in /m/src repository 1998-04-24 00:31:11 +00:00
ltabb 3b56a9af51 Free the lizard 1998-03-28 02:44:41 +00:00