2008-05-30 18:58:43 -07:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2008-06-03 14:48:47 -07:00
|
|
|
* vim: set ts=8 sw=4 et tw=79 ft=cpp:
|
2008-05-30 18:58:43 -07:00
|
|
|
*
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
|
|
|
|
* May 28, 2008.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
2008-06-28 09:58:15 -07:00
|
|
|
* Brendan Eich <brendan@mozilla.org>
|
2008-05-30 18:58:43 -07:00
|
|
|
*
|
|
|
|
* Contributor(s):
|
2008-06-28 09:58:15 -07:00
|
|
|
* Andreas Gal <gal@mozilla.com>
|
2008-05-30 18:58:43 -07:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2008-05-31 15:29:54 -07:00
|
|
|
#ifndef jstracer_h___
|
|
|
|
#define jstracer_h___
|
2008-05-30 18:58:43 -07:00
|
|
|
|
|
|
|
#include "jsstddef.h"
|
|
|
|
#include "jslock.h"
|
2008-07-02 14:38:12 -07:00
|
|
|
#include "jsnum.h"
|
2008-07-03 22:08:13 -07:00
|
|
|
#include "jsinterp.h"
|
2008-05-30 18:58:43 -07:00
|
|
|
|
2008-06-26 22:58:57 -07:00
|
|
|
#include "nanojit/nanojit.h"
|
2008-06-21 14:55:32 -07:00
|
|
|
|
2008-07-05 16:28:03 -07:00
|
|
|
/*
|
|
|
|
* We use a magic boxed pointer value to represent error conditions that
|
|
|
|
* trigger a side exit. The address is so low that it should never be
|
|
|
|
* actually in use. If it is, a performance regression occurs, not an
|
|
|
|
* actual runtime error.
|
|
|
|
*/
|
|
|
|
#define JSVAL_ERROR_COOKIE OBJECT_TO_JSVAL((void*)0x10)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We also need a magic unboxed 32-bit integer that signals an error.
|
|
|
|
* Again if this number is hit we experience a performance regression,
|
|
|
|
* not a runtime error.
|
|
|
|
*/
|
|
|
|
#define INT32_ERROR_COOKIE 0xffffabcd
|
|
|
|
|
2008-06-21 14:55:32 -07:00
|
|
|
/*
|
|
|
|
* Tracker is used to keep track of values being manipulated by the
|
|
|
|
* interpreter during trace recording.
|
|
|
|
*/
|
|
|
|
class Tracker
|
|
|
|
{
|
|
|
|
struct Page {
|
2008-07-05 11:18:26 -07:00
|
|
|
struct Page* next;
|
|
|
|
jsuword base;
|
|
|
|
nanojit::LIns* map[0];
|
2008-06-21 14:55:32 -07:00
|
|
|
};
|
|
|
|
struct Page* pagelist;
|
|
|
|
|
2008-07-05 11:18:26 -07:00
|
|
|
jsuword getPageBase(const void* v) const;
|
2008-06-26 20:46:51 -07:00
|
|
|
struct Page* findPage(const void* v) const;
|
|
|
|
struct Page* addPage(const void* v);
|
2008-06-21 14:55:32 -07:00
|
|
|
public:
|
|
|
|
Tracker();
|
|
|
|
~Tracker();
|
|
|
|
|
2008-06-26 20:44:23 -07:00
|
|
|
nanojit::LIns* get(const void* v) const;
|
|
|
|
void set(const void* v, nanojit::LIns* ins);
|
|
|
|
void clear();
|
2008-06-21 14:55:32 -07:00
|
|
|
};
|
|
|
|
|
2008-07-04 13:23:42 -07:00
|
|
|
struct VMFragmentInfo {
|
|
|
|
unsigned maxNativeFrameSlots;
|
2008-07-05 11:18:26 -07:00
|
|
|
size_t nativeStackBase;
|
2008-07-04 13:23:42 -07:00
|
|
|
char typeMap[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VMSideExitInfo {
|
|
|
|
char typeMap[0];
|
|
|
|
};
|
|
|
|
|
2008-06-26 20:49:04 -07:00
|
|
|
class TraceRecorder {
|
2008-06-28 18:47:12 -07:00
|
|
|
JSContext* cx;
|
2008-06-26 22:41:10 -07:00
|
|
|
Tracker tracker;
|
2008-07-02 14:38:12 -07:00
|
|
|
char* entryTypeMap;
|
|
|
|
unsigned entryNativeFrameSlots;
|
2008-07-02 17:19:07 -07:00
|
|
|
unsigned maxNativeFrameSlots;
|
2008-06-28 17:14:06 -07:00
|
|
|
struct JSStackFrame* entryFrame;
|
|
|
|
struct JSFrameRegs entryRegs;
|
2008-06-26 20:37:28 -07:00
|
|
|
nanojit::Fragment* fragment;
|
2008-07-04 13:23:42 -07:00
|
|
|
VMFragmentInfo* fragmentInfo;
|
2008-06-27 18:06:50 -07:00
|
|
|
nanojit::LirBuffer* lirbuf;
|
2008-06-26 20:37:28 -07:00
|
|
|
nanojit::LirWriter* lir;
|
2008-07-01 19:43:10 -07:00
|
|
|
nanojit::LirBufWriter* lir_buf_writer;
|
2008-06-30 18:08:32 -07:00
|
|
|
nanojit::LirWriter* verbose_filter;
|
|
|
|
nanojit::LirWriter* cse_filter;
|
|
|
|
nanojit::LirWriter* expr_filter;
|
2008-07-02 14:38:12 -07:00
|
|
|
nanojit::LIns* cx_ins;
|
2008-06-30 17:12:52 -07:00
|
|
|
nanojit::SideExit exit;
|
2008-07-03 23:57:57 -07:00
|
|
|
|
2008-07-01 19:43:10 -07:00
|
|
|
JSStackFrame* findFrame(void* p) const;
|
2008-07-03 17:02:19 -07:00
|
|
|
bool onFrame(void* p) const;
|
2008-07-01 19:43:10 -07:00
|
|
|
unsigned nativeFrameSlots(JSStackFrame* fp, JSFrameRegs& regs) const;
|
2008-07-05 11:18:26 -07:00
|
|
|
size_t nativeFrameOffset(void* p) const;
|
2008-07-02 15:14:43 -07:00
|
|
|
void import(jsval*, char *prefix = NULL, int index = 0);
|
2008-07-02 17:19:07 -07:00
|
|
|
void trackNativeFrameUse(unsigned slots);
|
2008-07-01 19:43:10 -07:00
|
|
|
|
2008-07-03 23:57:57 -07:00
|
|
|
nanojit::SideExit* snapshot();
|
2008-07-01 02:37:07 -07:00
|
|
|
|
2008-06-28 17:14:06 -07:00
|
|
|
unsigned calldepth() const;
|
2008-06-30 17:12:52 -07:00
|
|
|
|
2008-06-26 22:41:10 -07:00
|
|
|
void set(void* p, nanojit::LIns* l);
|
|
|
|
nanojit::LIns* get(void* p);
|
|
|
|
|
2008-07-04 13:23:42 -07:00
|
|
|
void guard(bool expected, nanojit::LIns* cond);
|
2008-07-02 19:11:07 -07:00
|
|
|
|
2008-07-04 03:06:18 -07:00
|
|
|
void closeLoop(nanojit::Fragmento* fragmento);
|
2008-06-26 22:58:57 -07:00
|
|
|
|
2008-07-04 03:06:18 -07:00
|
|
|
jsval& argval(unsigned n) const;
|
|
|
|
jsval& varval(unsigned n) const;
|
|
|
|
jsval& stackval(int n) const;
|
2008-06-27 18:06:50 -07:00
|
|
|
|
2008-07-04 03:06:18 -07:00
|
|
|
nanojit::LIns* arg(unsigned n);
|
2008-07-04 15:21:56 -07:00
|
|
|
void arg(unsigned n, nanojit::LIns* i);
|
2008-07-04 03:06:18 -07:00
|
|
|
nanojit::LIns* var(unsigned n);
|
2008-07-04 15:21:56 -07:00
|
|
|
void var(unsigned n, nanojit::LIns* i);
|
2008-07-04 03:06:18 -07:00
|
|
|
nanojit::LIns* stack(int n);
|
|
|
|
void stack(int n, nanojit::LIns* i);
|
|
|
|
|
|
|
|
bool inc(jsval& v, jsint incr, bool pre);
|
|
|
|
bool cmp(nanojit::LOpcode op, bool negate = false);
|
2008-07-04 15:21:56 -07:00
|
|
|
bool ibinary(nanojit::LOpcode op, bool ov = false);
|
2008-07-05 11:45:53 -07:00
|
|
|
bool iunary(nanojit::LOpcode op);
|
2008-07-04 23:53:29 -07:00
|
|
|
|
|
|
|
bool map_is_native(JSObjectMap* map, nanojit::LIns* map_ins);
|
2008-07-05 13:44:48 -07:00
|
|
|
void stobj_set_slot(nanojit::LIns* obj_ins, unsigned slot,
|
|
|
|
nanojit::LIns*& dslots_ins, nanojit::LIns* v_ins);
|
|
|
|
void stobj_get_slot(nanojit::LIns* obj_ins, unsigned slot,
|
|
|
|
nanojit::LIns*& dslots_ins, nanojit::LIns*& v_ins);
|
|
|
|
bool native_set(nanojit::LIns* obj_ins, JSScopeProperty* sprop,
|
|
|
|
nanojit::LIns*& dslots_ins, nanojit::LIns* v_ins);
|
|
|
|
bool native_get(nanojit::LIns* obj_ins, nanojit::LIns* pobj_ins, JSScopeProperty* sprop,
|
|
|
|
nanojit::LIns*& dslots_ins, nanojit::LIns*& v_ins);
|
|
|
|
bool box_into_jsval(jsval& v, nanojit::LIns* cx_ins, nanojit::LIns* in_ins,
|
|
|
|
nanojit::LIns*& out_ins);
|
2008-07-05 14:00:32 -07:00
|
|
|
nanojit::LIns* int32_to_jsval(nanojit::LIns* i_ins);
|
|
|
|
nanojit::LIns* double_to_jsval(nanojit::LIns* d_ins);
|
|
|
|
nanojit::LIns* jsval_to_int32(nanojit::LIns* v_ins);
|
2008-07-05 13:44:48 -07:00
|
|
|
nanojit::LIns* jsval_to_double(nanojit::LIns* v_ins);
|
|
|
|
nanojit::LIns* jsval_to_object(nanojit::LIns* v_ins);
|
|
|
|
|
|
|
|
bool guardThatObjectIsDenseArray(JSObject* obj,
|
|
|
|
nanojit::LIns* obj_ins, nanojit::LIns*& dslots_ins);
|
|
|
|
bool guardDenseArrayIndexWithinBounds(JSObject* obj, jsint idx,
|
|
|
|
nanojit::LIns* obj_ins, nanojit::LIns*& dslots_ins, nanojit::LIns* idx_ins);
|
2008-07-03 23:57:57 -07:00
|
|
|
public:
|
|
|
|
TraceRecorder(JSContext* cx, nanojit::Fragmento*, nanojit::Fragment*);
|
|
|
|
~TraceRecorder();
|
|
|
|
|
2008-07-04 15:07:05 -07:00
|
|
|
bool loopEdge(JSContext* cx);
|
2008-07-04 00:51:30 -07:00
|
|
|
|
2008-07-03 23:57:57 -07:00
|
|
|
bool JSOP_INTERRUPT();
|
|
|
|
bool JSOP_PUSH();
|
|
|
|
bool JSOP_POPV();
|
|
|
|
bool JSOP_ENTERWITH();
|
|
|
|
bool JSOP_LEAVEWITH();
|
|
|
|
bool JSOP_RETURN();
|
|
|
|
bool JSOP_GOTO();
|
|
|
|
bool JSOP_IFEQ();
|
|
|
|
bool JSOP_IFNE();
|
|
|
|
bool JSOP_ARGUMENTS();
|
|
|
|
bool JSOP_FORARG();
|
|
|
|
bool JSOP_FORVAR();
|
|
|
|
bool JSOP_DUP();
|
|
|
|
bool JSOP_DUP2();
|
|
|
|
bool JSOP_SETCONST();
|
|
|
|
bool JSOP_BITOR();
|
|
|
|
bool JSOP_BITXOR();
|
|
|
|
bool JSOP_BITAND();
|
|
|
|
bool JSOP_EQ();
|
|
|
|
bool JSOP_NE();
|
|
|
|
bool JSOP_LT();
|
|
|
|
bool JSOP_LE();
|
|
|
|
bool JSOP_GT();
|
|
|
|
bool JSOP_GE();
|
|
|
|
bool JSOP_LSH();
|
|
|
|
bool JSOP_RSH();
|
|
|
|
bool JSOP_URSH();
|
|
|
|
bool JSOP_ADD();
|
|
|
|
bool JSOP_SUB();
|
|
|
|
bool JSOP_MUL();
|
|
|
|
bool JSOP_DIV();
|
|
|
|
bool JSOP_MOD();
|
|
|
|
bool JSOP_NOT();
|
|
|
|
bool JSOP_BITNOT();
|
|
|
|
bool JSOP_NEG();
|
|
|
|
bool JSOP_NEW();
|
|
|
|
bool JSOP_DELNAME();
|
|
|
|
bool JSOP_DELPROP();
|
|
|
|
bool JSOP_DELELEM();
|
|
|
|
bool JSOP_TYPEOF();
|
|
|
|
bool JSOP_VOID();
|
|
|
|
bool JSOP_INCNAME();
|
|
|
|
bool JSOP_INCPROP();
|
|
|
|
bool JSOP_INCELEM();
|
|
|
|
bool JSOP_DECNAME();
|
|
|
|
bool JSOP_DECPROP();
|
|
|
|
bool JSOP_DECELEM();
|
|
|
|
bool JSOP_NAMEINC();
|
|
|
|
bool JSOP_PROPINC();
|
|
|
|
bool JSOP_ELEMINC();
|
|
|
|
bool JSOP_NAMEDEC();
|
|
|
|
bool JSOP_PROPDEC();
|
|
|
|
bool JSOP_ELEMDEC();
|
|
|
|
bool JSOP_GETPROP();
|
|
|
|
bool JSOP_SETPROP();
|
|
|
|
bool JSOP_GETELEM();
|
|
|
|
bool JSOP_SETELEM();
|
|
|
|
bool JSOP_CALLNAME();
|
|
|
|
bool JSOP_CALL();
|
|
|
|
bool JSOP_NAME();
|
|
|
|
bool JSOP_DOUBLE();
|
|
|
|
bool JSOP_STRING();
|
|
|
|
bool JSOP_ZERO();
|
|
|
|
bool JSOP_ONE();
|
|
|
|
bool JSOP_NULL();
|
|
|
|
bool JSOP_THIS();
|
|
|
|
bool JSOP_FALSE();
|
|
|
|
bool JSOP_TRUE();
|
|
|
|
bool JSOP_OR();
|
|
|
|
bool JSOP_AND();
|
|
|
|
bool JSOP_TABLESWITCH();
|
|
|
|
bool JSOP_LOOKUPSWITCH();
|
|
|
|
bool JSOP_STRICTEQ();
|
|
|
|
bool JSOP_STRICTNE();
|
|
|
|
bool JSOP_CLOSURE();
|
|
|
|
bool JSOP_EXPORTALL();
|
|
|
|
bool JSOP_EXPORTNAME();
|
|
|
|
bool JSOP_IMPORTALL();
|
|
|
|
bool JSOP_IMPORTPROP();
|
|
|
|
bool JSOP_IMPORTELEM();
|
|
|
|
bool JSOP_OBJECT();
|
|
|
|
bool JSOP_POP();
|
|
|
|
bool JSOP_POS();
|
|
|
|
bool JSOP_TRAP();
|
|
|
|
bool JSOP_GETARG();
|
|
|
|
bool JSOP_SETARG();
|
|
|
|
bool JSOP_GETVAR();
|
|
|
|
bool JSOP_SETVAR();
|
|
|
|
bool JSOP_UINT16();
|
|
|
|
bool JSOP_NEWINIT();
|
|
|
|
bool JSOP_ENDINIT();
|
|
|
|
bool JSOP_INITPROP();
|
|
|
|
bool JSOP_INITELEM();
|
|
|
|
bool JSOP_DEFSHARP();
|
|
|
|
bool JSOP_USESHARP();
|
|
|
|
bool JSOP_INCARG();
|
|
|
|
bool JSOP_INCVAR();
|
|
|
|
bool JSOP_DECARG();
|
|
|
|
bool JSOP_DECVAR();
|
|
|
|
bool JSOP_ARGINC();
|
|
|
|
bool JSOP_VARINC();
|
|
|
|
bool JSOP_ARGDEC();
|
|
|
|
bool JSOP_VARDEC();
|
|
|
|
bool JSOP_ITER();
|
|
|
|
bool JSOP_FORNAME();
|
|
|
|
bool JSOP_FORPROP();
|
|
|
|
bool JSOP_FORELEM();
|
|
|
|
bool JSOP_POPN();
|
|
|
|
bool JSOP_BINDNAME();
|
|
|
|
bool JSOP_SETNAME();
|
|
|
|
bool JSOP_THROW();
|
|
|
|
bool JSOP_IN();
|
|
|
|
bool JSOP_INSTANCEOF();
|
|
|
|
bool JSOP_DEBUGGER();
|
|
|
|
bool JSOP_GOSUB();
|
|
|
|
bool JSOP_RETSUB();
|
|
|
|
bool JSOP_EXCEPTION();
|
|
|
|
bool JSOP_LINENO();
|
|
|
|
bool JSOP_CONDSWITCH();
|
|
|
|
bool JSOP_CASE();
|
|
|
|
bool JSOP_DEFAULT();
|
|
|
|
bool JSOP_EVAL();
|
|
|
|
bool JSOP_ENUMELEM();
|
|
|
|
bool JSOP_GETTER();
|
|
|
|
bool JSOP_SETTER();
|
|
|
|
bool JSOP_DEFFUN();
|
|
|
|
bool JSOP_DEFCONST();
|
|
|
|
bool JSOP_DEFVAR();
|
|
|
|
bool JSOP_ANONFUNOBJ();
|
|
|
|
bool JSOP_NAMEDFUNOBJ();
|
|
|
|
bool JSOP_SETLOCALPOP();
|
|
|
|
bool JSOP_GROUP();
|
|
|
|
bool JSOP_SETCALL();
|
|
|
|
bool JSOP_TRY();
|
|
|
|
bool JSOP_FINALLY();
|
|
|
|
bool JSOP_NOP();
|
|
|
|
bool JSOP_ARGSUB();
|
|
|
|
bool JSOP_ARGCNT();
|
|
|
|
bool JSOP_DEFLOCALFUN();
|
|
|
|
bool JSOP_GOTOX();
|
|
|
|
bool JSOP_IFEQX();
|
|
|
|
bool JSOP_IFNEX();
|
|
|
|
bool JSOP_ORX();
|
|
|
|
bool JSOP_ANDX();
|
|
|
|
bool JSOP_GOSUBX();
|
|
|
|
bool JSOP_CASEX();
|
|
|
|
bool JSOP_DEFAULTX();
|
|
|
|
bool JSOP_TABLESWITCHX();
|
|
|
|
bool JSOP_LOOKUPSWITCHX();
|
|
|
|
bool JSOP_BACKPATCH();
|
|
|
|
bool JSOP_BACKPATCH_POP();
|
|
|
|
bool JSOP_THROWING();
|
|
|
|
bool JSOP_SETRVAL();
|
|
|
|
bool JSOP_RETRVAL();
|
|
|
|
bool JSOP_GETGVAR();
|
|
|
|
bool JSOP_SETGVAR();
|
|
|
|
bool JSOP_INCGVAR();
|
|
|
|
bool JSOP_DECGVAR();
|
|
|
|
bool JSOP_GVARINC();
|
|
|
|
bool JSOP_GVARDEC();
|
|
|
|
bool JSOP_REGEXP();
|
|
|
|
bool JSOP_DEFXMLNS();
|
|
|
|
bool JSOP_ANYNAME();
|
|
|
|
bool JSOP_QNAMEPART();
|
|
|
|
bool JSOP_QNAMECONST();
|
|
|
|
bool JSOP_QNAME();
|
|
|
|
bool JSOP_TOATTRNAME();
|
|
|
|
bool JSOP_TOATTRVAL();
|
|
|
|
bool JSOP_ADDATTRNAME();
|
|
|
|
bool JSOP_ADDATTRVAL();
|
|
|
|
bool JSOP_BINDXMLNAME();
|
|
|
|
bool JSOP_SETXMLNAME();
|
|
|
|
bool JSOP_XMLNAME();
|
|
|
|
bool JSOP_DESCENDANTS();
|
|
|
|
bool JSOP_FILTER();
|
|
|
|
bool JSOP_ENDFILTER();
|
|
|
|
bool JSOP_TOXML();
|
|
|
|
bool JSOP_TOXMLLIST();
|
|
|
|
bool JSOP_XMLTAGEXPR();
|
|
|
|
bool JSOP_XMLELTEXPR();
|
|
|
|
bool JSOP_XMLOBJECT();
|
|
|
|
bool JSOP_XMLCDATA();
|
|
|
|
bool JSOP_XMLCOMMENT();
|
|
|
|
bool JSOP_XMLPI();
|
|
|
|
bool JSOP_CALLPROP();
|
|
|
|
bool JSOP_GETFUNNS();
|
|
|
|
bool JSOP_UNUSED186();
|
|
|
|
bool JSOP_DELDESC();
|
|
|
|
bool JSOP_UINT24();
|
|
|
|
bool JSOP_INDEXBASE();
|
|
|
|
bool JSOP_RESETBASE();
|
|
|
|
bool JSOP_RESETBASE0();
|
|
|
|
bool JSOP_STARTXML();
|
|
|
|
bool JSOP_STARTXMLEXPR();
|
|
|
|
bool JSOP_CALLELEM();
|
|
|
|
bool JSOP_STOP();
|
|
|
|
bool JSOP_GETXPROP();
|
|
|
|
bool JSOP_CALLXMLNAME();
|
|
|
|
bool JSOP_TYPEOFEXPR();
|
|
|
|
bool JSOP_ENTERBLOCK();
|
|
|
|
bool JSOP_LEAVEBLOCK();
|
|
|
|
bool JSOP_GETLOCAL();
|
|
|
|
bool JSOP_SETLOCAL();
|
|
|
|
bool JSOP_INCLOCAL();
|
|
|
|
bool JSOP_DECLOCAL();
|
|
|
|
bool JSOP_LOCALINC();
|
|
|
|
bool JSOP_LOCALDEC();
|
|
|
|
bool JSOP_FORLOCAL();
|
|
|
|
bool JSOP_FORCONST();
|
|
|
|
bool JSOP_ENDITER();
|
|
|
|
bool JSOP_GENERATOR();
|
|
|
|
bool JSOP_YIELD();
|
|
|
|
bool JSOP_ARRAYPUSH();
|
|
|
|
bool JSOP_UNUSED213();
|
|
|
|
bool JSOP_ENUMCONSTELEM();
|
|
|
|
bool JSOP_LEAVEBLOCKEXPR();
|
|
|
|
bool JSOP_GETTHISPROP();
|
|
|
|
bool JSOP_GETARGPROP();
|
|
|
|
bool JSOP_GETVARPROP();
|
|
|
|
bool JSOP_GETLOCALPROP();
|
|
|
|
bool JSOP_INDEXBASE1();
|
|
|
|
bool JSOP_INDEXBASE2();
|
|
|
|
bool JSOP_INDEXBASE3();
|
|
|
|
bool JSOP_CALLGVAR();
|
|
|
|
bool JSOP_CALLVAR();
|
|
|
|
bool JSOP_CALLARG();
|
|
|
|
bool JSOP_CALLLOCAL();
|
|
|
|
bool JSOP_INT8();
|
|
|
|
bool JSOP_INT32();
|
|
|
|
bool JSOP_LENGTH();
|
|
|
|
bool JSOP_NEWARRAY();
|
|
|
|
bool JSOP_HOLE();
|
2008-06-22 09:30:04 -07:00
|
|
|
};
|
|
|
|
|
2008-07-05 16:28:03 -07:00
|
|
|
FASTCALL jsdouble builtin_dmod(jsdouble a, jsdouble b);
|
|
|
|
FASTCALL jsval builtin_BoxDouble(JSContext* cx, jsdouble d);
|
|
|
|
FASTCALL jsval builtin_BoxInt32(JSContext* cx, jsint i);
|
|
|
|
FASTCALL jsint builtin_UnboxInt32(JSContext* cx, jsval v);
|
|
|
|
|
2008-06-11 13:07:24 -07:00
|
|
|
/*
|
2008-06-03 23:52:28 -07:00
|
|
|
* Trace monitor. Every runtime is associated with a trace monitor that keeps
|
|
|
|
* track of loop frequencies for all JavaScript code loaded into that runtime.
|
|
|
|
* For this we use a loop table. Adjacent slots in the loop table, one for each
|
|
|
|
* loop header in a given script, are requested using lock-free synchronization
|
|
|
|
* from the runtime-wide loop table slot space, when the script is compiled.
|
2008-06-11 13:07:24 -07:00
|
|
|
*
|
2008-06-03 23:52:28 -07:00
|
|
|
* The loop table also doubles as trace tree pointer table once a loop achieves
|
|
|
|
* a certain number of iterations and we recorded a tree for that loop.
|
2008-05-30 18:58:43 -07:00
|
|
|
*/
|
|
|
|
struct JSTraceMonitor {
|
2008-06-26 18:13:54 -07:00
|
|
|
int freq;
|
|
|
|
nanojit::Fragmento* fragmento;
|
2008-06-30 17:12:52 -07:00
|
|
|
TraceRecorder* recorder;
|
2008-05-30 18:58:43 -07:00
|
|
|
};
|
|
|
|
|
2008-06-27 08:41:59 -07:00
|
|
|
#define TRACING_ENABLED(cx) JS_HAS_OPTION(cx, JSOPTION_JIT)
|
2008-06-10 16:49:05 -07:00
|
|
|
#define TRACE_TRIGGER_MASK 0x3f
|
2008-05-30 18:58:43 -07:00
|
|
|
|
2008-07-04 01:10:57 -07:00
|
|
|
extern bool
|
2008-07-04 15:07:05 -07:00
|
|
|
js_LoopEdge(JSContext* cx);
|
2008-06-11 17:21:15 -07:00
|
|
|
|
2008-06-28 18:19:21 -07:00
|
|
|
extern void
|
2008-07-04 01:10:57 -07:00
|
|
|
js_AbortRecording(JSContext* cx, const char* reason);
|
2008-06-28 18:19:21 -07:00
|
|
|
|
2008-05-31 15:29:54 -07:00
|
|
|
#endif /* jstracer_h___ */
|