Rhino: patch for IdScriptable.java and question about useDynamicScope
Date:
Mon, 16 Apr 2001 17:55:19 +0200
From:
Igor Bukanov <igor.bukanov@windriver.com>
Organization:
Wind River
To:
Norris Boyd <nboyd@atg.com>
Hi, Norris!
Here is a patch to IdScriptable.java that fixes sealed semantic and
makes Something.prototype.constructor to behave just as having DONTENUM
attribute, not DONTENUM|READONLY|PERMANENT. It also renames
seal_function to sealFunctions.
I also have a following question. I added nextInstanceCheck to
IdScriptable.java and its usage in realThis in NativeDate to emulate
code from FunctionObject where it looks up prototype in search for
NativeSomething instance if useDynamicScope is true. But could you
describe why it is necessary? I can understand why doing something like
var proto = new Date();
function Test() { }
Test.prototype = proto;
var test = new Test();
print(test.getDay()); // same as proto.getDay()
would be useful in ceratain situations, but what it has to do with
shared scopes?
Regards, Igor
arguments objects are prototyped by Object.prototype, per ECMA. We still
want a custom class, in order to lazily resolve active-JSStackFrame-based
properties.
- Use a reserved slot to hold a bitmap of deleted arguments elements, so we
don't re-resolve them after they've been deleted (which would make them seem
to be permanent, contrary to ECMA). This work involved sprucing up several
fundamental types (jsbitmap) and macros (jsbitmap helper macros in jsbit.h,
JS_HOWMANY in jstypes.h, JSVAL_INT_BITS in jsapi.h).
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.
Minor fix to JSDebugger
Date:
Wed, 28 Mar 2001 16:34:24 -0800
From:
Christopher Oliver <coliver@mminternet.com>
Organization:
Primary Interface LLC
To:
nboyd@atg.com
Hi Norris,
Attached is a minor fix to the JSDebugger GUI that causes the tool-bar buttons to all have the same width.
I checked out and modified a file from CVS today. See the screenshot below.
Cheers,
Chris
in both directions.
72552: Remedy overzealous CHECK_REQUEST placement in jsapi.c, to produce a
minimal-but-complete set of engine entry points that require a Request
for safe execution.
r=brendan, sr=jband, assist=scc,pinkerton
where any occurrence of arguments.length or arguments[0], e.g., would be
"optimized" to use those bytecodes. This is just wrong if the occurrence
is an operand of delete, ++, --, or the left-hand-side of an assignment
operator!
- [jsfun.c, jsinterp.c] args_getProperty etc. must use JS_GetInstancePrivate,
not JS_GetPrivate, as the arguments object is exposed, and can be made a
prototype of other objects that do not have private data, or private data
that's a JSStackFrame*. Same goes for fun_getProperty, js_GetArgument, etc.
- [jsfun.c, jsobj.c, jsstr.c] No need to specialize fun_delProperty and
str_delProperty to help convince users and ECMA conformance tests that
fun.length and str.length are direct properties of instances, instead of
being delegated to Function.prototype.length and String.prototype.length.
This special case is done universally in js_DeleteProperty for all SHARED
and PERMANENT proto-properties.
- [jshash.c] Sneaking this followup-fix for bug 69271 in: use JS_HASH_BITS
rather than hardcoded 32.
- [jsobj.c, jsscope.[ch]] Fix misnamed js_HashValue (it takes a jsid, so it
is now js_HashId).
- [jsscript.c] script_compile needs to call JS_InstanceOf, to ensure that obj
is a Script object.
- Don't ape java.lang.String's bogo-sampling hash function for "long" (>=16
char) strings.
- Theory and practice comment in jsdhash.h helps analyze when to use double
hashing (most of the time) vs. when to use chaining.
- Subroutine ChangeTable from JS_DHashTableOperate so it can be called from
JS_DHashTableEnumerate, if the latter finds that enough entries have been
removed to be worth a shrink or compress cycle.
- teach nsGenericFactory about nsIClassInfo, and nsIClassInfo.idl to the
builds
- add a heaping serving of macro love for classes that want to support it
- convert many modules to use nsGenericModule the new way
- handful of warning and modeline fixes
- nsSample and some XPConnect test classes now have nsIClassInfo support for
testing