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

3963 Коммитов

Автор SHA1 Сообщение Дата
jband%netscape.com c052cc3bf0 fix Mac bustage (I hope). I think these names conflicted with other names 2001-11-01 01:15:53 +00:00
seawood%netscape.com 8a2a775382 Since '-framework Carbon' causes binaries to require console access to run, do not link using that flag by default. Otherwise, remote builds & non-console tinderboxes will break. Mac OSX Mach-O only.
Bug #107696 r=mozbot
2001-11-01 00:54:48 +00:00
pete%alphanumerica.com b52992027b b=107823, r=ccarlen, sr=brendan
--pete
2001-11-01 00:11:15 +00:00
jband%netscape.com 2882268cda added files: mozilla/js/src/xpconnect/src/xpcvariant.cpp 2001-10-31 23:36:34 +00:00
jband%netscape.com 84bfc894a4 add support for nsIVariant and nsIPropertyBag. bug 44675 and bug 98209. sr=vidur r=dbradley 2001-10-31 23:35:07 +00:00
rginda%netscape.com 7491994718 bug 99601, don't install xpconnect debugger keyword handler if one is already there, r=jband, sr=brendan 2001-10-31 23:13:17 +00:00
brendan%mozilla.org 2caef4a183 Don't try to correct = to == if strict, do it only if downrev (106244, r=jband, sr=shaver). 2001-10-31 03:17:00 +00:00
pschwartau%netscape.com fb838280d6 Initial add. Regression test for bug 94257. 2001-10-31 02:32:38 +00:00
nboyd%atg.com 3067721c3c Fix bug with test case:
var testArray = new Array(6);
testArray[1+1]+=2;
2001-10-30 14:06:58 +00:00
nboyd%atg.com 787b93699a Hello Norris
The following test case case leads to a compilation error in Rhino. In this
script alert is an user defined
function in the global object and it shows the value of the specified
parameter in a popup window. Save the script as a html file and run it under
Netscape and IE. The output via their JS engines is that alert(1)
executes but the execution of line fails as blks variable is undefined. The
Fix bug:

Rhino engine fails at compilation time itself and cannot excute the script.
It doesn't like the syntax of line.


Steven


/// ****************  test case **************    ///
<script>
alert(1);
  blks[ 10 << 2 ] |= true;
  alert(2);
</script>


/// **********************  Error Message ************************** ////
evaluating script: null
java.lang.NullPointerException
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICodeFromTree(Compiled Code)
  at
org.mozilla.javascript.Interpreter.generateScriptICode(Interpreter.java)
  at org.mozilla.javascript.Interpreter.compile(Interpreter.java)
  at org.mozilla.javascript.Context.compile(Context.java)
  at org.mozilla.javascript.Context.compile(Context.java)
2001-10-30 13:55:26 +00:00
rginda%netscape.com db43fadc93 bug 99601, add filter support to js/jsd, r=jband sr=brendan
large addition to the jsd_xpc component allows arbitrary filtering of debug hooks by url pattern, line range, and global object.  also adds ability to begin instrumenting jsscripts at app startup.
2001-10-30 13:41:32 +00:00
nboyd%atg.com 0babafcaa0 Patch from Igor:
I must admit this is very subtitle, but still...

Here are the lines from
    public void defineProperty(String propertyName, Object delegateTo,
                               Method getter, Method setter, int attributes)


        GetterSlot slot = (GetterSlot)getSlotToSet(propertyName,
                                                   propertyName.hashCode(),
                                                   true);
        slot.delegateTo = delegateTo;
        slot.getter = getter;
        slot.setter = setter;
        slot.setterReturnsValue = setter != null && setter.getReturnType() != Void.TYPE;
        slot.value = null;
        slot.attributes = (short) attributes;
        slot.flags = (byte)flags;

Now suppose that after the new slot is added, another thread is accessing it. Then it would see not yet ready slot with all nasty consequences! For example,  SMP computer can re-arrange writes so the new value of slot.flags would be visible before slot.getter then another thread would generate null pointer exception.

race2_fix.diff fixes that by using the explicit Slot argument to addSlot instead of boolean flag so the new slot can be fully initialized and then inserted under synchronization to the table. I also call addSlot directly because it is supposed to be used with not-yet existed properties and split addSlot to addSlot and addSlotImpl so in case of table growth there is no need to re-enter already synchronized monitor.

This changes also allows to explicitly throw RuntimeException if defineProperty is called for the property that is already exists instead of either throwing cast exception in "GetterSlot slot = (GetterSlot)getSlotToSet(propertyName," or worth yet re-initializing already existed slot.

Regards, Igor
2001-10-30 13:07:00 +00:00
nboyd%atg.com 08247fcd49 Print either line or file name if either is present. 2001-10-30 12:59:30 +00:00
pschwartau%netscape.com 489809edc1 Adding reference to another Bugzilla bug this testcase covers. 2001-10-30 03:28:15 +00:00
brendan%mozilla.org 7000513580 Ensure atom strings are immutable -- duh! (107138, r=jag, sr=jband). 2001-10-30 02:33:41 +00:00
pschwartau%netscape.com cd0a6755c1 Initial add. Regression test for bug 107138. 2001-10-30 00:20:03 +00:00
brendan%mozilla.org 671178cbdb Consolidate property cache flush under JS_ClearScope (107265, r=shaver, sr=jband). 2001-10-29 19:30:03 +00:00
brendan%mozilla.org d27c4cb86f Followup to bug 56940's big patch, tighten GC-mark case analysis, assume atom strings are immutable. 2001-10-28 22:37:25 +00:00
brendan%mozilla.org 114a9d244c Ensure proper pointer alignment in oversized arena footers (105726, r/sr=jband,shaver). 2001-10-28 20:41:53 +00:00
brendan%mozilla.org 467cafd25f Avoid stack overflow in js_EmitTree on long left-associative operator chains (98901, r=jband, sr=shaver). 2001-10-27 18:38:16 +00:00
seawood%netscape.com 9b5ae05e33 Landing the rest of the mach-o OSX changes.
Bug #75653 r=cls sr=waterson
2001-10-27 07:38:18 +00:00
pschwartau%netscape.com 6a49244c08 Fixing a typo 2001-10-27 00:48:14 +00:00
rginda%netscape.com a38f6a4b18 check in jband's fix for command paths on win2k, whitespace nits. 2001-10-26 21:37:51 +00:00
mike+mozilla%meer.net 41da6c554a Initial checkin of build file for Darwin1.4.mk. It just includes Darwin1.3.mk. Because I happened to be fooling around with an OS X system. 2001-10-26 09:38:43 +00:00
alecf%netscape.com a6790acff4 other part of bug 106130, remove unicharutil dependency and linking (just requires updates) 2001-10-26 03:06:04 +00:00
brendan%mozilla.org 63754279fd epstein@tellme.com's patch implementing JS_ClearNewbornRoots (106790, r=brendan, sr=jband). 2001-10-26 02:38:10 +00:00
brendan%mozilla.org 862a59da87 khanson@netscape.com's fix for silent ValueIsLength failure (101488, r=rogerl, sr=me). 2001-10-26 02:35:01 +00:00
jst%netscape.com 05bb290330 Fixing bug 106823. Pass the length to nsAString::Assign() to make sure we don't loose embedded null characters in strings, and also to speed things up a bit. Also trunkate strings before 'voiding' them to make sure old string data is deleted from the string before it's reused. r=bzbarsky@mit.edu, rs=jband@netscape.com 2001-10-26 02:18:16 +00:00
dbradley%netscape.com 900bb81362 Bug 106130 - Remove dependancy of xpconnect on intl. r=alecf, sr=shaver, patch=jband 2001-10-25 12:07:23 +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
jaggernaut%netscape.com 1541469c6a Bug 53057: Fixing up users of implicit |CharT*| conversion operators for nsCString to use |.get()| instead, rr=dbaron, rs=scc 2001-10-24 09:43:59 +00:00
jst%netscape.com ec6e6aa5da Fixing bug 69468. Finally adding support for string nullness to XPConnect. r=jaggernaut@netscape.com, shaver@mozilla.org, sr=jband@netscape.com 2001-10-24 07:15:06 +00:00
pschwartau%netscape.com 9565961ff0 Adding two more cases to the test. 2001-10-24 02:01:59 +00:00
pschwartau%netscape.com 53e1fc0bb1 Improving comments. 2001-10-23 23:02:25 +00:00
pschwartau%netscape.com 80bbc8630d Initial add. Test for regexps with global flag set. 2001-10-23 22:29:01 +00:00
pschwartau%netscape.com a61d44caad More accurate comment. 2001-10-23 19:28:40 +00:00
pschwartau%netscape.com fa37601fdb Correcting an error in comments. 2001-10-23 19:12:42 +00:00
pschwartau%netscape.com 37ce28ddd4 Minor changes in style. 2001-10-23 17:39:31 +00:00
cls%seawood.org b41bf3571c Since the purpose of --enable-ultrasparc is to just flip on the ultrasparc-specific js compare & swap code, move the asflags/defines to turn it on back into js/src/Makefile.in rather than causing the entire project to be built with those flags. 2001-10-23 08:17:16 +00:00
pschwartau%netscape.com 4965e9aa2c Adding comments. 2001-10-22 23:59:20 +00:00
dougt%netscape.com 0a62d4e8d5 99163 - removing nsObserverService.h includes. Also fixing 106090, extra methods on nsObserverService. r=shaver@mozilla.org, sr=jband@netscape.com 2001-10-22 22:01:27 +00:00
alecf%netscape.com c8469b7ac5 bug 100214 - add libunicharutil_s to all unix projects that require it, r=cls 2001-10-22 20:44:02 +00:00
pschwartau%netscape.com e8e300d648 Improving readability. 2001-10-22 20:09:12 +00:00
pschwartau%netscape.com 53c5b4683a Initial add. Regression test for Bugzilla bug 105972. 2001-10-22 20:06:52 +00:00
jaggernaut%netscape.com 3e278e4913 Bug 105973: s/Observe/observe/ 2001-10-22 04:16:33 +00:00
dougt%netscape.com d18d7e2b17 nsIObserver and nsIObserverService API freeze. r=rpotts@netscape.com, alecf@netscape.com. bug 99163 2001-10-19 20:52:59 +00:00
brendan%mozilla.org ef987373e8 Avoid converting lock-free to lock-full scope from GC mark call-outs (105571, r=jst, sr=jband). 2001-10-19 03:02:41 +00:00
nboyd%atg.com b2eea2f3d4 Patch from Igor:
Unsynchronized ScriptableObject.getSlotToSet contains references/modifications
to the slots array which is no go under multithreading. The attached patch
replaces references to slots by references to its local copy and moves code
to allocate the initial array to synchronized addSlot.

The patch also replace throwing of RuntimeException in case of broken code by
if (Context.check && badCondition) Context.codeBug();

Regards, Igor
2001-10-18 18:16:28 +00:00
nboyd%atg.com eef3184d67 Apparently the "classic" compiler is not only deprecated in JDK 1.4, but it
also has a significant regression introduced in it.   The default compiler
not only works, but also is noticably faster.  Ant takes care of the
selection of the compiler automatically based on the JDK level, so the
following patch should make things better all around.
2001-10-17 12:59:48 +00:00
nboyd%atg.com 78ab3bb949 Remove deprecated class. 2001-10-17 12:59:18 +00:00
nboyd%atg.com 250051383e Remove deprecated FlattenedObject.
Patch from Igor:
The 2 attached patches allow to avoid wrapping of array indexes to Double object
when Interpreter knows that the index is an integer number. It speed up array
benchmark by 5-10%

array_access.diff adds to ScriptRuntime getStrIdElem and setStrIdElem to get/set
properties which known to be strings plus it modifies NativeArray to use these methods.

interpreter.diff contains the Interpreter modifications to call get/setElem for
integer or string properties when the property type is known for sure.
2001-10-17 12:59:02 +00:00
nboyd%atg.com 1bc0630719 Backslashes don't work. 2001-10-17 12:53:39 +00:00
dbradley%netscape.com 19f0e89f2b bug 103649 - Crash when rendering a page with hundreds of iframes - This reduces the number of calls to JS_ContextIterator from XPCJSRuntime::SyncXPCContextList. It is only the first step in addressing this bug. r=jband, sr=jst 2001-10-17 11:52:55 +00:00
brendan%mozilla.org 38b3c5bb4b Checking in scole@planetweb.com's patch to prefix str_escape with js_ (96084, r=rogerl, sr=brendan). 2001-10-17 08:16:53 +00:00
brendan%mozilla.org 43a911aeb6 Fixes for bug 80981 (``Need extended jump bytecode to avoid "script too large"
errors, etc.''):

We now ReportStatementTooLarge only if
- a jump offset overflows 32 bits, signed;
- there are 2**32 or more span dependencies in a script;
- a backpatch chain link is more than (2**30 - 1) bytecodes long;
- a source note's distance from the last note, or from script main entry
  point, is > 0x7fffff bytes.

Narrative of the patch, by file:

- js.c
  The js_SrcNoteName array of const char * is now a js_SrcNoteSpec array of
  "specifiers", structs that include a const char *name member.  Also, due to
  span-dependent jumps at the ends of basic blocks where the decompiler knows
  the basic block length, but not the jump format, we need an offset operand
  for SRC_COND, SRC_IF_ELSE, and SRC_WHILE (to tell the distance from the
  branch bytecode after the condition expression to the span-dependent jump).

- jsarena.[ch]
  JS arenas are used mainly for last-in-first-out allocation with _en masse_
  release to the malloc pool (or, optionally, to a private freelist).  But
  the code generator needs to allocate and grow (by doubling, to avoid O(n^2)
  growth) allocations that hold bytecode, source notes, and span-dependency
  records.  This exception to LIFO allocation works by claiming an entire
  arena from the pool and realloc'ing it, as soon as the allocation size
  reaches the pool's default arena size.  Call such an allocation a "large
  single allocation".

  This patch adds a new arena API, JS_ArenaFreeAllocation, which can be used
  to free a large single allocation.  If called with an allocation that's not
  a large single allocation, it will nevertheless attempt to retract the arena
  containing that allocation, if the allocation is last within its arena.
  Thus JS_ArenaFreeAllocation adds a non-LIFO "free" special case to match the
  non-LIFO "grow" special case already implemented under JS_ARENA_GROW for
  large single allocations.

  The code generator still benefits via this extension to arenas, over purely
  manual malloc/realloc/free, by virtue of _en masse_ free (JS_ARENA_RELEASE
  after code generation has completed, successfully or not).

  To avoid searching for the previous arena, in order to update its next
  member upon reallocation of the arena containing a large single allocation,
  the oversized arena has a back-pointer to that next member stored (but not
  as allocable space within the arena) in a (JSArena **) footer at its end.

- jscntxt.c
  I've observed for many scripts that the bytes of source notes and bytecode
  are of comparable lengths, but only now am I fixing the default arena size
  for cx->notePool to match the size for cx->codePool (1024 instead of 256).

- jsemit.c
  Span-dependent instructions in JS bytecode consist of the jump (JOF_JUMP)
  and switch (JOF_LOOKUPSWITCH, JOF_TABLESWITCH) format opcodes, subdivided
  into unconditional (gotos and gosubs), and conditional jumps or branches
  (which pop a value, test it, and jump depending on its value).  Most jumps
  have just one immediate operand, a signed offset from the jump opcode's pc
  to the target bytecode.  The lookup and table switch opcodes may contain
  many jump offsets.

  This patch adds "X" counterparts to the opcodes/formats (X is suffixed, btw,
  to prefer JSOP_ORX and thereby to avoid colliding on the JSOP_XOR name for
  the extended form of the JSOP_OR branch opcode).  The unextended or short
  formats have 16-bit signed immediate offset operands, the extended or long
  formats have 32-bit signed immediates.  The span-dependency problem consists
  of selecting as few long instructions as possible, or about as few -- since
  jumps can span other jumps, extending one jump may cause another to need to
  be extended.

  Most JS scripts are short, so need no extended jumps.  We optimize for this
  case by generating short jumps until we know a long jump is needed.  After
  that point, we keep generating short jumps, but each jump's 16-bit immediate
  offset operand is actually an unsigned index into cg->spanDeps, an array of
  JSSpanDep structs.  Each struct tells the top offset in the script of the
  opcode, the "before" offset of the jump (which will be the same as top for
  simplex jumps, but which will index further into the bytecode array for a
  non-initial jump offset in a lookup or table switch), the after "offset"
  adjusted during span-dependent instruction selection (initially the same
  value as the "before" offset), and the jump target (more below).

  Since we generate cg->spanDeps lazily, from within js_SetJumpOffset, we must
  ensure that all bytecode generated so far can be inspected to discover where
  the jump offset immediate operands lie within CG_CODE(cg).  But the bonus is
  that we generate span-dependency records sorted by their offsets, so we can
  binary-search when trying to find a JSSpanDep for a given bytecode offset,
  or the nearest JSSpanDep at or above a given pc.

  To avoid limiting scripts to 64K jumps, if the cg->spanDeps index overflows
  65534, we store SPANDEP_INDEX_HUGE in the jump's immediate operand.  This
  tells us that we need to binary-search for the cg->spanDeps entry by the
  jump opcode's bytecode offset (sd->before).

  Jump targets need to be maintained in a data structure that lets us look
  up an already-known target by its address (jumps may have a common target),
  and that also lets us update the addresses (script-relative, a.k.a. absolute
  offsets) of targets that come after a jump target (for when a jump below
  that target needs to be extended).  We use an AVL tree, implemented using
  recursion, but with some tricky optimizations to its height-balancing code
  (see http://www.enteract.com/~bradapp/ftp/src/libs/C++/AvlTrees.html).

  A final wrinkle: backpatch chains are linked by jump-to-jump offsets with
  positive sign, even though they link "backward" (i.e., toward lower bytecode
  address).  We don't want to waste space and search time in the AVL tree for
  such temporary backpatch deltas, so we use a single-bit wildcard scheme to
  tag true JSJumpTarget pointers and encode untagged, signed (positive) deltas
  in JSSpanDep.target pointers, depending on whether the JSSpanDep has a known
  target, or is still awaiting backpatching.

  Note that backpatch chains would present a problem for BuildSpanDepTable,
  which inspects bytecode to build cg->spanDeps on demand, when the first
  short jump offset overflows.  To solve this temporary problem, we emit a
  proxy bytecode (JSOP_BACKPATCH; JSOP_BACKPATCH_PUSH for jumps that push a
  result on the interpreter's stack, namely JSOP_GOSUB; or JSOP_BACKPATCH_POP
  for branch ops) whose nuses/ndefs counts help keep the stack balanced, but
  whose opcode format distinguishes its backpatch delta immediate operand from
  a normal jump offset.

  The cg->spanDeps array and JSJumpTarget structs are allocated from the
  cx->tempPool arena-pool.  This created a LIFO vs. non-LIFO conflict: there
  were two places under the TOK_SWITCH case in js_EmitTree that used tempPool
  to allocate and release a chunk of memory, during whose lifetime JSSpanDep
  and/or JSJumpTarget structs might also be allocated from tempPool -- the
  ensuing release would prove disastrous.  These bitmap and table temporaries
  are now allocated from the malloc heap.

- jsinterp.c
  Straightforward cloning and JUMP => JUMPX mutating of the jump and switch
  format bytecode cases.

- jsobj.c
  Silence warnings about %p used without (void *) casts.

- jsopcode.c
  Massive and scary decompiler whackage to cope with extended jumps, using
  source note offsets to help find jumps whose format (short or long) can't
  be discovered from properties of prior instructions in the script.

  One cute hack here: long || and && expressions are broken up to wrap before
  the 80th column, with the operator at the end of each non-terminal line.

- jsopcode.h, jsopcode.tbl
  The new extended jump opcodes, formats, and fundamental parameterization
  macros.  Also, more comments.

- jsparse.c
  Random and probably only aesthetic fix to avoid decorating a foo[i]++ or
  --foo[i] parse tree node with JSOP_SETCALL, wrongly (only foo(i)++ or
  --foo(i), or the other post- or prefix form operator, should have such an
  opcode decoration on its parse tree).

- jsscript.h
  Random macro naming sanity: use trailing _ rather than leading _ for macro
  local variables in order to avoid invading the standard C global namespace.
2001-10-17 03:16:48 +00:00
jaggernaut%netscape.com ce6e434d2a More REQUIRES clean-up. 2001-10-16 22:08:55 +00:00
pschwartau%netscape.com f28aa32398 Comment fix. 2001-10-16 19:22:47 +00:00
nboyd%atg.com af90c96f02 Test not valid in JDK 1.4. 2001-10-16 18:33:38 +00:00
pschwartau%netscape.com 0c21f002ec Skip new test that uses the gc() function of SpiderMonkey. 2001-10-16 18:14:19 +00:00
pschwartau%netscape.com d952a19514 Intial add. Regression test for Bugzilla bug 104584. 2001-10-16 17:46:26 +00:00
jband%netscape.com e6e171574e trivial warning fix. rs=jband 2001-10-16 05:48:25 +00:00
brendan%mozilla.org eb9671e246 Add SetAlphaBounds, TABLE_SIZE, and MIN_ALPHA APIs (103990, r=dbaron, sr=waterson). 2001-10-16 05:40:27 +00:00
dougt%netscape.com 4f3a44d63b API Freeze for nsIServiceManager r=shaver@mozilla.org, sr=rpotts@netscape.com bug 99147 2001-10-16 03:35:52 +00:00
brendan%mozilla.org 12d650dc85 Fix js_GC to mark max(#actuals, #formals) slots at fp->argv (104584, r=shaver, sr=jband). 2001-10-16 02:21:02 +00:00
bryner%netscape.com 7e89125660 Bug 102725 -- problems converting numbers to strings when using gcc -O2. r=bbaetz, sr=brendan. 2001-10-15 22:31:39 +00:00
nboyd%atg.com 9ccbb97cbb Fix 104493:
We have a tool that looks for a scary noop case of assigning an instance field
to itself. this usually comes from a constructor that assigns a argument to a
instance field with the same name and then later the argument changes name. we
ran our tool on all of our classes we have in our classpath here and found this
problem in your code.

rhino1_5R2/src/org/mozilla/javascript/regexp/NativeRegExp.java line 159 it has:
        this.flags = flags;

This seems to be a bad cut and paste from the CompilerState constructor on line
2155. or has some initialization that used to work been lost?
2001-10-13 12:06:16 +00:00
pschwartau%netscape.com a6a85c77d4 Initial add. Regression test for bug 104375. 2001-10-12 21:28:43 +00:00
jband%netscape.com e21b56807d not yet part of build. support tracking the iid in array of interfaces 2001-10-12 20:29:19 +00:00
pschwartau%netscape.com 9c84b7f6f0 Initial add. Regression test for bug 104077. 2001-10-10 20:50:27 +00:00
pschwartau%netscape.com b650df504b Minor change to make test exactly the same as the one reported in bug 102725. 2001-10-10 20:36:17 +00:00
brendan%mozilla.org 064c4cae19 Avoid O(n**2) growth rate of token buffer arena-based reallocation (103042, r=jband, sr=shaver). 2001-10-10 20:19:12 +00:00
rginda%netscape.com 6c53ec4ba6 bug 103804, "Venkman doesn't like stopping in timeouts", r=jband, sr=shaver
add callback to the enterNestedEventLoop method
2001-10-10 06:35:46 +00:00
pschwartau%netscape.com ee091c31af Initial add. Regression test for bug 102725. 2001-10-10 01:32:28 +00:00
jband%netscape.com 900a5bfba9 NOT PART OF BUILD. bug 44675. bug 98209. New files 2001-10-09 23:42:22 +00:00
pschwartau%netscape.com 2059c2f02a Skip this test for now. Currently uses the non-EMCA 'it' object of SpiderMonkey. 2001-10-09 23:28:21 +00:00
pschwartau%netscape.com d6986f9388 Initial add. Regression test for bug 99663. 2001-10-09 23:12:16 +00:00
rginda%netscape.com 28b0c9fa5b bug 103831, r=cls, sr=jband
remove java stubs
2001-10-09 21:43:15 +00:00
dbradley%netscape.com 6907d52b27 bug 102750 - Can't call JSIID.equals from web content. r=mstoltz, sr=jband 2001-10-09 18:54:37 +00:00
nboyd%atg.com 2eb21c32b3 Fix name of function in error message 2001-10-09 00:54:49 +00:00
jband%netscape.com 5992cc2572 fix bug 103259. Avoid crasher by correctly marking sharedscriptable object so that JSClasses don't get collected prematurely even when wrapper is 'stillborn' and not reflected into JS. r=dbradley sr=vidur. 2001-10-08 19:56:25 +00:00
rginda%netscape.com 4d363f3ca0 bug 102785, r=dp, sr=shaver, a=asa
remove venkman startup listener so we don't have to load the dll at startup.
checking into 0.9.5 branch also.
2001-10-08 19:44:35 +00:00
nboyd%atg.com f70b7e4c78 Fix for problem:
There is a bug in JavaScriptException which prevents it from being used with
out a Rhino Context.  When the getMessage() method is invoked on it, the
exception goes to the ScriptRuntime to toString the value.  If you have
already exited your context, the runtime will throw an error.  The solution
is to simply remove the overridden getMessage method from
JavaScriptException.  JavaScriptException's constructor calls the Exception
constructor with the toString'ed value.  The default implementation of
getMessage will return the exception message.

Jeff
2001-10-07 18:44:39 +00:00
nboyd%atg.com 6642d0e4f2 Fix for the following problem:
I'm having problems getting inner class objects with Rhino.

I create a Hashmap, which is an implementation of Map. Map.Entry is an
inner interface of Map with key-value pairs. If I have a Map object,
"property", I should be able to get the key element with the expression
"property.key".

When I look at the "property" class name that Rhino returns I get:
"java.util.HashMap$Entry". I don't believe Rhino has a notion of the
inner Map.Entry object. The expression "property" succeeds. The
expression "property.key", which should retrieve the Map.Entry
keyValue(), fails with a "unexpected IllegalAccessException accessing
Java field".

I'm including a simple example that illustrates the problem. I hope you
can shed some light on this. Thanks!

Justyna
< Justyna.Horwat@Sun.com >

----
import java.io.*;
import java.util.*;
import org.mozilla.javascript.*;


public class MapTest {

    public static void main(String argv[]) {
        Test test = new Test();
        test.testMap();
    }
}

class Test {
    Map map;
    Set set;
    Iterator it;
    Map.Entry entry;

    public void testMap() {
System.out.println("testMap");
        map = new HashMap();

        populate();

        set = map.entrySet();
        it = set.iterator();

        // let's see if Map is populated correctly
        while (it.hasNext()) {
            entry = (Map.Entry) it.next();
            System.out.println("entry: " + entry.getClass().getName());
            System.out.println("key: " + entry.getKey());
            System.out.println("value: " + entry.getValue());
        }

        evaluate();
    }

    void populate() {
        map.put("firstKey", "firstValue");
        map.put("secondKey", "secondValue");
        map.put("thirdKey", "thirdValue");
        map.put("fourthKey", "fourthValue");
    }

    public void evaluate() {

        Context cx = Context.enter();
        Scriptable scope = cx.initStandardObjects(null);

        set = map.entrySet();
        it = set.iterator();

        while (it.hasNext()) {
            entry = (Map.Entry) it.next();
            scope.put("property", scope, cx.toObject(entry,scope));
        }

        Object eval = null;

        try {
            // attempt to get Map.Entry key value using Rhino
            eval = cx.evaluateString(scope, "property.key", "", 0,
null);
            // Unwrap scoped object
            if (eval instanceof Wrapper)
                eval = ((Wrapper) eval).unwrap();

        } catch (JavaScriptException jse) {
            System.out.println("EXCEPTION: " + jse.getMessage());
        }

        // DELETE
        System.out.println("RHINO result: " + eval + ":");
        System.out.println("RHINO class: " + eval.getClass().getName());
    }
}
2001-10-07 18:42:09 +00:00
jaggernaut%netscape.com 0c2b3bc449 Bug 81444: eliminate |null_nsCOMPtr|. Eliminating all callers, r=syd, rs=mozbot. 2001-10-07 10:58:39 +00:00
jaggernaut%netscape.com c39b98b2a4 Clean up REQUIRES lines. 2001-10-07 10:35:41 +00:00
brendan%mozilla.org 95df849df8 Fix bogus return JS_FALSE without error report for empty flat string regexp match/replace (83293, r=rogerl, sr=shaver). 2001-10-06 08:07:43 +00:00
pschwartau%netscape.com 6ca4e471c4 Improving comments and readability. 2001-10-05 20:32:12 +00:00
pschwartau%netscape.com c26dfebaed Improving comments. 2001-10-05 18:36:06 +00:00
pschwartau%netscape.com b44e470e4b Initial add. Tests sparse arrays. 2001-10-05 18:27:40 +00:00
pschwartau%netscape.com 9a3fc24abe Skip test of (non-ECMA) fileName, lineNumber properties of Error objects 2001-10-05 16:25:55 +00:00
pschwartau%netscape.com 69ab92c82f Initial add. Regression test for bug 50447. 2001-10-05 16:19:37 +00:00
pschwartau%netscape.com 00d691ea88 Slight changes - 2001-10-05 02:07:47 +00:00
pschwartau%netscape.com 657d299244 Improving readability - 2001-10-05 00:25:11 +00:00
pschwartau%netscape.com c188eb0d39 Including more RegExps. Not checking expected vs. actual matches now; just that we don't crash. 2001-10-04 23:58:24 +00:00
pschwartau%netscape.com 8ad7d34603 Initial add. Regression test for bug 103087. 2001-10-04 19:54:04 +00:00
pschwartau%netscape.com 8e321ed4c9 Fixing bug that prevented -p option from working on the Mac (again!) 2001-10-04 02:08:16 +00:00
brendan%mozilla.org 9324b81dee Fix for bug 99663 (for loop resolves properties of the object being enumerated
with JSRESOLVE_ASSIGNING, wrongly), plus a few miscellaneous bugfixes.

- Combine the JSStackFrame members constructing, special, overrides, and
  reserved into a uint32 flags member.

- Separate JOF_ASSIGNING from the JOF_SET bytecode format flag, and impute
  JSRESOLVE_ASSIGNING from the presence of JOF_ASSIGNING among the current
  opcode's format flags.  To handle the for-in loop opcodes, which do more
  than simply assign -- in particular, they do property lookups whose resolve
  hook outcalls should not be flagged with JSRESOLVE_ASSIGNING -- a new frame
  flag, JSFRAME_ASSIGNING, has been added.

- Fix interpreter version selection to respect JS_SetVersion, whose effect on
  cx->version is "sticky".

- Fix js_DecompileValueGenerator to deal with JSOP_ENUMELEM -- it never had,
  as this testcase shows (it crashes without this patch):

    version(120);
    eval("function fe(s) { for (it[s] in this); }");
    try { fe('rdonly'); } catch (e) { print(e); }
2001-10-03 06:39:30 +00:00
dbradley%netscape.com aa050fb3a4 bug 100665 - Maybe xpconnect should not init the XPCOutArg JSClass. r=jband, sr=shaver 2001-10-03 02:57:42 +00:00
dbradley%netscape.com 9bb2766908 Bug 102294 - printf has an extra parameter. r=jband 2001-10-03 02:48:40 +00:00
nboyd%atg.com 81d6990263 Patch from Igor:
My optimization for PreorderNodeIterator has a bug that would cause an attempt
to access stack[-1] in
    currentParent = (current == null) ? null : stack[stackTop - 1];
when current refers to a start node sibling. This is not visible in Rhino because
currently PreorderNodeIterator is always started from nodes with node.next == null.

iter.diff fixes that plus it removes currentParent field because it is always
available as stack[stackTop - 1] and code to access its value are executed less
frequently than the lines to update it in nextNode

Regarsd, Igor
2001-10-02 12:49:46 +00:00
dbaron%fas.harvard.edu 9a4acbab7a Bug 45797: replace remaining uses of deprecated macros NS_IMPL_QUERY_INTERFACE and friends with NS_IMPL_QUERY_INTERFACE1 and friends and remove the deprecated macros. r=jag sr=alecf 2001-10-02 03:18:08 +00:00
nboyd%atg.com 4ed02f7b8a Fix bug:
var passed = true;
try {
    eval("/* mello /* yello */");
    } catch (e) {
        print(e);
        passed = false;
    }
print(passed);

should print "true", not "false".
2001-10-01 14:25:30 +00:00
jaggernaut%netscape.com 3b8177ee43 Checking in updated mac project file for Venkman (the JS Debugger) 2001-09-30 12:39:29 +00:00
rginda%netscape.com 9b83e1a5a9 - not built -
remove java references, add jsd_xpc.cpp note, explain jsdb.
2001-09-30 08:52:04 +00:00
rginda%netscape.com 2af8768593 move REQUIRES line above include config.mak, to fix bustage 2001-09-30 07:10:21 +00:00
rginda%netscape.com d81887f935 fixing REQUIRES bustage 2001-09-30 06:28:38 +00:00
brendan%mozilla.org 8cf1697439 Check in patch for bug 94580, thanks to Bernard Alleysson <balleysson@bigfoot.com> for researching and writing it (r=me, sr=shaver). 2001-09-29 21:30:26 +00:00
nboyd%atg.com b22c4d0d63 Patch from Igor:
As profiler data show, the execution time of the nextNode and replaceCurrent
methods in PreorderNodeIterator contribute quite significantly to the total
time to run Context.compileReader.

replaceCurrent is slow because it calls Node.replaceChild which have to
iterate through all previous siblings to find the nearest to the current.
But it is easy to avoid this search by caching the previous sibling of the
current while iterating over the node tree in nextNode.

nextNode slowness is attributed to the usage of java.lang.Stack which is
expensive due to its synchronized methods. In the attched patch I replaced
it by the explicit array management.

It allows to cut Context.compileReader time by 5%-30% when processing
20K-3MB sources assembled form JS files in the test suite.
2001-09-29 20:55:36 +00:00
nboyd%atg.com a4c318ad54 More javadoc 2001-09-29 20:55:03 +00:00
nboyd%atg.com bcf8c2b632 Move serialization classes to separate package. 2001-09-29 20:54:08 +00:00
nboyd%atg.com 4a2fc2e226 Move serialization classes to new package. 2001-09-29 20:50:59 +00:00
nboyd%atg.com c7d3c57514 Move serialization files to separate package. 2001-09-29 20:50:18 +00:00
jaggernaut%netscape.com ca6197295f Bug 100476: Convert uses of member functions ToNewUnicode, ToNewCString and ToNewUTF8String to their global versions and remove support from nsCString and nsString. r=dbaron, rs=scc 2001-09-29 08:28:41 +00:00
bryner%netscape.com 28d15740ef Fixing xpctools build on win32. r=cls. 2001-09-29 06:24:41 +00:00
dbradley%netscape.com 2dca78dc34 Items moved to bugzilla or have already been addressed 2001-09-29 00:13:34 +00:00
dbradley%netscape.com 3305314761 Bug 97967 - leak of nsLocalFile on failure. Patch by dbaron, r=dbradley, sr=jband 2001-09-28 21:49:00 +00:00
gerv%gerv.net 4e12e44b2f Relicensing Round 1, Take 2. Most C-like NPL files -> NPL/GPL/LGPL. Bug 98089. 2001-09-28 20:14:13 +00:00
pschwartau%netscape.com 5c97ceca72 Initial add. Regression test for bug 101964. 2001-09-28 04:50:52 +00:00
nboyd%atg.com 3a63e824ea Remove obsolete comment about serialization. 2001-09-27 15:14:24 +00:00
nboyd%atg.com 1682c2fc43 Add new serialization API classes. 2001-09-27 14:59:59 +00:00
shaver%mozilla.org 77d6e73e42 Bug 94506: parameter named "arguments" is not accessible in JavaScript method.
Now we check for the magic "arguments" name after var-and-arg slot
optimizations. r=rogerl, sr=brendan
2001-09-27 14:52:14 +00:00
nboyd%atg.com fdc6f6b166 Add docs for serialization. 2001-09-27 14:51:20 +00:00
nboyd%atg.com fea124fdd5 Remove obsolete files (perhaps re-added by mistake?) 2001-09-27 12:59:30 +00:00
nboyd%atg.com 3d2e81a014 Patches from Igor:
Note form omj/Parser.java:

* OPT source info collection is a potential performance bottleneck;
* Source wraps a java.lang.StringBuffer, which is synchronized.  It
* might be faster to implement Source with its own char buffer and
* toString method.

It is indeed a bottleneck under JDK 1.1. When I replaced StringBuffer
by a char array (see the attached patch), execution time of
Context.compileReader decreased by 15%: to test I combined a few test
cases to get a 3MB JS source and then measured time to process it by
Context.compileReader in the interpreter mode.

Under JDK 1.3 the difference is less then 1%, but still using the explicit
string buffer saves memory. When converting StringBuffer to String Sun JDK
shares the internal char array in StringBuffer with new String, but in the
Parser case typically the capacity of this buffer is bigger then the actual
string length, so this unused space in source strings is wasted in the
interpreter mode that keeps these strings in InterpreterData.

Regards, Igor

========
I implemented that member expression as function name syntactic sugar to
support scripts using this MS extension. This is only available when
Context.hasFeature(Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME)
returns true to allow the deviation from the standard only when required.

The patch effectively transforms 'function <memberExpr>(...)...' to
'<memberExpr> = function(...)...' when <memberExpr> is not simple
identifier. I am not sure that MS implementation does exactly this
but hopefully it is sufficiently general to cover MS cases.

(The patch assumes that source_change.patch is already applied)

Regards, Igor
2001-09-27 12:51:42 +00:00
nboyd%atg.com 367774a772 Patch from Igor:
I implemented that member expression as function name syntactic sugar to support
scripts using this MS extension. This is only available when
Context.hasFeature(Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME)
returns true to allow the deviation from the standard only when required.

The patch effectively transforms 'function <memberExpr>(...)...' to
'<memberExpr> = function(...)...' when <memberExpr> is not simple identifier.
I am not sure that MS implementation does exactly this but hopefully it is
sufficiently general to cover MS cases.

(The patch assumes that source_change.patch is already applied)

Regards, Igor
2001-09-27 12:50:14 +00:00
brendan%mozilla.org 06c740491e Don't report uncaught exceptions unless returning to native code (97646, r=jband, sr=shaver). 2001-09-27 05:04:45 +00:00
nboyd%atg.com 212d1b132a Add support for serialization and deserialization. 2001-09-27 02:33:51 +00:00
dbradley%netscape.com 0b484536e8 Bug 94859 silence compiler warning about unused variable r=rginda, sr=jband 2001-09-26 04:11:54 +00:00
pschwartau%netscape.com 9c2e261f72 Adding comments from contributor. 2001-09-26 01:15:14 +00:00
pschwartau%netscape.com 9fb2c068a7 Correcting some typos. 2001-09-26 00:58:35 +00:00
pschwartau%netscape.com 576808aca7 Initial add. Regression test for bug 101488. 2001-09-26 00:32:11 +00:00
nboyd%atg.com 7c030bfefb Patch from Igor:
Currently omj/TokenStream and omj/optimizer/Optimizer.java both contain
code to convert number value to a wrapper object of smallest size. The
attached patch moves this wrapping to Node constructor to avoid code
duplication and eliminate special treatment of exact integers in
Optimizer.java.


The constant folding code in omj/optimizer/Optimizer.java currently always
replaces x * 1, x - 0 by simply x which does not force the toNumber convertion,
which is visible, for example, via typeof. For example, when running at
optimization level 2, the following

function f() {
    return "0" * 1;
}

print(typeof(f()));

prints "string" instead of expected "number".

The const_fold.patch fixes this via replacing x*1 by (+x) to force number convertion.

It assumes that the patch with number wrapping changes is in place.
2001-09-25 14:09:22 +00:00
nboyd%atg.com 7ccac99fc4 Currently omj/TokenStream and omj/optimizer/Optimizer.java both contain code to
convert number value to a wrapper object of smallest size. The attached patch
moves this wrapping to Node constructor to avoid code duplication and eliminate
special treatment of exact integers in Optimizer.java.
2001-09-25 14:08:08 +00:00
brendan%mozilla.org 3558787cfd Report uncaught exceptions from all JS_Compile* APIs (97646, sr=jband&shaver). 2001-09-25 06:43:33 +00:00
dbradley%netscape.com a47dae7c99 patch from bug 99838 - Changes to remove xpconnects dependency on DOM r=jband, sr=jst 2001-09-24 22:57:47 +00:00
dbradley%netscape.com 03a4f2723c added files: mozilla/js/src/xpconnect/idl/nsIXPCScriptNotify.idl 2001-09-24 22:53:00 +00:00
dbradley%netscape.com 1f85e703a9 patch from bug 99838 - Changes to remove xpconnects dependency on DOM r=jband, sr=jst 2001-09-24 22:48:35 +00:00
nboyd%atg.com 6a75823f31 Remove obsolete class. 2001-09-23 20:01:43 +00:00
nboyd%atg.com 113dae7eb7 Fix bug:
Hello Norris

The script should return 0, Rhino returns NaN

Steven

<script>
var trial = parseInt("0)");
alert(trial);
</script>
2001-09-23 20:01:31 +00:00
nboyd%atg.com 8bb4a031bf Patch from Igor:
Currently omj/optimizer/Codegen.java uses special classes ConstantList
and ConstantDude to store the list of static constants in the generated
class. It seems that using a simple double[] array with a constant
counter and checking via "(int)number == number" for constant types not
only eliminates these 2 classes but makes the whole code simple, see
the attached patch.

The patch also modifies nodeIsConvertToObjectOfNumber to return not a
Number, but the number node itself that is used to extract double
value directly via Node.getDouble() call. I changed it to allow  to
store values of number literals in nodes without using wrapper object.
2001-09-23 20:00:26 +00:00
nboyd%atg.com 5ad714f337 Patch from Igor:
Replacing usage of ShallowNodeIterator to loop throw node children by
explicit calls to Node.getFirstChild()/ Node.getNextSibling()) with
comments when the node children list is modified while iterating
through it.

It avoids creation of ShallowNodeIterator objects and eliminates the
need to have ShallowNodeIterator class.
2001-09-23 19:58:38 +00:00
cls%seawood.org 69b6808ca6 Use default EXPORTS rules instead of installing headers by hand.
Bug #98371 sr=alecf
2001-09-23 03:34:32 +00:00
jband%netscape.com 801cc884a1 I'm tired of this warning: '*/' found outside of comment. This was much discussed. But no one ever bothered to actually check in the trivial fix. r=rginda rs=jband. 2001-09-22 17:42:36 +00:00
rginda%netscape.com c07e99883d - venkman only -
bug 100943, changes needed to build jsd on os/2
patch by Dainis Jonitis, r=mkaply,rginda
2001-09-22 01:39:24 +00:00
pschwartau%netscape.com b38eac9fd6 Make formatArray() work in Rhino. Improve getState() by checking for more whitespace characters. 2001-09-21 22:44:46 +00:00
timeless%mac.com d2a5676d57 Bug 100873 JS Hard Codes JS_HAVE_LONG_LONG to the detriment of FreeBSD
r=cls sr=shaver
2001-09-21 14:09:54 +00:00
jband%netscape.com afa3e0b204 fix bug 100222. Fix crash by only releasing other objects in xpcwrappedjs dtor if xpconnect has not yet shutdown. r=dbradley sr=jst. 2001-09-20 00:51: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
nboyd%atg.com dfdc492a06 Patch from Igor:
Currently Rhino source has quite a few places with code like (String)node.getDatum()
 or ((Number)node.getDatum()).doubleValue(). The patch changes this usage to call
node.getString() or node.getDouble().

It also adds new constructors to Node to accept int or double values in addition to
Object datum to replace new Node(token, new Integer(x)) by Node(token, x) etc. It
may allow in future not to create a wrapper object for int or double datum to speed
up parsing.
2001-09-19 17:01:46 +00:00