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_BigInt_h
8
#define builtin_BigInt_h
9
10
#include "js/Class.h"
11
#include "js/RootingAPI.h"
12
#include "vm/BigIntType.h"
13
#include "vm/NativeObject.h"
14
15
namespace js {
16
17
class GlobalObject;
18
19
class BigIntObject : public NativeObject {
20
static const unsigned PRIMITIVE_VALUE_SLOT = 0;
21
static const unsigned RESERVED_SLOTS = 1;
22
23
public:
24
static const ClassSpec classSpec_;
25
static const JSClass class_;
26
static const JSClass protoClass_;
27
28
static JSObject* create(JSContext* cx, JS::Handle<JS::BigInt*> bi);
29
30
// Methods defined on BigInt.prototype.
31
static bool valueOf_impl(JSContext* cx, const CallArgs& args);
32
static bool valueOf(JSContext* cx, unsigned argc, JS::Value* vp);
33
static bool toString_impl(JSContext* cx, const CallArgs& args);
34
static bool toString(JSContext* cx, unsigned argc, JS::Value* vp);
35
#ifndef ENABLE_INTL_API
36
static bool toLocaleString_impl(JSContext* cx, const CallArgs& args);
37
static bool toLocaleString(JSContext* cx, unsigned argc, JS::Value* vp);
38
#endif
39
static bool asUintN(JSContext* cx, unsigned argc, JS::Value* vp);
40
static bool asIntN(JSContext* cx, unsigned argc, JS::Value* vp);
41
42
JS::BigInt* unbox() const;
43
44
private:
45
static const JSPropertySpec properties[];
46
static const JSFunctionSpec methods[];
47
static const JSFunctionSpec staticMethods[];
48
};
49
50
extern JSObject* InitBigIntClass(JSContext* cx, Handle<GlobalObject*> global);
51
52
} // namespace js
53
54
#endif