|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef builtin_Eval_h |
|
8 #define builtin_Eval_h |
|
9 |
|
10 #include "jsbytecode.h" |
|
11 #include "NamespaceImports.h" |
|
12 |
|
13 namespace js { |
|
14 |
|
15 // The C++ native for 'eval' (ES5 15.1.2.1). The function is named "indirect |
|
16 // eval" because "direct eval" calls (as defined by the spec) will emit |
|
17 // JSOP_EVAL which in turn calls DirectEval. Thus, even though IndirectEval is |
|
18 // the callee function object for *all* calls to eval, it is by construction |
|
19 // only ever called in the case indirect eval. |
|
20 extern bool |
|
21 IndirectEval(JSContext *cx, unsigned argc, Value *vp); |
|
22 |
|
23 // Performs a direct eval for the given arguments, which must correspond to the |
|
24 // currently-executing stack frame, which must be a script frame. On completion |
|
25 // the result is returned in args.rval. |
|
26 extern bool |
|
27 DirectEval(JSContext *cx, const CallArgs &args); |
|
28 |
|
29 // Performs a direct eval called from Ion code. |
|
30 extern bool |
|
31 DirectEvalStringFromIon(JSContext *cx, |
|
32 HandleObject scopeObj, HandleScript callerScript, |
|
33 HandleValue thisValue, HandleString str, |
|
34 jsbytecode * pc, MutableHandleValue vp); |
|
35 extern bool |
|
36 DirectEvalValueFromIon(JSContext *cx, |
|
37 HandleObject scopeObj, HandleScript callerScript, |
|
38 HandleValue thisValue, HandleValue evalArg, |
|
39 jsbytecode * pc, MutableHandleValue vp); |
|
40 |
|
41 // True iff fun is a built-in eval function. |
|
42 extern bool |
|
43 IsAnyBuiltinEval(JSFunction *fun); |
|
44 |
|
45 } // namespace js |
|
46 #endif /* builtin_Eval_h */ |