⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsinterp.h

📁 java script test programing source code
💻 H
📖 第 1 页 / 共 2 页
字号:
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** 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 Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * 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 ***** */#ifndef jsinterp_h___#define jsinterp_h___/* * JS interpreter interface. */#include "jsprvtd.h"#include "jspubtd.h"JS_BEGIN_EXTERN_C/* * JS stack frame, may be allocated on the C stack by native callers.  Always * allocated on cx->stackPool for calls from the interpreter to an interpreted * function. * * NB: This struct is manually initialized in jsinterp.c and jsiter.c.  If you * add new members, update both files.  But first, try to remove members.  The * sharp* and xml* members should be moved onto the stack as local variables * with well-known slots, if possible. */struct JSStackFrame {    JSObject        *callobj;       /* lazily created Call object */    JSObject        *argsobj;       /* lazily created arguments object */    JSObject        *varobj;        /* variables object, where vars go */    JSScript        *script;        /* script being interpreted */    JSFunction      *fun;           /* function being called or null */    JSObject        *thisp;         /* "this" pointer if in method */    uintN           argc;           /* actual argument count */    jsval           *argv;          /* base of argument stack slots */    jsval           rval;           /* function return value */    uintN           nvars;          /* local variable count */    jsval           *vars;          /* base of variable stack slots */    JSStackFrame    *down;          /* previous frame */    void            *annotation;    /* used by Java security */    JSObject        *scopeChain;    /* scope chain */    jsbytecode      *pc;            /* program counter */    jsval           *sp;            /* stack pointer */    jsval           *spbase;        /* operand stack base */    uintN           sharpDepth;     /* array/object initializer depth */    JSObject        *sharpArray;    /* scope for #n= initializer vars */    uint32          flags;          /* frame flags -- see below */    JSStackFrame    *dormantNext;   /* next dormant frame chain */    JSObject        *xmlNamespace;  /* null or default xml namespace in E4X */    JSObject        *blockChain;    /* active compile-time block scopes */};typedef struct JSInlineFrame {    JSStackFrame    frame;          /* base struct */    jsval           *rvp;           /* ptr to caller's return value slot */    void            *mark;          /* mark before inline frame */    void            *hookData;      /* debugger call hook data */    JSVersion       callerVersion;  /* dynamic version of calling script */} JSInlineFrame;/* JS stack frame flags. */#define JSFRAME_CONSTRUCTING  0x01  /* frame is for a constructor invocation */#define JSFRAME_INTERNAL      0x02  /* internal call, not invoked by a script */#define JSFRAME_SKIP_CALLER   0x04  /* skip one link when evaluating f.caller                                       for this invocation of f */#define JSFRAME_ASSIGNING     0x08  /* a complex (not simplex JOF_ASSIGNING) op                                       is currently assigning to a property */#define JSFRAME_DEBUGGER      0x10  /* frame for JS_EvaluateInStackFrame */#define JSFRAME_EVAL          0x20  /* frame for obj_eval */#define JSFRAME_SPECIAL       0x30  /* special evaluation frame flags */#define JSFRAME_COMPILING     0x40  /* frame is being used by compiler */#define JSFRAME_COMPILE_N_GO  0x80  /* compiler-and-go mode, can optimize name                                       references based on scope chain */#define JSFRAME_SCRIPT_OBJECT 0x100 /* compiling source for a Script object */#define JSFRAME_YIELDING      0x200 /* js_Interpret dispatched JSOP_YIELD */#define JSFRAME_FILTERING     0x400 /* XML filtering predicate expression */#define JSFRAME_ITERATOR      0x800 /* trying to get an iterator for for-in */#define JSFRAME_POP_BLOCKS   0x1000 /* scope chain contains blocks to pop */#define JSFRAME_GENERATOR    0x2000 /* frame belongs to generator-iterator */#define JSFRAME_OVERRIDE_SHIFT 24   /* override bit-set params; see jsfun.c */#define JSFRAME_OVERRIDE_BITS  8/* * Property cache for quickened get/set property opcodes. */#define PROPERTY_CACHE_LOG2     10#define PROPERTY_CACHE_SIZE     JS_BIT(PROPERTY_CACHE_LOG2)#define PROPERTY_CACHE_MASK     JS_BITMASK(PROPERTY_CACHE_LOG2)#define PROPERTY_CACHE_HASH(obj, id) \    ((((jsuword)(obj) >> JSVAL_TAGBITS) ^ (jsuword)(id)) & PROPERTY_CACHE_MASK)#ifdef JS_THREADSAFE#if HAVE_ATOMIC_DWORD_ACCESS#define PCE_LOAD(cache, pce, entry)     JS_ATOMIC_DWORD_LOAD(pce, entry)#define PCE_STORE(cache, pce, entry)    JS_ATOMIC_DWORD_STORE(pce, entry)#else  /* !HAVE_ATOMIC_DWORD_ACCESS */#define JS_PROPERTY_CACHE_METERING      1#define PCE_LOAD(cache, pce, entry)                                           \    JS_BEGIN_MACRO                                                            \        uint32 prefills_;                                                     \        uint32 fills_ = (cache)->fills;                                       \        do {                                                                  \            /* Load until cache->fills is stable (see FILL macro below). */   \            prefills_ = fills_;                                               \            (entry) = *(pce);                                                 \        } while ((fills_ = (cache)->fills) != prefills_);                     \    JS_END_MACRO#define PCE_STORE(cache, pce, entry)                                          \    JS_BEGIN_MACRO                                                            \        do {                                                                  \            /* Store until no racing collider stores half or all of pce. */   \            *(pce) = (entry);                                                 \        } while (PCE_OBJECT(*pce) != PCE_OBJECT(entry) ||                     \                 PCE_PROPERTY(*pce) != PCE_PROPERTY(entry));                  \    JS_END_MACRO#endif /* !HAVE_ATOMIC_DWORD_ACCESS */#else  /* !JS_THREADSAFE */#define PCE_LOAD(cache, pce, entry)     ((entry) = *(pce))#define PCE_STORE(cache, pce, entry)    (*(pce) = (entry))#endif /* !JS_THREADSAFE */typedef union JSPropertyCacheEntry {    struct {        JSObject        *object;        /* weak link to object */        JSScopeProperty *property;      /* weak link to property */    } s;#ifdef HAVE_ATOMIC_DWORD_ACCESS    prdword align;#endif} JSPropertyCacheEntry;/* These may be called in lvalue or rvalue position. */#define PCE_OBJECT(entry)       ((entry).s.object)#define PCE_PROPERTY(entry)     ((entry).s.property)typedef struct JSPropertyCache {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -