1/* 2 * Copyright (C) 2003, 2007, 2009 Apple Inc. All rights reserved. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 * 19 */ 20 21#ifndef CommonIdentifiers_h 22#define CommonIdentifiers_h 23 24#include "Identifier.h" 25#include <wtf/Noncopyable.h> 26 27// MarkedArgumentBuffer of property names, passed to a macro so we can do set them up various 28// ways without repeating the list. 29#define JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \ 30 macro(ArgumentsIterator) \ 31 macro(Array) \ 32 macro(ArrayBuffer) \ 33 macro(ArrayIterator) \ 34 macro(BYTES_PER_ELEMENT) \ 35 macro(Boolean) \ 36 macro(Date) \ 37 macro(Error) \ 38 macro(EvalError) \ 39 macro(Function) \ 40 macro(Infinity) \ 41 macro(JSON) \ 42 macro(Map)\ 43 macro(MapIterator)\ 44 macro(Math) \ 45 macro(NaN) \ 46 macro(Number) \ 47 macro(Object) \ 48 macro(Promise) \ 49 macro(RangeError) \ 50 macro(ReferenceError) \ 51 macro(RegExp) \ 52 macro(Set)\ 53 macro(SetIterator)\ 54 macro(String) \ 55 macro(SyntaxError) \ 56 macro(TypeError) \ 57 macro(URIError) \ 58 macro(UTC) \ 59 macro(WeakMap)\ 60 macro(__defineGetter__) \ 61 macro(__defineSetter__) \ 62 macro(__lookupGetter__) \ 63 macro(__lookupSetter__) \ 64 macro(add) \ 65 macro(anonymous) \ 66 macro(arguments) \ 67 macro(assign) \ 68 macro(back) \ 69 macro(bind) \ 70 macro(blur) \ 71 macro(buffer) \ 72 macro(byteLength) \ 73 macro(byteOffset) \ 74 macro(bytecode) \ 75 macro(bytecodeIndex) \ 76 macro(bytecodes) \ 77 macro(bytecodesID) \ 78 macro(callee) \ 79 macro(caller) \ 80 macro(cast) \ 81 macro(clear) \ 82 macro(close) \ 83 macro(closed) \ 84 macro(compilationKind) \ 85 macro(compilations) \ 86 macro(compile) \ 87 macro(configurable) \ 88 macro(constructor) \ 89 macro(count) \ 90 macro(counters) \ 91 macro(description) \ 92 macro(descriptions) \ 93 macro(displayName) \ 94 macro(document) \ 95 macro(done) \ 96 macro(entries) \ 97 macro(enumerable) \ 98 macro(eval) \ 99 macro(exec) \ 100 macro(executionCount) \ 101 macro(exitKind) \ 102 macro(focus) \ 103 macro(forEach) \ 104 macro(forward) \ 105 macro(fromCharCode) \ 106 macro(get) \ 107 macro(global) \ 108 macro(go) \ 109 macro(has) \ 110 macro(hasOwnProperty) \ 111 macro(hash) \ 112 macro(header) \ 113 macro(href) \ 114 macro(id) \ 115 macro(ignoreCase) \ 116 macro(index) \ 117 macro(inferredName) \ 118 macro(input) \ 119 macro(instructionCount) \ 120 macro(isArray) \ 121 macro(isPrototypeOf) \ 122 macro(isView) \ 123 macro(isWatchpoint) \ 124 macro(jettisonReason) \ 125 macro(join) \ 126 macro(keys) \ 127 macro(lastIndex) \ 128 macro(length) \ 129 macro(message) \ 130 macro(multiline) \ 131 macro(name) \ 132 macro(next) \ 133 macro(now) \ 134 macro(numInlinedCalls) \ 135 macro(numInlinedGetByIds) \ 136 macro(numInlinedPutByIds) \ 137 macro(of) \ 138 macro(opcode) \ 139 macro(origin) \ 140 macro(osrExitSites) \ 141 macro(osrExits) \ 142 macro(parse) \ 143 macro(postMessage) \ 144 macro(profiledBytecodes) \ 145 macro(propertyIsEnumerable) \ 146 macro(prototype) \ 147 macro(reload) \ 148 macro(replace) \ 149 macro(set) \ 150 macro(showModalDialog) \ 151 macro(size) \ 152 macro(slice) \ 153 macro(source) \ 154 macro(sourceCode) \ 155 macro(stack) \ 156 macro(subarray) \ 157 macro(test) \ 158 macro(then) \ 159 macro(toExponential) \ 160 macro(toFixed) \ 161 macro(toISOString) \ 162 macro(toJSON) \ 163 macro(toLocaleString) \ 164 macro(toPrecision) \ 165 macro(toString) \ 166 macro(value) \ 167 macro(valueOf) \ 168 macro(values) \ 169 macro(webkit) \ 170 macro(window) \ 171 macro(writable) 172 173#define JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(macro) \ 174 macro(break) \ 175 macro(case) \ 176 macro(catch) \ 177 macro(class) \ 178 macro(const) \ 179 macro(continue) \ 180 macro(debugger) \ 181 macro(default) \ 182 macro(delete) \ 183 macro(do) \ 184 macro(else) \ 185 macro(enum) \ 186 macro(export) \ 187 macro(extends) \ 188 macro(false) \ 189 macro(finally) \ 190 macro(for) \ 191 macro(function) \ 192 macro(if) \ 193 macro(implements) \ 194 macro(import) \ 195 macro(in) \ 196 macro(instanceof) \ 197 macro(interface) \ 198 macro(let) \ 199 macro(new) \ 200 macro(null) \ 201 macro(package) \ 202 macro(private) \ 203 macro(protected) \ 204 macro(public) \ 205 macro(return) \ 206 macro(static) \ 207 macro(super) \ 208 macro(switch) \ 209 macro(this) \ 210 macro(throw) \ 211 macro(true) \ 212 macro(try) \ 213 macro(typeof) \ 214 macro(undefined) \ 215 macro(var) \ 216 macro(void) \ 217 macro(while) \ 218 macro(with) \ 219 macro(yield) 220 221#define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \ 222 macro(iterator) \ 223 macro(iteratorNext) \ 224 macro(resolve) \ 225 macro(reject) \ 226 macro(promise) \ 227 macro(fulfillmentHandler) \ 228 macro(rejectionHandler) \ 229 macro(index) \ 230 macro(values) \ 231 macro(deferred) \ 232 macro(countdownHolder) \ 233 macro(Object) \ 234 macro(TypeError) \ 235 macro(undefined) \ 236 macro(BuiltinLog) 237 238namespace JSC { 239 240 class BuiltinNames; 241 242 class CommonIdentifiers { 243 WTF_MAKE_NONCOPYABLE(CommonIdentifiers); WTF_MAKE_FAST_ALLOCATED; 244 private: 245 CommonIdentifiers(VM*); 246 ~CommonIdentifiers(); 247 friend class VM; 248 249 public: 250 const BuiltinNames& builtinNames() const { return *m_builtinNames; } 251 const Identifier nullIdentifier; 252 const Identifier emptyIdentifier; 253 const Identifier underscoreProto; 254 const Identifier thisIdentifier; 255 const Identifier useStrictIdentifier; 256 private: 257 std::unique_ptr<BuiltinNames> m_builtinNames; 258 259 public: 260 261#define JSC_IDENTIFIER_DECLARE_KEYWORD_NAME_GLOBAL(name) const Identifier name##Keyword; 262 JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(JSC_IDENTIFIER_DECLARE_KEYWORD_NAME_GLOBAL) 263#undef JSC_IDENTIFIER_DECLARE_KEYWORD_NAME_GLOBAL 264 265#define JSC_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL(name) const Identifier name; 266 JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(JSC_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL) 267#undef JSC_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL 268 269#define JSC_IDENTIFIER_DECLARE_PRIVATE_PROPERTY_NAME_GLOBAL(name) const Identifier name##PrivateName; 270 JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(JSC_IDENTIFIER_DECLARE_PRIVATE_PROPERTY_NAME_GLOBAL) 271#undef JSC_IDENTIFIER_DECLARE_PRIVATE_PROPERTY_NAME_GLOBAL 272 273 const Identifier* getPrivateName(const Identifier&) const; 274 Identifier getPublicName(const Identifier&) const; 275 }; 276 277} // namespace JSC 278 279#endif // CommonIdentifiers_h 280