diff -r 000000000000 -r 6474c204b198 js/src/builtin/SelfHostingDefines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/builtin/SelfHostingDefines.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Specialized .h file to be used by both JS and C++ code. + +#ifndef builtin_SelfHostingDefines_h +#define builtin_SelfHostingDefines_h + +// Utility macros. +#define TO_INT32(x) ((x) | 0) +#define TO_UINT32(x) ((x) >>> 0) +#define IS_UINT32(x) ((x) >>> 0 === (x)) + +// Assertions. +#ifdef DEBUG +#define assert(b, info) if (!(b)) AssertionFailed(info) +#else +#define assert(b, info) // Elided assertion. +#endif + +// Unforgeable versions of ARRAY.push(ELEMENT) and ARRAY.slice. +#define ARRAY_PUSH(ARRAY, ELEMENT) \ + callFunction(std_Array_push, ARRAY, ELEMENT); +#define ARRAY_SLICE(ARRAY, ELEMENT) \ + callFunction(std_Array_slice, ARRAY, ELEMENT); + +// Property descriptor attributes. +#define ATTR_ENUMERABLE 0x01 +#define ATTR_CONFIGURABLE 0x02 +#define ATTR_WRITABLE 0x04 + +#define ATTR_NONENUMERABLE 0x08 +#define ATTR_NONCONFIGURABLE 0x10 +#define ATTR_NONWRITABLE 0x20 + +#endif