LCOV - code coverage report
Current view: directory - js/src/methodjit - StubCalls.h (source / functions) Found Hit Coverage
Test: app.info Lines: 7 7 100.0 %
Date: 2012-06-02 Functions: 7 7 100.0 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  * vim: set ts=4 sw=4 et tw=99:
       3                 :  *
       4                 :  * ***** BEGIN LICENSE BLOCK *****
       5                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       6                 :  *
       7                 :  * The contents of this file are subject to the Mozilla Public License Version
       8                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       9                 :  * the License. You may obtain a copy of the License at
      10                 :  * http://www.mozilla.org/MPL/
      11                 :  *
      12                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      13                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      14                 :  * for the specific language governing rights and limitations under the
      15                 :  * License.
      16                 :  *
      17                 :  * The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
      18                 :  * May 28, 2008.
      19                 :  *
      20                 :  * The Initial Developer of the Original Code is
      21                 :  *   Brendan Eich <brendan@mozilla.org>
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *   David Anderson <danderson@mozilla.com>
      25                 :  *   David Mandelin <dmandelin@mozilla.com>
      26                 :  *
      27                 :  * Alternatively, the contents of this file may be used under the terms of
      28                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      29                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      30                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      31                 :  * of those above. If you wish to allow use of your version of this file only
      32                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      33                 :  * use your version of this file under the terms of the MPL, indicate your
      34                 :  * decision by deleting the provisions above and replace them with the notice
      35                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      36                 :  * the provisions above, a recipient may use your version of this file under
      37                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      38                 :  *
      39                 :  * ***** END LICENSE BLOCK ***** */
      40                 : 
      41                 : #if !defined jslogic_h__ && defined JS_METHODJIT
      42                 : #define jslogic_h__
      43                 : 
      44                 : #include "MethodJIT.h"
      45                 : 
      46                 : namespace js {
      47                 : namespace mjit {
      48                 : namespace stubs {
      49                 : 
      50                 : typedef enum JSTrapType {
      51                 :     JSTRAP_NONE = 0,
      52                 :     JSTRAP_TRAP = 1,
      53                 :     JSTRAP_SINGLESTEP = 2
      54                 : } JSTrapType;
      55                 : 
      56                 : void JS_FASTCALL This(VMFrame &f);
      57                 : void JS_FASTCALL NewInitArray(VMFrame &f, uint32_t count);
      58                 : void JS_FASTCALL NewInitObject(VMFrame &f, JSObject *base);
      59                 : void JS_FASTCALL Trap(VMFrame &f, uint32_t trapTypes);
      60                 : void JS_FASTCALL DebuggerStatement(VMFrame &f, jsbytecode *pc);
      61                 : void JS_FASTCALL Interrupt(VMFrame &f, jsbytecode *pc);
      62                 : void JS_FASTCALL RecompileForInline(VMFrame &f);
      63                 : void JS_FASTCALL InitElem(VMFrame &f, uint32_t last);
      64                 : void JS_FASTCALL InitProp(VMFrame &f, PropertyName *name);
      65                 : void JS_FASTCALL InitMethod(VMFrame &f, PropertyName *name);
      66                 : 
      67                 : void JS_FASTCALL HitStackQuota(VMFrame &f);
      68                 : void * JS_FASTCALL FixupArity(VMFrame &f, uint32_t argc);
      69                 : void * JS_FASTCALL CompileFunction(VMFrame &f, uint32_t argc);
      70                 : void JS_FASTCALL SlowNew(VMFrame &f, uint32_t argc);
      71                 : void JS_FASTCALL SlowCall(VMFrame &f, uint32_t argc);
      72                 : void * JS_FASTCALL UncachedNew(VMFrame &f, uint32_t argc);
      73                 : void * JS_FASTCALL UncachedCall(VMFrame &f, uint32_t argc);
      74                 : void * JS_FASTCALL UncachedLoweredCall(VMFrame &f, uint32_t argc);
      75                 : void JS_FASTCALL Eval(VMFrame &f, uint32_t argc);
      76                 : void JS_FASTCALL ScriptDebugPrologue(VMFrame &f);
      77                 : void JS_FASTCALL ScriptDebugEpilogue(VMFrame &f);
      78                 : void JS_FASTCALL ScriptProbeOnlyPrologue(VMFrame &f);
      79                 : void JS_FASTCALL ScriptProbeOnlyEpilogue(VMFrame &f);
      80                 : 
      81                 : /*
      82                 :  * Result struct for UncachedXHelper.
      83                 :  *
      84                 :  * These functions can have one of two results:
      85                 :  *
      86                 :  *   (1) The function was executed in the interpreter. Then all fields
      87                 :  *       are NULL except unjittable.
      88                 :  *
      89                 :  *   (2) The function was not executed, and the function has been compiled
      90                 :  *       to JM native code. Then all fields are non-NULL.
      91                 :  */
      92                 : struct UncachedCallResult {
      93                 :     JSFunction *fun;          // callee function
      94                 :     void       *codeAddr;     // code address of compiled callee function
      95                 :     bool       unjittable;    // did we try to JIT and fail?
      96                 : 
      97        20733325 :     void init() {
      98        20733325 :         fun = NULL;
      99        20733325 :         codeAddr = NULL;
     100        20733325 :         unjittable = false;
     101        20733325 :     }        
     102                 : };
     103                 : 
     104                 : /*
     105                 :  * Helper functions for stubs and IC functions for calling functions.
     106                 :  * These functions either execute the function, return a native code
     107                 :  * pointer that can be used to call the function, or throw.
     108                 :  */
     109                 : void UncachedCallHelper(VMFrame &f, uint32_t argc, bool lowered, UncachedCallResult *ucr);
     110                 : void UncachedNewHelper(VMFrame &f, uint32_t argc, UncachedCallResult *ucr);
     111                 : 
     112                 : void JS_FASTCALL CreateThis(VMFrame &f, JSObject *proto);
     113                 : void JS_FASTCALL Throw(VMFrame &f);
     114                 : 
     115                 : void * JS_FASTCALL LookupSwitch(VMFrame &f, jsbytecode *pc);
     116                 : void * JS_FASTCALL TableSwitch(VMFrame &f, jsbytecode *origPc);
     117                 : 
     118                 : void JS_FASTCALL BindName(VMFrame &f, PropertyName *name);
     119                 : JSObject * JS_FASTCALL BindGlobalName(VMFrame &f);
     120                 : template<JSBool strict> void JS_FASTCALL SetName(VMFrame &f, PropertyName *name);
     121                 : template<JSBool strict> void JS_FASTCALL SetGlobalName(VMFrame &f, PropertyName *name);
     122                 : void JS_FASTCALL Name(VMFrame &f);
     123                 : void JS_FASTCALL GetProp(VMFrame &f, PropertyName *name);
     124                 : void JS_FASTCALL GetPropNoCache(VMFrame &f, PropertyName *name);
     125                 : void JS_FASTCALL GetElem(VMFrame &f);
     126                 : template<JSBool strict> void JS_FASTCALL SetElem(VMFrame &f);
     127                 : void JS_FASTCALL ToId(VMFrame &f);
     128                 : void JS_FASTCALL ImplicitThis(VMFrame &f, PropertyName *name);
     129                 : void JS_FASTCALL GetUpvar(VMFrame &f, uint32_t index);
     130                 : 
     131                 : template <JSBool strict> void JS_FASTCALL DelProp(VMFrame &f, PropertyName *name);
     132                 : template <JSBool strict> void JS_FASTCALL DelElem(VMFrame &f);
     133                 : void JS_FASTCALL DelName(VMFrame &f, PropertyName *name);
     134                 : JSBool JS_FASTCALL In(VMFrame &f);
     135                 : 
     136                 : void JS_FASTCALL DefVarOrConst(VMFrame &f, PropertyName *name);
     137                 : void JS_FASTCALL SetConst(VMFrame &f, PropertyName *name);
     138                 : template<JSBool strict> void JS_FASTCALL DefFun(VMFrame &f, JSFunction *fun);
     139                 : JSObject * JS_FASTCALL DefLocalFun(VMFrame &f, JSFunction *fun);
     140                 : JSObject * JS_FASTCALL DefLocalFun_FC(VMFrame &f, JSFunction *fun);
     141                 : void JS_FASTCALL RegExp(VMFrame &f, JSObject *regex);
     142                 : JSObject * JS_FASTCALL Lambda(VMFrame &f, JSFunction *fun);
     143                 : JSObject * JS_FASTCALL LambdaJoinableForInit(VMFrame &f, JSFunction *fun);
     144                 : JSObject * JS_FASTCALL LambdaJoinableForSet(VMFrame &f, JSFunction *fun);
     145                 : JSObject * JS_FASTCALL LambdaJoinableForCall(VMFrame &f, JSFunction *fun);
     146                 : JSObject * JS_FASTCALL LambdaJoinableForNull(VMFrame &f, JSFunction *fun);
     147                 : JSObject * JS_FASTCALL FlatLambda(VMFrame &f, JSFunction *fun);
     148                 : void JS_FASTCALL Arguments(VMFrame &f);
     149                 : void JS_FASTCALL EnterBlock(VMFrame &f, JSObject *obj);
     150                 : void JS_FASTCALL LeaveBlock(VMFrame &f);
     151                 : 
     152                 : JSBool JS_FASTCALL LessThan(VMFrame &f);
     153                 : JSBool JS_FASTCALL LessEqual(VMFrame &f);
     154                 : JSBool JS_FASTCALL GreaterThan(VMFrame &f);
     155                 : JSBool JS_FASTCALL GreaterEqual(VMFrame &f);
     156                 : JSBool JS_FASTCALL Equal(VMFrame &f);
     157                 : JSBool JS_FASTCALL NotEqual(VMFrame &f);
     158                 : 
     159                 : void JS_FASTCALL BitOr(VMFrame &f);
     160                 : void JS_FASTCALL BitXor(VMFrame &f);
     161                 : void JS_FASTCALL BitAnd(VMFrame &f);
     162                 : void JS_FASTCALL BitNot(VMFrame &f);
     163                 : void JS_FASTCALL Lsh(VMFrame &f);
     164                 : void JS_FASTCALL Rsh(VMFrame &f);
     165                 : void JS_FASTCALL Ursh(VMFrame &f);
     166                 : void JS_FASTCALL Add(VMFrame &f);
     167                 : void JS_FASTCALL Sub(VMFrame &f);
     168                 : void JS_FASTCALL Mul(VMFrame &f);
     169                 : void JS_FASTCALL Div(VMFrame &f);
     170                 : void JS_FASTCALL Mod(VMFrame &f);
     171                 : void JS_FASTCALL Neg(VMFrame &f);
     172                 : void JS_FASTCALL Pos(VMFrame &f);
     173                 : void JS_FASTCALL Not(VMFrame &f);
     174                 : void JS_FASTCALL StrictEq(VMFrame &f);
     175                 : void JS_FASTCALL StrictNe(VMFrame &f);
     176                 : 
     177                 : void JS_FASTCALL Iter(VMFrame &f, uint32_t flags);
     178                 : void JS_FASTCALL IterNext(VMFrame &f, int32_t offset);
     179                 : JSBool JS_FASTCALL IterMore(VMFrame &f);
     180                 : void JS_FASTCALL EndIter(VMFrame &f);
     181                 : 
     182                 : JSBool JS_FASTCALL ValueToBoolean(VMFrame &f);
     183                 : JSString * JS_FASTCALL TypeOf(VMFrame &f);
     184                 : JSBool JS_FASTCALL InstanceOf(VMFrame &f);
     185                 : void JS_FASTCALL FastInstanceOf(VMFrame &f);
     186                 : 
     187                 : /*
     188                 :  * Helper for triggering recompilation should a name read miss a type barrier,
     189                 :  * produce undefined or -0.
     190                 :  */
     191                 : void JS_FASTCALL TypeBarrierHelper(VMFrame &f, uint32_t which);
     192                 : void JS_FASTCALL TypeBarrierReturn(VMFrame &f, Value *vp);
     193                 : void JS_FASTCALL NegZeroHelper(VMFrame &f);
     194                 : 
     195                 : void JS_FASTCALL StubTypeHelper(VMFrame &f, int32_t which);
     196                 : 
     197                 : void JS_FASTCALL CheckArgumentTypes(VMFrame &f);
     198                 : 
     199                 : #ifdef DEBUG
     200                 : void JS_FASTCALL AssertArgumentTypes(VMFrame &f);
     201                 : #endif
     202                 : 
     203                 : void JS_FASTCALL MissedBoundsCheckEntry(VMFrame &f);
     204                 : void JS_FASTCALL MissedBoundsCheckHead(VMFrame &f);
     205                 : void * JS_FASTCALL InvariantFailure(VMFrame &f, void *repatchCode);
     206                 : 
     207                 : template <bool strict> int32_t JS_FASTCALL ConvertToTypedInt(JSContext *cx, Value *vp);
     208                 : void JS_FASTCALL ConvertToTypedFloat(JSContext *cx, Value *vp);
     209                 : 
     210                 : void JS_FASTCALL Exception(VMFrame &f);
     211                 : 
     212                 : void JS_FASTCALL FunctionFramePrologue(VMFrame &f);
     213                 : void JS_FASTCALL FunctionFrameEpilogue(VMFrame &f);
     214                 : 
     215                 : void JS_FASTCALL AnyFrameEpilogue(VMFrame &f);
     216                 : 
     217                 : JSObject * JS_FASTCALL
     218                 : NewDenseUnallocatedArray(VMFrame &f, uint32_t length);
     219                 : 
     220                 : void JS_FASTCALL ArrayConcatTwoArrays(VMFrame &f);
     221                 : void JS_FASTCALL ArrayShift(VMFrame &f);
     222                 : 
     223                 : void JS_FASTCALL WriteBarrier(VMFrame &f, Value *addr);
     224                 : void JS_FASTCALL GCThingWriteBarrier(VMFrame &f, Value *addr);
     225                 : 
     226                 : void JS_FASTCALL CrossChunkShim(VMFrame &f, void *edge);
     227                 : 
     228                 : } /* namespace stubs */
     229                 : 
     230                 : /* 
     231                 :  * If COND is true, return A; otherwise, return B. This allows us to choose between
     232                 :  * function template instantiations without running afoul of C++'s overload resolution
     233                 :  * rules. (Try simplifying, and you'll either see the problem --- or have found a
     234                 :  * better solution!)
     235                 :  */
     236                 : template<typename FuncPtr>
     237          337529 : inline FuncPtr FunctionTemplateConditional(bool cond, FuncPtr a, FuncPtr b) {
     238          337529 :     return cond ? a : b;
     239                 : }
     240                 : 
     241                 : }} /* namespace stubs,mjit,js */
     242                 : 
     243                 : extern "C" void *
     244                 : js_InternalThrow(js::VMFrame &f);
     245                 : 
     246                 : extern "C" void *
     247                 : js_InternalInterpret(void *returnData, void *returnType, void *returnReg, js::VMFrame &f);
     248                 : 
     249                 : #endif /* jslogic_h__ */
     250                 : 

Generated by: LCOV version 1.7