1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/builtin/SelfHostingDefines.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +// Specialized .h file to be used by both JS and C++ code. 1.11 + 1.12 +#ifndef builtin_SelfHostingDefines_h 1.13 +#define builtin_SelfHostingDefines_h 1.14 + 1.15 +// Utility macros. 1.16 +#define TO_INT32(x) ((x) | 0) 1.17 +#define TO_UINT32(x) ((x) >>> 0) 1.18 +#define IS_UINT32(x) ((x) >>> 0 === (x)) 1.19 + 1.20 +// Assertions. 1.21 +#ifdef DEBUG 1.22 +#define assert(b, info) if (!(b)) AssertionFailed(info) 1.23 +#else 1.24 +#define assert(b, info) // Elided assertion. 1.25 +#endif 1.26 + 1.27 +// Unforgeable versions of ARRAY.push(ELEMENT) and ARRAY.slice. 1.28 +#define ARRAY_PUSH(ARRAY, ELEMENT) \ 1.29 + callFunction(std_Array_push, ARRAY, ELEMENT); 1.30 +#define ARRAY_SLICE(ARRAY, ELEMENT) \ 1.31 + callFunction(std_Array_slice, ARRAY, ELEMENT); 1.32 + 1.33 +// Property descriptor attributes. 1.34 +#define ATTR_ENUMERABLE 0x01 1.35 +#define ATTR_CONFIGURABLE 0x02 1.36 +#define ATTR_WRITABLE 0x04 1.37 + 1.38 +#define ATTR_NONENUMERABLE 0x08 1.39 +#define ATTR_NONCONFIGURABLE 0x10 1.40 +#define ATTR_NONWRITABLE 0x20 1.41 + 1.42 +#endif