summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime/Identifier.h
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/runtime/Identifier.h')
-rw-r--r--JavaScriptCore/runtime/Identifier.h87
1 files changed, 11 insertions, 76 deletions
diff --git a/JavaScriptCore/runtime/Identifier.h b/JavaScriptCore/runtime/Identifier.h
index 1d1bd18..2f16bbf 100644
--- a/JavaScriptCore/runtime/Identifier.h
+++ b/JavaScriptCore/runtime/Identifier.h
@@ -54,9 +54,9 @@ namespace JSC {
const char* ascii() const { return _ustring.ascii(); }
- static Identifier from(ExecState* exec, unsigned y) { return Identifier(exec, UString::from(y)); }
- static Identifier from(ExecState* exec, int y) { return Identifier(exec, UString::from(y)); }
- static Identifier from(ExecState* exec, double y) { return Identifier(exec, UString::from(y)); }
+ static Identifier from(ExecState* exec, unsigned y);
+ static Identifier from(ExecState* exec, int y);
+ static Identifier from(ExecState* exec, double y);
bool isNull() const { return _ustring.isNull(); }
bool isEmpty() const { return _ustring.isEmpty(); }
@@ -73,11 +73,9 @@ namespace JSC {
friend bool operator==(const Identifier&, const char*);
friend bool operator!=(const Identifier&, const char*);
- static void remove(UString::Rep*);
-
static bool equal(const UString::Rep*, const char*);
- static bool equal(const UString::Rep*, const UChar*, int length);
- static bool equal(const UString::Rep* a, const UString::Rep* b) { return JSC::equal(a, b); }
+ static bool equal(const UString::Rep*, const UChar*, unsigned length);
+ static bool equal(const UString::Rep* a, const UString::Rep* b) { return ::equal(a, b); }
static PassRefPtr<UString::Rep> add(ExecState*, const char*); // Only to be used with string literals.
static PassRefPtr<UString::Rep> add(JSGlobalData*, const char*); // Only to be used with string literals.
@@ -93,30 +91,28 @@ namespace JSC {
static PassRefPtr<UString::Rep> add(ExecState* exec, UString::Rep* r)
{
- if (r->isIdentifier()) {
#ifndef NDEBUG
- checkSameIdentifierTable(exec, r);
+ checkCurrentIdentifierTable(exec);
#endif
+ if (r->isIdentifier())
return r;
- }
return addSlowCase(exec, r);
}
static PassRefPtr<UString::Rep> add(JSGlobalData* globalData, UString::Rep* r)
{
- if (r->isIdentifier()) {
#ifndef NDEBUG
- checkSameIdentifierTable(globalData, r);
+ checkCurrentIdentifierTable(globalData);
#endif
+ if (r->isIdentifier())
return r;
- }
return addSlowCase(globalData, r);
}
static PassRefPtr<UString::Rep> addSlowCase(ExecState*, UString::Rep* r);
static PassRefPtr<UString::Rep> addSlowCase(JSGlobalData*, UString::Rep* r);
- static void checkSameIdentifierTable(ExecState*, UString::Rep*);
- static void checkSameIdentifierTable(JSGlobalData*, UString::Rep*);
+ static void checkCurrentIdentifierTable(ExecState*);
+ static void checkCurrentIdentifierTable(JSGlobalData*);
};
inline bool operator==(const Identifier& a, const Identifier& b)
@@ -142,67 +138,6 @@ namespace JSC {
IdentifierTable* createIdentifierTable();
void deleteIdentifierTable(IdentifierTable*);
- struct ThreadIdentifierTableData {
- ThreadIdentifierTableData()
- : defaultIdentifierTable(0)
- , currentIdentifierTable(0)
- {
- }
-
- IdentifierTable* defaultIdentifierTable;
- IdentifierTable* currentIdentifierTable;
- };
-
- extern WTF::ThreadSpecific<ThreadIdentifierTableData>* g_identifierTableSpecific;
- void createIdentifierTableSpecific();
-
- inline IdentifierTable* defaultIdentifierTable()
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- return data.defaultIdentifierTable;
- }
-
- inline void setDefaultIdentifierTable(IdentifierTable* identifierTable)
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- data.defaultIdentifierTable = identifierTable;
- }
-
- inline IdentifierTable* currentIdentifierTable()
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- return data.currentIdentifierTable;
- }
-
- inline IdentifierTable* setCurrentIdentifierTable(IdentifierTable* identifierTable)
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- IdentifierTable* oldIdentifierTable = data.currentIdentifierTable;
- data.currentIdentifierTable = identifierTable;
- return oldIdentifierTable;
- }
-
- inline void resetCurrentIdentifierTable()
- {
- if (!g_identifierTableSpecific)
- createIdentifierTableSpecific();
- ThreadIdentifierTableData& data = **g_identifierTableSpecific;
-
- data.currentIdentifierTable = data.defaultIdentifierTable;
- }
-
} // namespace JSC
#endif // Identifier_h