PageRenderTime 17ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/js/src/jsversion.h

http://github.com/zpao/v8monkey
C Header | 211 lines | 114 code | 21 blank | 76 comment | 9 complexity | b365f97aee13528760498ff0a4ea002c MD5 | raw file
  1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2 *
  3 * ***** BEGIN LICENSE BLOCK *****
  4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5 *
  6 * The contents of this file are subject to the Mozilla Public License Version
  7 * 1.1 (the "License"); you may not use this file except in compliance with
  8 * the License. You may obtain a copy of the License at
  9 * http://www.mozilla.org/MPL/
 10 *
 11 * Software distributed under the License is distributed on an "AS IS" basis,
 12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 13 * for the specific language governing rights and limitations under the
 14 * License.
 15 *
 16 * The Original Code is Mozilla Communicator client code, released
 17 * March 31, 1998.
 18 *
 19 * The Initial Developer of the Original Code is
 20 * Netscape Communications Corporation.
 21 * Portions created by the Initial Developer are Copyright (C) 1998
 22 * the Initial Developer. All Rights Reserved.
 23 *
 24 * Contributor(s):
 25 *
 26 * Alternatively, the contents of this file may be used under the terms of
 27 * either of the GNU General Public License Version 2 or later (the "GPL"),
 28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 29 * in which case the provisions of the GPL or the LGPL are applicable instead
 30 * of those above. If you wish to allow use of your version of this file only
 31 * under the terms of either the GPL or the LGPL, and not to allow others to
 32 * use your version of this file under the terms of the MPL, indicate your
 33 * decision by deleting the provisions above and replace them with the notice
 34 * and other provisions required by the GPL or the LGPL. If you do not delete
 35 * the provisions above, a recipient may use your version of this file under
 36 * the terms of any one of the MPL, the GPL or the LGPL.
 37 *
 38 * ***** END LICENSE BLOCK ***** */
 39
 40/*
 41 * JS configuration macros.
 42 */
 43#ifndef JS_VERSION
 44#define JS_VERSION 185
 45#endif
 46
 47/*
 48 * Compile-time JS version configuration.  The JS version numbers lie on the
 49 * number line like so:
 50 *
 51 * 1.0     1.1     1.2     1.3     1.4     ECMAv3  1.5     1.6     1.7     1.8     ECMAv5
 52 *         ^                       ^
 53 *         |                       |
 54 *         basis for ECMAv1        close to ECMAv2
 55 *
 56 * where ECMAv3 stands for ECMA-262 Edition 3, and ECMAv5 stands for Edition 5.
 57 * See the runtime version enum JSVersion in jspubtd.h. Code in the engine can
 58 * therefore count on version <= JSVERSION_1_4 to mean "before the Third
 59 * Edition of ECMA-262" and version > JSVERSION_1_4 to mean "at or after the
 60 * Third Edition".
 61 *
 62 * In the (likely?) event that SpiderMonkey grows to implement JavaScript 2.0,
 63 * the version number to use would be near 200, or greater.
 64 *
 65 * The JS_VERSION_ECMA_3 version is the minimal configuration conforming to
 66 * the ECMA-262 Edition 3 specification.  Use it for minimal embeddings, where
 67 * you're sure you don't need any of the extensions disabled in this version.
 68 * In order to facilitate testing, JS_HAS_OBJ_PROTO_PROP is defined as part of
 69 * the JS_VERSION_ECMA_3_TEST version.
 70 *
 71 * To keep things sane in the modern age, where we need exceptions in order to
 72 * implement, e.g., iterators and generators, we are dropping support for all
 73 * versions <= 1.4.
 74 */
 75#define JS_VERSION_ECMA_3       148
 76#define JS_VERSION_ECMA_3_TEST  149
 77
 78#if JS_VERSION == JS_VERSION_ECMA_3 ||                                        \
 79    JS_VERSION == JS_VERSION_ECMA_3_TEST
 80
 81#define JS_HAS_STR_HTML_HELPERS 0       /* has str.anchor, str.bold, etc. */
 82#define JS_HAS_PERL_SUBSTR      0       /* has str.substr */
 83#if JS_VERSION == JS_VERSION_ECMA_3_TEST
 84#define JS_HAS_OBJ_PROTO_PROP   1       /* has o.__proto__ etc. */
 85#else
 86#define JS_HAS_OBJ_PROTO_PROP   0       /* has o.__proto__ etc. */
 87#endif
 88#define JS_HAS_OBJ_WATCHPOINT   0       /* has o.watch and o.unwatch */
 89#define JS_HAS_XDR              0       /* has XDR API and internal support */
 90#define JS_HAS_TOSOURCE         0       /* has Object/Array toSource method */
 91#define JS_HAS_CATCH_GUARD      0       /* has exception handling catch guard */
 92#define JS_HAS_SPARSE_ARRAYS    0       /* array methods preserve empty elems */
 93#define JS_HAS_UNEVAL           0       /* has uneval() top-level function */
 94#define JS_HAS_CONST            0       /* has JS2 const as alternative var */
 95#define JS_HAS_FUN_EXPR_STMT    0       /* has function expression statement */
 96#define JS_HAS_NO_SUCH_METHOD   0       /* has o.__noSuchMethod__ handler */
 97#define JS_HAS_XML_SUPPORT      0       /* has ECMAScript for XML support */
 98#define JS_HAS_GENERATORS       0       /* has yield in generator function */
 99#define JS_HAS_BLOCK_SCOPE      0       /* has block scope via let/arraycomp */
100#define JS_HAS_DESTRUCTURING    0       /* has [a,b] = ... or {p:a,q:b} = ... */
101#define JS_HAS_GENERATOR_EXPRS  0       /* has (expr for (lhs in iterable)) */
102#define JS_HAS_EXPR_CLOSURES    0       /* has function (formals) listexpr */
103
104#elif JS_VERSION < 150
105
106#error "unsupported JS_VERSION"
107
108#elif JS_VERSION == 150
109
110#define JS_HAS_STR_HTML_HELPERS 1       /* has str.anchor, str.bold, etc. */
111#define JS_HAS_PERL_SUBSTR      1       /* has str.substr */
112#define JS_HAS_OBJ_PROTO_PROP   1       /* has o.__proto__ etc. */
113#define JS_HAS_OBJ_WATCHPOINT   1       /* has o.watch and o.unwatch */
114#define JS_HAS_XDR              1       /* has XDR API and internal support */
115#define JS_HAS_TOSOURCE         1       /* has Object/Array toSource method */
116#define JS_HAS_CATCH_GUARD      1       /* has exception handling catch guard */
117#define JS_HAS_SPARSE_ARRAYS    0       /* array methods preserve empty elems */
118#define JS_HAS_UNEVAL           1       /* has uneval() top-level function */
119#define JS_HAS_CONST            1       /* has JS2 const as alternative var */
120#define JS_HAS_FUN_EXPR_STMT    1       /* has function expression statement */
121#define JS_HAS_NO_SUCH_METHOD   1       /* has o.__noSuchMethod__ handler */
122#define JS_HAS_XML_SUPPORT      0       /* has ECMAScript for XML support */
123#define JS_HAS_GENERATORS       0       /* has yield in generator function */
124#define JS_HAS_BLOCK_SCOPE      0       /* has block scope via let/arraycomp */
125#define JS_HAS_DESTRUCTURING    0       /* has [a,b] = ... or {p:a,q:b} = ... */
126#define JS_HAS_GENERATOR_EXPRS  0       /* has (expr for (lhs in iterable)) */
127#define JS_HAS_EXPR_CLOSURES    0       /* has function (formals) listexpr */
128
129#elif JS_VERSION == 160
130
131#define JS_HAS_STR_HTML_HELPERS 1       /* has str.anchor, str.bold, etc. */
132#define JS_HAS_PERL_SUBSTR      1       /* has str.substr */
133#define JS_HAS_OBJ_PROTO_PROP   1       /* has o.__proto__ etc. */
134#define JS_HAS_OBJ_WATCHPOINT   1       /* has o.watch and o.unwatch */
135#define JS_HAS_XDR              1       /* has XDR API and internal support */
136#define JS_HAS_TOSOURCE         1       /* has Object/Array toSource method */
137#define JS_HAS_CATCH_GUARD      1       /* has exception handling catch guard */
138#define JS_HAS_SPARSE_ARRAYS    0       /* array methods preserve empty elems */
139#define JS_HAS_UNEVAL           1       /* has uneval() top-level function */
140#define JS_HAS_CONST            1       /* has JS2 const as alternative var */
141#define JS_HAS_FUN_EXPR_STMT    1       /* has function expression statement */
142#define JS_HAS_NO_SUCH_METHOD   1       /* has o.__noSuchMethod__ handler */
143#define JS_HAS_XML_SUPPORT      1       /* has ECMAScript for XML support */
144#define JS_HAS_GENERATORS       0       /* has yield in generator function */
145#define JS_HAS_BLOCK_SCOPE      0       /* has block scope via let/arraycomp */
146#define JS_HAS_DESTRUCTURING    0       /* has [a,b] = ... or {p:a,q:b} = ... */
147#define JS_HAS_GENERATOR_EXPRS  0       /* has (expr for (lhs in iterable)) */
148#define JS_HAS_EXPR_CLOSURES    0       /* has function (formals) listexpr */
149
150#elif JS_VERSION == 170
151
152#define JS_HAS_STR_HTML_HELPERS 1       /* has str.anchor, str.bold, etc. */
153#define JS_HAS_PERL_SUBSTR      1       /* has str.substr */
154#define JS_HAS_OBJ_PROTO_PROP   1       /* has o.__proto__ etc. */
155#define JS_HAS_OBJ_WATCHPOINT   1       /* has o.watch and o.unwatch */
156#define JS_HAS_XDR              1       /* has XDR API and internal support */
157#define JS_HAS_TOSOURCE         1       /* has Object/Array toSource method */
158#define JS_HAS_CATCH_GUARD      1       /* has exception handling catch guard */
159#define JS_HAS_SPARSE_ARRAYS    0       /* array methods preserve empty elems */
160#define JS_HAS_UNEVAL           1       /* has uneval() top-level function */
161#define JS_HAS_CONST            1       /* has JS2 const as alternative var */
162#define JS_HAS_FUN_EXPR_STMT    1       /* has function expression statement */
163#define JS_HAS_NO_SUCH_METHOD   1       /* has o.__noSuchMethod__ handler */
164#define JS_HAS_XML_SUPPORT      1       /* has ECMAScript for XML support */
165#define JS_HAS_GENERATORS       1       /* has yield in generator function */
166#define JS_HAS_BLOCK_SCOPE      1       /* has block scope via let/arraycomp */
167#define JS_HAS_DESTRUCTURING    1       /* has [a,b] = ... or {p:a,q:b} = ... */
168#define JS_HAS_GENERATOR_EXPRS  0       /* has (expr for (lhs in iterable)) */
169#define JS_HAS_EXPR_CLOSURES    0       /* has function (formals) listexpr */
170
171#elif 180 <= JS_VERSION && JS_VERSION <= 185
172
173#define JS_HAS_STR_HTML_HELPERS 1       /* has str.anchor, str.bold, etc. */
174#define JS_HAS_PERL_SUBSTR      1       /* has str.substr */
175#define JS_HAS_OBJ_PROTO_PROP   1       /* has o.__proto__ etc. */
176#define JS_HAS_OBJ_WATCHPOINT   1       /* has o.watch and o.unwatch */
177#define JS_HAS_XDR              1       /* has XDR API and internal support */
178#define JS_HAS_TOSOURCE         1       /* has Object/Array toSource method */
179#define JS_HAS_CATCH_GUARD      1       /* has exception handling catch guard */
180#define JS_HAS_SPARSE_ARRAYS    0       /* array methods preserve empty elems */
181#define JS_HAS_UNEVAL           1       /* has uneval() top-level function */
182#define JS_HAS_CONST            1       /* has JS2 const as alternative var */
183#define JS_HAS_FUN_EXPR_STMT    1       /* has function expression statement */
184#define JS_HAS_NO_SUCH_METHOD   1       /* has o.__noSuchMethod__ handler */
185#define JS_HAS_XML_SUPPORT      1       /* has ECMAScript for XML support */
186#define JS_HAS_GENERATORS       1       /* has yield in generator function */
187#define JS_HAS_BLOCK_SCOPE      1       /* has block scope via let/arraycomp */
188#define JS_HAS_DESTRUCTURING    2       /* has [a,b] = ... or {p:a,q:b} = ... */
189#define JS_HAS_GENERATOR_EXPRS  1       /* has (expr for (lhs in iterable)) */
190#define JS_HAS_EXPR_CLOSURES    1       /* has function (formals) listexpr */
191
192#else
193
194#error "unknown JS_VERSION"
195
196#endif
197
198/* Support for JS_NewGlobalObject. */
199#define JS_HAS_NEW_GLOBAL_OBJECT        1
200
201/* Support for JS_MakeSystemObject. */
202#define JS_HAS_MAKE_SYSTEM_OBJECT       1
203
204/* Feature-test macro for evolving destructuring support. */
205#define JS_HAS_DESTRUCTURING_SHORTHAND  (JS_HAS_DESTRUCTURING == 2)
206
207/*
208 * Feature for Object.prototype.__{define,lookup}{G,S}etter__ legacy support;
209 * support likely to be made opt-in at some future time.
210 */
211#define OLD_GETTER_SETTER_METHODS       1