]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/CommonIdentifiers.cpp
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / runtime / CommonIdentifiers.cpp
index 3837817d052f78ece061ac6de717104defb7b7eb..21bc4c7cefde867d8ab51c572be15979be8120f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 2003, 2007, 2009 Apple Inc. All rights reserved.
+ *  Copyright (C) 2003, 2007, 2009, 2012 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
 #include "config.h"
 #include "CommonIdentifiers.h"
 
-namespace JSC {
+#include "BuiltinNames.h"
+#include "IdentifierInlines.h"
+#include "JSCBuiltins.h"
+#include "PrivateName.h"
 
-static const char* const nullCString = 0;
+namespace JSC {
 
-#define INITIALIZE_PROPERTY_NAME(name) , name(globalData, #name)
+#define INITIALIZE_PROPERTY_NAME(name) , name(Identifier::fromString(vm, #name))
+#define INITIALIZE_KEYWORD(name) , name##Keyword(Identifier::fromString(vm, #name))
+#define INITIALIZE_PRIVATE_NAME(name) , name##PrivateName(m_builtinNames->name##PrivateName())
+#define INITIALIZE_SYMBOL(name) , name##Symbol(m_builtinNames->name##Symbol())
 
-CommonIdentifiers::CommonIdentifiers(JSGlobalData* globalData)
-    : nullIdentifier(globalData, nullCString)
-    , emptyIdentifier(globalData, "")
-    , underscoreProto(globalData, "__proto__")
-    , thisIdentifier(globalData, "this")
+CommonIdentifiers::CommonIdentifiers(VM* vm)
+    : nullIdentifier()
+    , emptyIdentifier(Identifier::EmptyIdentifier)
+    , underscoreProto(Identifier::fromString(vm, "__proto__"))
+    , thisIdentifier(Identifier::fromString(vm, "this"))
+    , useStrictIdentifier(Identifier::fromString(vm, "use strict"))
+    , m_builtinNames(new BuiltinNames(vm, this))
+    JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(INITIALIZE_KEYWORD)
     JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PROPERTY_NAME)
+    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PRIVATE_NAME)
+    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALIZE_SYMBOL)
+    , m_bytecodeIntrinsicRegistry(*this)
+{
+}
+
+CommonIdentifiers::~CommonIdentifiers()
+{
+}
+
+bool CommonIdentifiers::isPrivateName(SymbolImpl& uid) const
+{
+    return m_builtinNames->isPrivateName(uid);
+}
+
+bool CommonIdentifiers::isPrivateName(UniquedStringImpl& uid) const
+{
+    return m_builtinNames->isPrivateName(uid);
+}
+
+bool CommonIdentifiers::isPrivateName(const Identifier& ident) const
+{
+    return m_builtinNames->isPrivateName(ident);
+}
+
+const Identifier* CommonIdentifiers::getPrivateName(const Identifier& ident) const
 {
+    return m_builtinNames->getPrivateName(ident);
 }
+    
+Identifier CommonIdentifiers::getPublicName(const Identifier& ident) const
+{
+    return m_builtinNames->getPublicName(ident);
+}
+
 
 } // namespace JSC