Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
* vim: set ts=8 sts=2 et sw=2 tw=80:
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 "NamespaceImports.h"
11
12
#include "js/TypeDecls.h"
13
14
namespace js {
15
16
// The C++ native for 'eval' (ES5 15.1.2.1). The function is named "indirect
17
// eval" because "direct eval" calls (as defined by the spec) will emit
18
// JSOP_EVAL which in turn calls DirectEval. Thus, even though IndirectEval is
19
// the callee function object for *all* calls to eval, it is by construction
20
// only ever called in the case indirect eval.
21
extern MOZ_MUST_USE bool IndirectEval(JSContext* cx, unsigned argc, Value* vp);
22
23
// Performs a direct eval of |v| (a string containing code, or another value
24
// that will be vacuously returned), which must correspond to the currently-
25
// executing stack frame, which must be a script frame.
26
extern MOZ_MUST_USE bool DirectEval(JSContext* cx, HandleValue v,
27
MutableHandleValue vp);
28
29
// Performs a direct eval called from Ion code.
30
extern MOZ_MUST_USE bool DirectEvalStringFromIon(
31
JSContext* cx, HandleObject scopeObj, HandleScript callerScript,
32
HandleValue newTargetValue, HandleString str, jsbytecode* pc,
33
MutableHandleValue vp);
34
35
// True iff fun is a built-in eval function.
36
extern bool IsAnyBuiltinEval(JSFunction* fun);
37
38
} // namespace js
39
40
#endif /* builtin_Eval_h */