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/. */
7 #ifndef builtin_BigInt_h
8 #define builtin_BigInt_h
11 #include "js/RootingAPI.h"
12 #include "vm/NativeObject.h"
18 class BigIntObject
: public NativeObject
{
19 static const unsigned PRIMITIVE_VALUE_SLOT
= 0;
20 static const unsigned RESERVED_SLOTS
= 1;
23 static const ClassSpec classSpec_
;
24 static const JSClass class_
;
25 static const JSClass protoClass_
;
27 static JSObject
* create(JSContext
* cx
, JS::Handle
<JS::BigInt
*> bi
);
29 // Methods defined on BigInt.prototype.
30 static bool valueOf_impl(JSContext
* cx
, const CallArgs
& args
);
31 static bool valueOf(JSContext
* cx
, unsigned argc
, JS::Value
* vp
);
32 static bool toString_impl(JSContext
* cx
, const CallArgs
& args
);
33 static bool toString(JSContext
* cx
, unsigned argc
, JS::Value
* vp
);
34 #ifndef JS_HAS_INTL_API
35 static bool toLocaleString_impl(JSContext
* cx
, const CallArgs
& args
);
36 static bool toLocaleString(JSContext
* cx
, unsigned argc
, JS::Value
* vp
);
38 static bool asUintN(JSContext
* cx
, unsigned argc
, JS::Value
* vp
);
39 static bool asIntN(JSContext
* cx
, unsigned argc
, JS::Value
* vp
);
41 JS::BigInt
* unbox() const;
44 static const JSPropertySpec properties
[];
45 static const JSFunctionSpec methods
[];
46 static const JSFunctionSpec staticMethods
[];
49 extern JSObject
* InitBigIntClass(JSContext
* cx
, Handle
<GlobalObject
*> global
);