Commit Graph

571 Commits

Author SHA1 Message Date
Brendan Eich
f028f26f52 Merge. 2008-08-08 16:40:45 -07:00
Brendan Eich
072c7b59a5 Guard against shapeless callees, with tests (more to do here, can't break the unknown callee case yet, but it should be breakable). 2008-08-08 16:37:01 -07:00
Andreas Gal
c7be42f2f3 Add very preliminary nesting for trees. This is disabled by default. To enable set TRACEMONKEY=nesting in the environment. 2008-08-08 15:26:31 -07:00
Brendan Eich
de40e589da Merge. 2008-08-08 14:45:27 -07:00
Brendan Eich
153e03bb32 Get operator new on interpreted functions working, along with JSOP_SETPROP on an unmutated object, or one of the right shape but where the setprop is adding the next property, and it's not in the object yet. 2008-08-08 14:38:44 -07:00
Andreas Gal
f2972efa5c Remove tracking of outer trees and merging of globals since globals will be maintained centrally soon, not attached to trees. 2008-08-07 19:40:41 -07:00
Andreas Gal
2d0c9c41ab Hand the script in when updating the oracle regarding global variable slots even if we don't use it right now. This will be useful for caching information across runtimes. 2008-08-07 17:43:13 -07:00
Andreas Gal
3ac96b066b Use a typedef SlotList instead of Queue<uint16>. 2008-08-07 17:22:21 -07:00
Andreas Gal
a21818bc72 Teach typemaps how to capture the types of all slots in a slot list. 2008-08-07 17:20:49 -07:00
Andreas Gal
d988d3523a Recognize loop edges that hit a nested tree. 2008-08-07 16:41:20 -07:00
Andreas Gal
600b9c3e14 Remove type-map hash code. A direct memcmp seems to be faster (probably some SSE magic behind it in gcc/glibc). 2008-08-07 16:26:56 -07:00
Andreas Gal
27e8ef817a Factor out the code to capture the current stack type map and move around the type map method implementations to make sure they can see the FORALL macros. 2008-08-07 16:23:50 -07:00
Andreas Gal
95f5262e4f Use an oracle to predict when slots are demotable. This allows trashing the TreeInfo* object in the root fragment more aggressively. Rebuild the stack type map at every compile to avert type map mismatches. Purge all global slot info when we re-record a tree. 2008-08-07 15:28:43 -07:00
Andreas Gal
e09041e2a5 If we run into an error during compilation, blacklist that fragment. If we run out of memory, flush the cache. 2008-08-06 22:26:20 -07:00
Andreas Gal
9385e7842c Add a helper to flush the JIT code cache (and the fragment lookup quick cache). On a global shape mismatch trash the entire cache (might be a bit overly aggressive). Similary, during GC flush the code cache. 2008-08-06 21:56:25 -07:00
Andreas Gal
d1a1a76121 Tracker outer trees for every tree and merge globals of inner trees into all outer trees as we register inner trees with outer trees. 2008-08-06 19:25:24 -07:00
Andreas Gal
6bb6800be5 Add a contains method to Queue. 2008-08-06 19:06:37 -07:00
Andreas Gal
1bf2697257 Add a helper to emit a tree-call into the currently recording trace. 2008-08-06 16:24:29 -07:00
Andreas Gal
fcaab6d007 Pull recompile flag out of the state and pass in as argument. Trash the tree if a secondary trace can't be connected to the loop header. This is very aggressive and might need more tinkering. Trashing the tree on every mismatch doesn't seem to work well, so thats currently disabled. 2008-08-06 13:37:29 -07:00
Brendan Eich
2cfdd9a55a 1. Don't store thisp literally in state.rp, get it from argv[-1]. 2. Fix DEBUG localNames code. 2008-08-01 10:40:38 -07:00
Brendan Eich
422ce674b5 Remove synthesizeFrames private declaration -- js_SynthesizeFrames is a static helper now. 2008-08-01 08:39:44 -07:00
Brendan Eich
8f837e0784 - Implement interpreter frame reconstruction (js_SynthesizeFrame).
- Fix MONITOR_BRANCH to restore frame-dependent interpreter locals (we want fewer of these if they can be removed with no perf loss).
- Fix FORALL_SLOTS_IN_PENDING_FRAMES not to scan argv in callee when it has scanned operand stack in caller.
- Fix import to take the localFrame from whose fun its localNames parameter was computed -- it was using cx->fp which is wrong when FORALL_SLOTS_IN_PENDING_FRAMES iterates other than the top of stack frame.
- A few interval tests that were double-ended are single-ended now.
- Add call.js mini-test (more cases needed).
2008-08-01 08:26:32 -07:00
Andreas Gal
4eba8e4012 Remove entryStackDepth. Calculate sp_adj relative to entryNativeStackSlots. 2008-08-01 02:33:54 -07:00
Andreas Gal
dd3ebd2cfe Make synthesizeFrame private. 2008-07-31 16:30:00 -07:00
shaver@mozilla.org
d200eb863e merge backout of d24e6005ee4c to fix the world 2008-07-31 06:36:53 -07:00
shaver@mozilla.org
f2c0c93637 Backed out changeset d24e6005ee4c (causing major array-fail). 2008-07-31 06:35:11 -07:00
Andreas Gal
e5a87ade9f Merge. 2008-07-31 01:35:56 -07:00
Andreas Gal
6f4cfc2628 Remove ANY_TYPE and move debug printf around to print entry point even if we can't enter due to type mismatch. 2008-07-31 01:35:18 -07:00
shaver@mozilla.org
a3bc7296d9 Make guard return expected, so we can trace alternate cases easily.
Better diagnostic for non-global scope chain head.
2008-07-30 22:59:13 -07:00
Brendan Eich
fe3a6127c5 - 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
Andreas Gal
40696cff65 Note to self: hacking after 4am is detrimental to my spelling. 2008-07-30 04:20:48 -07:00
Andreas Gal
f1a5494d05 Major shakeup of the interning code for globals. Globals are now detected on demand as they are used and the slots are noted in treeInfo->globalSlots. At the same time the type is recorded in treeInfo->globalTypeMap. The stack type-map is maintained separately in treeInfo->stackTypeMap. All these structures are lists and are maintained as List<T> objects. Imports for globals can appear at the top (if we have already seen some imports for the loop header and are recompiling), or on the fly for lazily found values. We no longer intern all global properties that happen to match a name in the current function, and we also support inlining of functions that touch globals that are not used in the method where the trace started in. 2008-07-30 04:17:22 -07:00
Andreas Gal
7290f281a0 Use List<T> to maintain global slot list in TreeInfo. 2008-07-30 01:38:21 -07:00
Andreas Gal
f60c785137 Add a generic list data structure and fix side exit handling to always pick the right typemap to work with (exit map, not entry map). 2008-07-29 23:48:39 -07:00
Andreas Gal
79fa051958 Removed unused field from TreeInfo. 2008-07-29 17:14:36 -07:00
Andreas Gal
4d5b44839c Rename gslots to globalSlots. 2008-07-29 15:28:23 -07:00
Andreas Gal
5a7ac301e6 Limit tree growth to side exits that expicitly declare that they want to be grown. 2008-07-29 11:13:41 -07:00
Brendan Eich
3e4d484622 Fix synthesizeFrame parameterization, and have it reconstruct stack depth; warning and space fixes. 2008-07-28 23:47:20 -07:00
shaver@mozilla.org
9c4c8495f9 not-yet-working beginnings of frame reconstruction 2008-07-28 09:05:55 -04:00
Andreas Gal
6126f5fa5c Track the type of guards and react accordingly if we bail out on them. Guards that protect against out-of-memory conditions don't try to grow the tree. Instead we just resume the interpreter. 2008-07-27 16:18:53 -07:00
Andreas Gal
a3eb60b77e Add limited outerlining. Much of this will be subsumed by nested trees. 2008-07-27 14:28:56 -07:00
Andreas Gal
ca563057ee Remove guardCount. No longer needed. 2008-07-27 12:05:01 -07:00
Andreas Gal
8a7bb9c550 Smarter speculative demotion of numbers to integers and promotion of the trace seems to require actual doubles. If the number at entry looks like an int we make the slot an int and compile as such. If the loop-tail proves the slot to be a double, we recompile the trace. Currently such miss-speculation cannot be handled on secondary traces since we are currently unable to recompile the primary trace. Such secondary traces are blacklisted. 2008-07-27 02:15:17 -07:00
Andreas Gal
812989bb8a Eliminate EntryRegs. Its not safe to keep a reference to the entry SP since we might extend the tree from a different outer stack frame. Instead just store the entryStackDepth. 2008-07-25 18:22:15 -07:00
Andreas Gal
1b7930d39d The VP engineering broke JSOP_NAME! We have to check whether the slot is actually interned and otherwise abort. 2008-07-25 16:51:42 -07:00
Andreas Gal
dee805421b Factor out AttemptToGrowTree. 2008-07-25 02:00:02 -07:00
Andreas Gal
f3573b9940 Move trace activation code into js_ExecuteTree(). 2008-07-25 01:20:40 -07:00
Andreas Gal
e838b138b8 Don't demote slots in overly long traces (based on counting the number of guards, current threshold=32). 2008-07-24 16:25:18 -07:00
Andreas Gal
6df91a21a0 Make the interpreter notify us when frames are popped so we see he right cx->fp value. Fix return value tracking for JSOP_STOP. 2008-07-24 10:35:10 -07:00
Andreas Gal
41e0593392 Maintain a separate frame for globals using InterpState->gp.
This will allow nested loops to access the globals interned by outer loops while at the same time sharing parts of the stack of the outer loop.
2008-07-23 23:18:02 -07:00
Andreas Gal
5dd9876515 Lazy fill the stackTracker as we lookup the nativeFrameOffset for values. Purge all entries related to the current frame when it is popped. This code could be further simplified if Tracker was a template. 2008-07-23 02:57:56 -07:00
Andreas Gal
c9cac5757f Handle leaving of frames in one central place. 2008-07-22 20:16:12 -07:00
Andreas Gal
06365155c2 Avoid calculating native frame offset by tracking the last load/store for every slot and extracting the offset from there. 2008-07-22 17:54:04 -07:00
Andreas Gal
48b195e651 Avoid nativeFrameOffset calls in import(). 2008-07-22 17:24:29 -07:00
Andreas Gal
410c0b9a98 Eliminate entryFrame pointer (not safe to carry that around.) 2008-07-21 16:20:53 -07:00
Andreas Gal
f1ef7f0175 Eliminate exit filter, write the type map directly in snapshot. 2008-07-21 15:09:19 -07:00
Andreas Gal
bce8e13528 Remove excess parameters of verifyTypeStability. 2008-07-21 13:21:00 -07:00
Andreas Gal
a0cd046167 Track call depth in the trace recorder. This lays the groundwork to get rid of entryFrame. 2008-07-21 13:18:08 -07:00
shaver@mozilla.org
124244af4b beginning of entryFrame removal 2008-07-21 15:57:02 -04:00
Andreas Gal
5067fc2638 Merge. 2008-07-21 12:44:03 -07:00
Andreas Gal
e9b2918575 Rename VMFragmentInfo to TreeInfo. 2008-07-21 12:41:43 -07:00
shaver@mozilla.org
7546f723f5 force Math to be interned, and defend against non-interned globals until upvar saves us all 2008-07-20 17:23:39 -04:00
shaver@mozilla.org
ed1d0a8953 improve tracing/recording diagnostics 2008-07-20 15:42:19 -04:00
shaver@mozilla.org
ef2e8305dc Avoid tracking object properties, make incElem work. 2008-07-19 10:24:10 -07:00
Brendan Eich
a26be1bd4b Fix incProp to box and store (incElem still todo). 2008-07-19 10:24:28 -07:00
Brendan Eich
d1b171e5e2 First stab at incops, plus unbox_jsval tag-masking guard fixes, plus misc. cleanup. 2008-07-19 00:15:22 -07:00
Andreas Gal
47ae25da20 Make entryFrame/entryRegs relative to the tree entry since we only adjust ip/sp/rp when exiting from the tree, not in between fragments. 2008-07-18 16:21:22 -07:00
Andreas Gal
89b50ed124 Rework some of David's changes. Make sure we don't modify the tree until we are ready to attach the new fragment. Share lirbufs between tree branches. 2008-07-18 14:11:01 -07:00
David Anderson
4770d4b3e0 Got side exits seemingly working, added if.js to trace-test.js 2008-07-18 10:33:17 -07:00
shaver@mozilla.org
7078a99d21 When PROPERTY_CACHE_TEST misses, fall back to doing our own lookup via js_GetPropertyHelper. 2008-07-17 23:57:56 -07:00
Andreas Gal
dded69f2a3 Merge. 2008-07-17 17:13:41 -07:00
Andreas Gal
19ed222624 Disable trees for the time being. 2008-07-17 17:12:28 -07:00
shaver@mozilla.org
3db81baa04 Label globals and locals with their source-names in trace.
Show line number on abort.
2008-07-17 15:09:48 -07:00
Andreas Gal
954c5830e1 Added statistics and a js_DestroyJIT hook. Also use debug_only and not verbose_only as #ifdef DEBUG shortcut. 2008-07-17 10:22:40 -07:00
shaver
87eacb1139 Add setprop and tests for setprop and cleanup labling code for debug mode (m=gal). 2008-07-17 02:00:23 -07:00
Andreas Gal
9d6fa41738 Cleanup trace abort handling. 2008-07-17 01:29:41 -07:00
Andreas Gal
b243a8350a Better naming of the after_JSOP_CALL event (EnterFrame). 2008-07-16 23:00:59 -07:00
Andreas Gal
2442099090 Notify the recorder when a new frame was created by JSOP_CALL. 2008-07-16 22:58:06 -07:00
Andreas Gal
df5005a322 Hand in typemap the recorder is supposed to use (preparation for side exit compilation and trees). 2008-07-16 21:49:42 -07:00
Andreas Gal
def4afc614 Move the allocation of the LIR buffer and the FragmentInfo data structure creation (which includes typemap and interned global calculation) into loopedge. 2008-07-16 21:41:03 -07:00
Andreas Gal
db7e41ed40 Add generic recorder hooks that are called before and after all opcodes as we trace. We might want to instead just move to pre_OP and post_OP. 2008-07-16 17:29:08 -07:00
Andreas Gal
43b7ba1be4 Don't use a builtin for this. For functions its interned in the native frame. For global this we read from fp->thisp. Restore jsinterp.cpp and jsinterp.h (no longer need COMPUTE_THIS exposed). 2008-07-16 14:36:50 -07:00
shaver@mozilla.org
3a4c348313 Trace JSOP_THIS and JSOP_THISPROP.
Rename getprop to get_prop, just because.
Extract COMPUTE_THIS to jsinterp.h as JS_COMPUTE_THIS for reuse in tracer.
2008-07-15 21:37:00 -04:00
Andreas Gal
3aeb53f580 Add a few consts to char* pointers to pacify gcc 4.2. 2008-07-15 16:04:08 -07:00
shaver@mozilla.org
3693365174 rename getpropfromval, it burns mine eyes 2008-07-15 18:29:42 -04:00
Andreas Gal
1b783425aa Assign blame where blame is due. 2008-07-15 15:05:16 -07:00
Brendan Eich
3ccdb62685 Propagate error exceptions from TraceRecorder ctor; fiddle/trim space. 2008-07-15 10:26:15 -07:00
shaver@mozilla.org
7d7ece76a8 GETVARPROP, GETARGPROP, GETXPROP 2008-07-15 13:17:51 -04:00
Andreas Gal
5848fd6694 Generate a list of interned global slots (gslots) when we process the tree header. This list is then used whenever we iterate over the native frame. This is faster and safer than looking up properties in the global object every time. 2008-07-15 01:53:39 -07:00
Andreas Gal
84608819b9 Remove state exposing accessor functions from recorder and instead hand in that state via the constructor into ExitFilter. 2008-07-15 01:27:14 -07:00
Andreas Gal
1693476391 Guard in FragmentInfo on the shape of the global object. Don't check for the shape of the global object on the trace. 2008-07-15 01:08:13 -07:00
Andreas Gal
bac6ed12f4 Store list of interned global slots in struct FragmentInfo 2008-07-15 01:03:49 -07:00
Andreas Gal
9f761173f0 Added a callstack that will track the pc of the call that caused a function call to be inlined. This is necessary to recover from deep side exits inside inline functions. The callstack is subject to store elimination, so unnecessary stores to the stack will go dead automatically during compilation (i.e. if we inline a function that doesn't have side exits.) 2008-07-14 19:12:50 -07:00
Andreas Gal
e59427d0f7 Use JS_GetGlobalForObject to get the global object. Walking back the call chain is not equivalent and not safe. 2008-07-14 16:40:38 -07:00
Andreas Gal
30c7f0493e Reserve space for every global property that the current script has an atom for instead of trying to rely on ngvars. 2008-07-13 21:14:34 -07:00
shaver@mozilla.org
8ffe777b5a Incomplete stab at CALLPROP, added ABORT_TRACE for better diagnostics, make math_sin non-static in preparation for specializing call. 2008-07-11 20:59:10 -04:00
Brendan Eich
a17263a036 1. Fix !JS_THREADED_INTERP bugs in BRANCH and recording switch case generation.
2. Rename TraceRecorder op methods to record_JSOP_xxx to avoid shadowing JSOP_*
   enumerators used inside jsopcode.h macros -- death to ::JSOP_*!
3. Added atoms TraceRecorder member for giant literal pool scripts.
4. Condition assert in TraceRecorder::test_property_cache_direct_slot to avoid
   false positive when executing function code accessing a global.
2008-07-10 21:55:09 -07:00
Andreas Gal
4e34cfc559 IFEQ and IFNE are identical for us. We just expect the same boolean on the stack and side exit if not. 2008-07-10 20:35:19 -07:00
Andreas Gal
ca4e6419ee shaver's favorite operating system of choice doesn't like templates, so de-template tracker since we use it with LInsp only anyway. 2008-07-10 18:42:04 -07:00
shaver@mozilla.org
6a5deaf550 Decouple jscntxt.h from jstracer.h so that xpconnect doesn't try to include all of
nanojit.
2008-07-10 17:29:16 -04:00
shaver@mozilla.org
2a0f9b6245 can't have zero-sized arrays in ISO C++, says gcc 2008-07-10 09:29:42 -04:00
Brendan Eich
20a5a9ef31 1. Fix inc to address the right result stack slot; 2. Require via assertions that the interpreter memoize implicit gvars (patch to do that next; bitwise-and will assert until that lands). 2008-07-09 15:15:32 -07:00
Brendan Eich
d8cf234b33 Memoize global name gets and sets as if they refer to a declared gvar. 2008-07-09 11:42:31 -07:00
Andreas Gal
05554d05b3 Stricter typing of the tracker code path which now only accepts jsval as suggested by Brendan. 2008-07-09 00:29:23 -07:00
Andreas Gal
d6b834b98a Move builtin[] table in jsbuiltin.cpp 2008-07-08 23:48:06 -07:00
David Anderson
fcf8410125 Builds against latest nanojit; merged VMSideExitInfo into SideExit 2008-07-08 17:16:51 -07:00
Andreas Gal
4550dd77f0 Introduce a generic stack frame walking macro. This eliminates the 6 (hg pull) redundant blocks of code that all walked the stack in 6 different ways, each with their individuals quirks. 2008-07-08 16:29:23 -07:00
Andreas Gal
56397d3c0e Attempt at cleaning up the typemap/stack frame iteration code. 2008-07-07 18:35:38 -07:00
Andreas Gal
0fe5682c00 Make gvar ops use the global varobj values we unbox onto the native stack. The stack offset handling needs more work. 2008-07-07 17:21:54 -07:00
Andreas Gal
1d36b97516 Unbox global variables onto the native stack and re-box them. This has certain synchronization implications but will make top-level scripts quite a bit faster. 2008-07-07 15:15:56 -07:00
Brendan Eich
175ce14f5b Indentation and comment wrapping (at 79, 99 looks too long and most comments still avoid going past 80+/-). 2008-07-07 02:55:03 -07:00
Brendan Eich
6d65efee60 Use jsopcode.tbl for tracer JSOP_* method decls; trim trailing whitespace. 2008-07-07 02:21:04 -07:00
Andreas Gal
a38e8a96c3 Add support to demote stores of constants that are currently represented as float but are really integers. bitwise.js is now compiled complete fp-casts free. 2008-07-07 01:05:53 -07:00
Andreas Gal
efa3309778 Demote floating point comparisons even if one side is constant (bug in nanojit, filed as #443884 against tamarin). Also demote add/sub/mul using the integer overflow detection side exit code that Ed adopted upstream. Tight loops (bitwise) are not emitted completely as integer code after the initial compilation using doubles triggered a speculative demotion of the context slots. 2008-07-07 00:43:40 -07:00
Andreas Gal
8ce0de1ad7 Sink type conversions into the side exit by updating the map and seeing though the cast in the store (in ExitFilter). Add a whole bunch of asserts on the varios speculative type states to make sure we get the state machine right. Import speculated integer values as integers into the trace (indicate in entry map). 2008-07-07 00:10:22 -07:00
Andreas Gal
34c2283213 Added loop-tail driven context slot type demotion. Without all the buzzwords, what this essentially means is that we detect if the last value that the trace leaves in a slot (which is the value that flows along the backedge back to the loop header) is known to originate from an integer value via i2f, we flag the slot as type integer and recompile the trace. We do this where type stability is certain (result of an and, i.e.) or where its very likely (++operator). If the speculation fails, the same analysis flags the slot as blocked, which means it will always be double. The hope is that this analysis converges quickly (1-2 recompilations tops). 2008-07-06 22:35:19 -07:00
Andreas Gal
efee2381b5 Make typemap uint8_t and fix order of arguments in call to BoxDouble. 2008-07-06 20:25:49 -07:00
Andreas Gal
aeeff83beb Move the type level from int/double to number. All traces start out as double in all slots, and denote and promote to/from int as needed. The FuncFilter optimizes on-trace casting and elininates redundant f->i-> chains. More optimization needed on this of course, and this code is now a bit slower than the previous integer-register use. However, this does solve the q += 2.5 issues. The heap access code does not properly cast yet and is likely unstable. 2008-07-06 15:55:04 -07:00
shaver@mozilla.org
b28afaa80d Trace GETGVAR and INCGVAR, though not yet correctly. 2008-07-06 16:59:59 -04:00
Andreas Gal
d30b7d1c8a Add unary and binary helpers that automatically demote and promote when dealing with integer operations (not used yet, need loop typemap peeling in place first.) 2008-07-06 13:16:34 -07:00
Andreas Gal
5816dee707 Fix template, should use typename, not class. 2008-07-06 12:03:51 -07:00
Andreas Gal
1343901446 Add ExitFilter, which builds side exit typemaps for us. This had to be moved into a filter, because this has to happen after we eliminate redundant i2f-f2i chains as we can sink those into the side exit by simply storing the unpromoted/undemoted value and just flip the type in the exit map. 2008-07-06 11:48:41 -07:00
Andreas Gal
84ec537a0c Merge. 2008-07-06 11:19:06 -07:00
Andreas Gal
9501bcd749 Added doubleToUint32 builtin and make tracker a template. 2008-07-06 10:59:55 -07:00
shaver@mozilla.org
d881a494aa fix builtin_UnboxInt32 signature and name shape_ins for debugging 2008-07-06 13:58:59 -04:00
shaver@mozilla.org
45b3826103 Trace JSOP_NAME, and refactor out jsval unboxing. 2008-07-06 13:38:55 -04:00
shaver@mozilla.org
06a27ca367 begin on JSOP_NAME, refactor stobj_get_slot to chain better 2008-07-06 12:15:55 -04:00
Andreas Gal
100f4ea5e0 Added support for semi-stable loop variables. Compiling for(...) q += 2.5; is ridiculously difficult because it flip-flops between int and double. Add support to promote integer values to doubles at the loop tail if at loop entry we expect a double. Since this isn't possible the other way around, we have to get luck that we catch a path into the loop where q is already double. For this we add 3 trigger points (10, 13, 37). We will try three times to record a trace at those iteration counts of a loop. If none succeed the loop is blacklisted. This probably needs more tuning down the road. 2008-07-05 23:21:53 -07:00
Andreas Gal
41efb6c488 Merge and rename jsIf to ifop. 2008-07-05 22:23:34 -07:00
Andreas Gal
0b28897ad3 Add helpers for i->f and f->i conversion. The f->i path goes via builtin calls. 2008-07-05 22:04:58 -07:00
shaver@mozilla.org
a268883f3c Implement JSOP_IFEQ, JSOP_IFNE, JSOP_DUP, JSOP_DUP2. 2008-07-05 23:47:24 -04:00
Andreas Gal
075e3f00a6 Add casting for objects and cleanup casting code. 2008-07-05 20:30:11 -07:00
Andreas Gal
0245a6ba7c Believe it or not NEG can actually overflow the int32 range, so add an overflow bailout. This will only trap for -0x80000000. 2008-07-05 19:25:38 -07:00
Andreas Gal
48e459ba73 Added blacklisting of recording points where we failed to complete a trace (overly aggressive at this point, needs tuning, we want to try several times for each point.) 2008-07-05 19:15:00 -07:00
Andreas Gal
cf8e2a555b Added boolean boxing/unboxing code. 2008-07-05 18:34:41 -07:00
Andreas Gal
888d2f9aee Add support for some misc opcodes including binary and arithmetic and/or/not. 2008-07-05 17:26:00 -07:00
Andreas Gal
19152ffb1f Signal error from the boxing/unboxing using magic cookies since gcc seems to very seriously object to the use of uint64 return values during a fastcall (horribly inefficient code). 2008-07-05 16:28:03 -07:00
Andreas Gal
d765c3ead2 Finish SETELEM for int and double values. 2008-07-05 14:00:32 -07:00
Andreas Gal
1e9c9451e0 Merge unboxing code into GETELEM code. 2008-07-05 13:44:48 -07:00
Andreas Gal
503bf13dac Merge. 2008-07-05 11:46:08 -07:00
Andreas Gal
f9981c8870 Added box_int_jsval for the store path. Use only there. 2008-07-05 11:45:53 -07:00
Andreas Gal
ba7e66df92 Code generators to access object slots and native code callouts (builtins) for boxing doubles and ints. Ints have to be boxed through a native code helper on read and write (BoxInt32 and UnboxInt32), because we sometimes have to cast internally to double to store 32-bit values. We don't want a separate trace in this case, so we have to do this inline in a helper. Also a couple of modifications to shaver's code. Always make sure to check types (JSOP_NEG). 2008-07-05 11:35:55 -07:00
Brendan Eich
ab0e34e2ae Try to keep 64-bit portability via size_t instead of unsigned, jsuword for uintptr instead of long, etc. 2008-07-05 11:18:26 -07:00
shaver@mozilla.org
de59f88d9c Beginning of SETELEM/GETELEM tracing for dense arrays. Needs computed-offset
insLoad before they'll work.
2008-07-05 09:47:59 -04:00
Andreas Gal
2df2214a9e Introduce asInt and asDouble to check for the type of values based on the actual value since some 32-bit integers hide out in doubles. 2008-07-04 23:53:29 -07:00
Andreas Gal
e35d351b28 Added support for SET_VAR again. bitwise.js working now. 2008-07-04 15:21:56 -07:00
Andreas Gal
ab1dc289ba Fixed some stack handling and trace activation issues. We can run trace.js again. 2008-07-04 15:07:05 -07:00
Andreas Gal
5e9ca6ef0e Cleanup of stack handling. 2008-07-04 13:23:42 -07:00
Andreas Gal
9b8f5f75a8 Added back support for the instructions required to compile trace.js. 2008-07-04 03:06:18 -07:00
Andreas Gal
1503932551 Properly switch tracer on and off depending on loopEdge and abort signaling from trace recorder recording functions. 2008-07-04 01:10:57 -07:00
Andreas Gal
efb72df02a Re-integrate trace recording and trace activation infrastructure. Model more closely after Tamarin. 2008-07-04 00:51:30 -07:00
Andreas Gal
731614bfe9 Create a stub for each opcode in TraceRecorder and invoke them from the stubs that are pointed to by the recorder dispatch-table. 2008-07-03 23:57:57 -07:00
Andreas Gal
62d0c7bbfb Switch back to mozilla-central jsinter.cpp. Lets try a different approach to attach the tracer to the interpreter. 2008-07-03 22:08:13 -07:00
Andreas Gal
9a1bbdcdc6 Fix unnecessary type prefix (reported by bc, doesn't pass gcc 4.2.3) 2008-07-03 17:02:19 -07:00
Andreas Gal
2cd7b6993b VOIDs hang out in the BOOLEAN value space, so we have to treat them like a boolean on the trace. For ValuetoECMAInt32 all special boolean values except TRUE produce 0, and TRUE produces 1. Use a conditional move to implement this. 2008-07-02 19:11:07 -07:00
Andreas Gal
b137f2da3b Introduce a VMSideExitInfo structure (holds the exit typemap only for now). 2008-07-02 18:06:24 -07:00
Andreas Gal
523ba92b3d Use fragmento to track fragments and add proper trace activiation code. 2008-07-02 17:19:07 -07:00
Andreas Gal
6f3af33edf Add type stability check for loop variables. Rename readstack to import. 2008-07-02 15:14:43 -07:00
Andreas Gal
e70272bfab Removed attempt to imply ints into doubles on the fly. This can't work. Use proper float loads where needed and add some initial code for builtin functions. 2008-07-02 14:38:12 -07:00
Andreas Gal
f3fba20c9c Create type maps during trace entry and in each side exit and store them in the LIR using LIR_skip. Use these type maps during trace entry and exit. 2008-07-01 19:43:10 -07:00
Andreas Gal
39891951f4 Merge. 2008-07-01 13:36:33 -07:00
shaver@mozilla.org
50d599cb99 label arg/var/stack/sp/state for easier trace-reading 2008-07-01 08:06:02 -04:00
Andreas Gal
d3e7a57a68 Fix deallocation bug in the recorder. We will have to lift more code Tamarin's Interpreter to stabilize the recording. 2008-07-01 02:37:07 -07:00
Andreas Gal
84274f1b33 Save the VM registers into markRegs at opcode entry and restore that state when ending or aborting recording. The same info is pushed into sideexit and used by guards. With this change we can eliminate the hack in MONITOR_BRANCH that had to adjust the stack pointer depending on the opcode type, and it also allows us to trace through the recently added boolean guard opcode fusing. This improves trace code quality, since only the pre-conditional check state is saved. The guard restores into that state, so the trace code doesn't have to emit the value of the conditional evaluation onto the stack, saving a handful ops. 2008-06-30 18:31:29 -07:00
Andreas Gal
87396e1870 Rework memory management, don't leak memory in the filter pipeline. 2008-06-30 18:08:32 -07:00
Andreas Gal
19b4bcdc69 Save the side exit state at entry in to the opcode (since we want to restart ops) and enable store filter. 2008-06-30 17:12:52 -07:00
Andreas Gal
5d1d997c9d Housekeeping (add comments, removed some dead code.) 2008-06-30 09:36:10 -07:00
Andreas Gal
d8d25140f9 Mockup of trace execution. Speedup is 10x for a tight loop. Keep in mind that this is a hack and the trace code is not optimized yet. 2008-06-29 23:02:22 -07:00
Andreas Gal
b1e24b8c98 Execute trace code. Boxing back the side exit state is not handled yet. 2008-06-29 20:56:06 -07:00
Andreas Gal
e267cb120c Fix native frame addressing (reported by vlad.) 2008-06-29 17:17:39 -07:00
Andreas Gal
253b2572b2 Initialize jump table when side-entering the interpreter. Keep track of cx and sp directly in the recorder instead of going through the tracker. 2008-06-29 13:53:40 -07:00
Andreas Gal
ef71223de2 Remember JSContext instead of trying to keep track of frame pointer. 2008-06-28 18:47:12 -07:00
Andreas Gal
628a1f6985 Cleanup trace abort/end code. 2008-06-28 18:19:21 -07:00
Andreas Gal
ba35b66f90 Make internal form of nativeFrameSize private. 2008-06-28 17:22:08 -07:00
Andreas Gal
6df975a5b5 Rewritten frame management. Use cx->fp->regs chain instead of direct passing of those structures. 2008-06-28 17:14:06 -07:00
Andreas Gal
552425ee07 Hook up pc and sp to the tracer in order to generate proper PC/SP adjustment code. 2008-06-28 11:00:18 -07:00
Andreas Gal
1f37ae3e62 Small cleanups and licensing blurb housekeeping. 2008-06-28 09:58:15 -07:00
shaver@mozilla.org
4fc71515e0 Add guards for XML objects, and some tracer bits to accommodate them. 2008-06-27 23:58:06 -04:00
Andreas Gal
e5d4f398ef Merge. 2008-06-27 18:09:33 -07:00
Andreas Gal
40f1a90a78 Move recorder initialization into TraceRecorder and encapsulate its state. 2008-06-27 18:06:50 -07:00
Andreas Gal
2c370239e5 Add a way to calculate the current size of the native frame. 2008-06-27 16:24:17 -07:00
shaver@mozilla.org
06500a1a50 merge 2008-06-27 12:01:28 -04:00
shaver@mozilla.org
af19dd5627 rename ENABLE_TRACER to TRACING_ENABLED and explicitly parameterize on cx 2008-06-27 11:41:59 -04:00
Andreas Gal
afd5f3b1e3 Clarified argument names in guard code and explain better why we guard for overflow the way we do. 2008-06-27 07:28:10 -07:00
Andreas Gal
e59076860a Instead of guarding on null -> boolean conversion just emit a null compare and use the boolean result. 2008-06-27 06:53:10 -07:00
Andreas Gal
0c5757a21f Add a new option -j to enable the JIT. The default is off so we can easily benchmark the overhead without the tracer. 2008-06-27 00:22:53 -08:00
Andreas Gal
a21ca6a788 Prepare LIR_ov to be used as soon Ed adds it and add a few comments that explain how overflow is handled. 2008-06-26 23:34:50 -08:00
Andreas Gal
49fe7a95eb More cleanup and code move into TraceRecorder and prepare for LIR_ov. 2008-06-26 23:22:16 -08:00
Andreas Gal
f357ff14f0 Move the recorder functionality into TraceRecorder to unclutter trace inlines. 2008-06-26 21:58:57 -08:00
Andreas Gal
0c98250a90 Move set/get into recorder and introduce init. 2008-06-26 21:41:10 -08:00
Andreas Gal
431b7b810a Moved loading context slots into the recorder (more to follow). 2008-06-26 21:33:33 -08:00
Andreas Gal
693ee7f0cc Turn macros into inline functions and start prepatations for inlining function calls. 2008-06-26 21:19:11 -08:00
Andreas Gal
c7bab6721b Drop JS prefix from classes related to traceing. 2008-06-26 19:49:04 -08:00
Andreas Gal
ad5ceed9cd Merge. 2008-06-26 19:46:51 -08:00
Andreas Gal
a1b42735cd Backed out changeset fa82b7eda72a 2008-06-26 19:44:23 -08:00
Andreas Gal
5b4f0aaeaa Allocate recorder dynamically to avoid having a vtable in the struct holding the reference. Emit writebacks for every update to the tracker, not just stack writes. 2008-06-26 19:37:28 -08:00
Andreas Gal
407b9cdf75 Parameterize tracker. 2008-06-26 17:13:54 -08:00
Andreas Gal
6d192a7054 Added end-of-trace detection and make sure trace loops back to the loop header. 2008-06-22 09:30:04 -07:00
Andreas Gal
78da0668af Start attaching our tracer to nanojit. This is incomplete and meant for review by David only. 2008-06-21 14:55:32 -07:00
Andreas Gal
33ecda6e85 Added danderson's test cases for nanojit. Execute with nanojit() from JS shell. 2008-06-19 18:28:15 -07:00
Andreas Gal
179be35727 Notify the recorder of all primitives as they are recorded. If the recorder doesn't support a primitive we abort the trace. In debugging mode this also stops the VM. 2008-06-11 20:22:00 -07:00
Andreas Gal
448d1ba7e3 Merge with be's last push. 2008-06-11 18:13:43 -07:00
Andreas Gal
bb1b206714 Use an error property in the recorder instead of a return value to indicate errors and make sure DO_OP aborts the trace once we go into the error state in the tracer. 2008-06-11 17:59:28 -07:00
Brendan Eich
a64ed1a5ee native_pointer_to_jsval should not lose low-order bits (plus random style nits). 2008-06-11 17:21:15 -07:00
Andreas Gal
54dd5103e9 Track data flow through variables in the recorder. Set an error flag if the recorder signals an error. 2008-06-11 17:15:49 -07:00
Brendan Eich
74c80d5597 Kill trailing spaces. 2008-06-11 13:07:24 -07:00
Andreas Gal
b484f790e4 Start hooking the recorder into the tracer. 2008-06-11 12:12:29 -07:00
Andreas Gal
fef28e9f56 Allow recorder to abort recording. 2008-06-11 11:29:35 -07:00
Andreas Gal
17d0d41459 Added branch monitoring using a single unified branch frequency counter. 2008-06-10 16:49:05 -07:00
Andreas Gal
a1bf0819b2 Removed JSOP_HEADER code. Its too costly. This patch restore essentially the same performance as unmodified SM. 2008-06-10 14:44:51 -07:00
Brendan Eich
04b1ac5592 Merge. 2008-06-04 00:09:57 -07:00
Brendan Eich
894dd03e2a First stage of loop table work; bitmap free space management and GC hook-up still to come. 2008-06-03 23:52:28 -07:00
Andreas Gal
9684e2070f Introduced a JavaScript recording script that is loaded dynamically. 2008-06-03 21:01:23 -07:00
Andreas Gal
be39054e45 Store the recorder script in JSTraceMonitor and make sure its traced by the GC. Also clean up the tracing of JSTraceMonitor. 2008-06-03 17:35:30 -07:00
Andreas Gal
8b6c4d02c6 Remove InitTacer. Pointless for JSRuntime. 2008-06-03 17:04:42 -07:00
Brendan Eich
9c2b039d6f JSOP_HEADER takes a byte index of loop header counting from script->loopBase, and related changes. 2008-06-03 14:48:47 -07:00
Brendan Eich
946fa41d8c Fiddle loop table slot interface and impl in hope of freeing slots over time. 2008-06-02 18:06:33 -07:00
Brendan Eich
3db9424289 Merge and undo js_AllocateLoopTableSlot reparam. 2008-06-02 17:28:39 -07:00
Brendan Eich
01514c4b16 No JS_TRACER ifdefs, keep line len < 80, reparameterize jstracer.cpp functions, js_OpLength helper. 2008-06-02 17:19:41 -07:00
Brendan Eich
5b116ae998 Merge, style nits, no locking for tracing. 2008-05-31 15:29:54 -07:00
Andreas Gal
e461a72736 The table is now per-thread in a multi-threaded environment, and per-runtime otherwise. During code generation we merely allocate a loop table slot to each loop. Each thread will enlarge the table as needed in JSOP_HEADER. 2008-05-30 18:58:43 -07:00