Changeset 32652 in webkit for trunk/JavaScriptCore
- Timestamp:
- Apr 28, 2008, 11:22:14 AM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackConstructor.cpp
r29663 r32652 35 35 namespace KJS { 36 36 37 const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0 };37 const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 }; 38 38 39 39 JSCallbackConstructor::JSCallbackConstructor(ExecState* exec, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback) -
trunk/JavaScriptCore/API/JSCallbackFunction.cpp
r29663 r32652 37 37 namespace KJS { 38 38 39 const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunctionImp::info, 0 };39 const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunctionImp::info, 0, 0 }; 40 40 41 41 JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSObjectCallAsFunctionCallback callback, const Identifier& name) -
trunk/JavaScriptCore/API/JSCallbackObject.cpp
r29663 r32652 34 34 35 35 // Define the two types of JSCallbackObjects we support. 36 template <> const ClassInfo JSCallbackObject<JSObject>::info = { "CallbackObject", 0, 0 };37 template <> const ClassInfo JSCallbackObject<JSGlobalObject>::info = { "CallbackGlobalObject", 0, 0 };36 template <> const ClassInfo JSCallbackObject<JSObject>::info = { "CallbackObject", 0, 0, 0 }; 37 template <> const ClassInfo JSCallbackObject<JSGlobalObject>::info = { "CallbackGlobalObject", 0, 0, 0 }; 38 38 39 39 COMPILE_ASSERT(sizeof(JSCallbackObject<JSGlobalObject>) <= CELL_SIZE, global_callback_object_fits_in_cell); -
trunk/JavaScriptCore/ChangeLog
r32650 r32652 1 2008-04-28 Alexey Proskuryakov <[email protected]> 2 3 Reviewed by Darin. 4 5 Fix run-webkit-tests --threading 6 and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661> 7 Proxy server issue in Sunday's Nightly 8 9 Changed ClassInfo objects for built-in objects to hold a getter function returning 10 a per-thread instance. This makes it safe to share these ClassInfo objects between threads - 11 and these are the only ones that need to be shared. 12 13 * kjs/lexer.cpp: 14 (KJS::Lexer::Lexer): 15 (KJS::Lexer::~Lexer): 16 * kjs/lexer.h: 17 Made mainTable a member of Lexer, so that it no longer needs to be shared between threads. 18 19 * kjs/object.cpp: 20 (KJS::JSObject::deleteProperty): 21 (KJS::JSObject::findPropertyHashEntry): 22 (KJS::JSObject::propertyIsEnumerable): 23 (KJS::JSObject::getPropertyAttributes): 24 (KJS::JSObject::getPropertyNames): 25 * kjs/object.h: 26 (KJS::ClassInfo::propHashTable): 27 Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the 28 static table is not used. 29 30 * kjs/JSGlobalObject.cpp: 31 (KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread 32 HashTables for built-in classes. The old static structs are copied to create per-thread 33 instances. 34 (KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above. 35 (KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access. 36 Also, construct globalExec. 37 (KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr. 38 (KJS::JSGlobalObject::mark): Ditto. 39 (KJS::JSGlobalObject::globalExec): Ditto. 40 * kjs/JSGlobalObject.h: 41 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can 42 be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was 43 trying to access half-initialized JSGlobalObject to make its own copy of these table 44 references, and failed. 45 (KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec. 46 (KJS::JSGlobalObject::perThreadData): An accessor for per-thread data. 47 48 * kjs/ExecState.cpp: 49 (KJS::ExecState::ExecState): 50 * kjs/ExecState.h: 51 (KJS::ExecState::propertyNames): 52 (KJS::ExecState::emptyList): 53 (KJS::ExecState::arrayTable): 54 (KJS::ExecState::dateTable): 55 (KJS::ExecState::mathTable): 56 (KJS::ExecState::numberTable): 57 (KJS::ExecState::RegExpImpTable): 58 (KJS::ExecState::RegExpObjectImpTable): 59 (KJS::ExecState::stringTable): 60 * kjs/ExecStateInlines.h: 61 (KJS::ExecState::ExecState): 62 Each ExecState holds its own reference to per-thread data, for even faster access. Moved 63 m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct 64 and take less space on the stack. 65 66 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data 67 added to JSGlobalObject. 68 69 * API/JSCallbackConstructor.cpp: 70 (KJS::): 71 * API/JSCallbackFunction.cpp: 72 (KJS::): 73 * API/JSCallbackObject.cpp: 74 (KJS::): 75 * JavaScriptCore.exp: 76 * kjs/JSVariableObject.cpp: 77 (KJS::JSVariableObject::getPropertyAttributes): 78 * kjs/JSVariableObject.h: 79 * kjs/array_instance.cpp: 80 (KJS::): 81 * kjs/array_object.cpp: 82 (KJS::): 83 (KJS::ArrayPrototype::getOwnPropertySlot): 84 * kjs/bool_object.cpp: 85 (KJS::): 86 * kjs/create_hash_table: 87 * kjs/date_object.cpp: 88 (KJS::): 89 (KJS::DatePrototype::getOwnPropertySlot): 90 (KJS::DateObjectImp::DateObjectImp): 91 * kjs/error_object.cpp: 92 (KJS::): 93 * kjs/function.cpp: 94 (KJS::): 95 * kjs/function_object.cpp: 96 (KJS::FunctionPrototype::FunctionPrototype): 97 * kjs/internal.cpp: 98 (KJS::): 99 * kjs/lookup.h: 100 * kjs/math_object.cpp: 101 (KJS::): 102 (KJS::MathObjectImp::getOwnPropertySlot): 103 * kjs/number_object.cpp: 104 (KJS::): 105 (KJS::NumberObjectImp::getOwnPropertySlot): 106 * kjs/object_object.cpp: 107 (KJS::ObjectPrototype::ObjectPrototype): 108 * kjs/regexp_object.cpp: 109 (KJS::): 110 (KJS::RegExpPrototype::RegExpPrototype): 111 (KJS::RegExpImp::getOwnPropertySlot): 112 (KJS::RegExpImp::put): 113 (KJS::RegExpObjectImp::getOwnPropertySlot): 114 (KJS::RegExpObjectImp::put): 115 * kjs/string_object.cpp: 116 (KJS::): 117 (KJS::StringPrototype::getOwnPropertySlot): 118 Adjust for the above changes. 119 1 120 2008-04-28 Darin Adler <[email protected]> 2 121 -
trunk/JavaScriptCore/JavaScriptCore.exp
r32609 r32652 108 108 __ZN3KJS14JSGlobalObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE 109 109 __ZN3KJS14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE 110 __ZN3KJS14JSGlobalObject4initE v110 __ZN3KJS14JSGlobalObject4initEPNS_8JSObjectE 111 111 __ZN3KJS14JSGlobalObject4markEv 112 112 __ZN3KJS14JSGlobalObject5resetEPNS_7JSValueE … … 121 121 __ZN3KJS14StringInstanceC2EPNS_8JSObjectERKNS_7UStringE 122 122 __ZN3KJS15GlobalExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectE 123 __ZN3KJS15GlobalExecStateD1Ev 123 124 __ZN3KJS15JSWrapperObject4markEv 124 125 __ZN3KJS16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE … … 238 239 __ZNK3KJS14JSGlobalObject14toGlobalObjectEPNS_9ExecStateE 239 240 __ZNK3KJS16JSVariableObject16isVariableObjectEv 240 __ZNK3KJS16JSVariableObject21getPropertyAttributesE RKNS_10IdentifierERj241 __ZNK3KJS16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj 241 242 __ZNK3KJS19InternalFunctionImp14implementsCallEv 242 243 __ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv … … 267 268 __ZNK3KJS8JSObject14toGlobalObjectEPNS_9ExecStateE 268 269 __ZNK3KJS8JSObject19implementsConstructEv 269 __ZNK3KJS8JSObject21getPropertyAttributesE RKNS_10IdentifierERj270 __ZNK3KJS8JSObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj 270 271 __ZNK3KJS8JSObject21implementsHasInstanceEv 271 272 __ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE -
trunk/JavaScriptCore/kjs/ExecState.cpp
r31746 r32652 34 34 namespace KJS { 35 35 36 static inline List* globalEmptyList()37 {38 static List staticEmptyList;39 return &staticEmptyList;40 }41 42 36 // ECMA 10.2 43 37 … … 46 40 : m_globalObject(globalObject) 47 41 , m_exception(0) 48 , m_propertyNames(CommonIdentifiers::shared())49 , m_emptyList(globalEmptyList())50 42 , m_callingExec(0) 43 , m_perThreadData(globalObject->perThreadData()) 51 44 , m_scopeNode(0) 52 45 , m_function(0) … … 68 61 : m_globalObject(globalObject) 69 62 , m_exception(0) 70 , m_propertyNames(CommonIdentifiers::shared())71 , m_emptyList(globalEmptyList())72 63 , m_callingExec(0) 64 , m_perThreadData(globalObject->perThreadData()) 73 65 , m_scopeNode(programNode) 74 66 , m_function(0) … … 91 83 : m_globalObject(globalObject) 92 84 , m_exception(0) 93 , m_propertyNames(callingExec->m_propertyNames)94 , m_emptyList(callingExec->m_emptyList)95 85 , m_callingExec(callingExec) 86 , m_perThreadData(callingExec->m_perThreadData) 96 87 , m_scopeNode(evalNode) 97 88 , m_function(0) -
trunk/JavaScriptCore/kjs/ExecState.h
r32259 r32652 39 39 class FunctionImp; 40 40 class GlobalFuncImp; 41 struct HashTable; 41 42 class Interpreter; 42 43 class JSGlobalObject; … … 46 47 47 48 enum CodeType { GlobalCode, EvalCode, FunctionCode }; 49 50 struct PerThreadData { 51 const HashTable* arrayTable; 52 const HashTable* dateTable; 53 const HashTable* mathTable; 54 const HashTable* numberTable; 55 const HashTable* RegExpImpTable; 56 const HashTable* RegExpObjectImpTable; 57 const HashTable* stringTable; 58 59 CommonIdentifiers* propertyNames; 60 const List emptyList; 61 }; 48 62 49 63 // Represents the current state of script execution. … … 97 111 // These pointers are used to avoid accessing global variables for these, 98 112 // to avoid taking PIC branches in Mach-O binaries. 99 const CommonIdentifiers& propertyNames() const { return *m_propertyNames; } 100 const List& emptyList() const { return *m_emptyList; } 113 const CommonIdentifiers& propertyNames() const { return *m_perThreadData->propertyNames; } 114 const List& emptyList() const { return m_perThreadData->emptyList; } 115 static const HashTable* arrayTable(ExecState* exec) { return exec->m_perThreadData->arrayTable; } 116 static const HashTable* dateTable(ExecState* exec) { return exec->m_perThreadData->dateTable; } 117 static const HashTable* mathTable(ExecState* exec) { return exec->m_perThreadData->mathTable; } 118 static const HashTable* numberTable(ExecState* exec) { return exec->m_perThreadData->numberTable; } 119 static const HashTable* RegExpImpTable(ExecState* exec) { return exec->m_perThreadData->RegExpImpTable; } 120 static const HashTable* RegExpObjectImpTable(ExecState* exec) { return exec->m_perThreadData->RegExpObjectImpTable; } 121 static const HashTable* stringTable(ExecState* exec) { return exec->m_perThreadData->stringTable; } 101 122 102 123 LocalStorage& localStorage() { return *m_localStorage; } … … 177 198 JSGlobalObject* m_globalObject; 178 199 JSValue* m_exception; 179 CommonIdentifiers* m_propertyNames;180 const List* m_emptyList;181 200 182 201 ExecState* m_callingExec; 202 203 const PerThreadData* m_perThreadData; 183 204 184 205 ScopeNode* m_scopeNode; -
trunk/JavaScriptCore/kjs/ExecStateInlines.h
r31746 r32652 36 36 : m_globalObject(globalObject) 37 37 , m_exception(0) 38 , m_propertyNames(callingExec->m_propertyNames)39 , m_emptyList(callingExec->m_emptyList)40 38 , m_callingExec(callingExec) 39 , m_perThreadData(callingExec->m_perThreadData) 41 40 , m_scopeNode(functionBodyNode) 42 41 , m_function(func) -
trunk/JavaScriptCore/kjs/InitializeThreading.cpp
r32322 r32652 34 34 #include "dtoa.h" 35 35 #include "identifier.h" 36 #include "JSGlobalObject.h" 36 37 #include "lexer.h" 37 38 #include "Parser.h" … … 55 56 lexer(); 56 57 initDateMath(); 58 JSGlobalObject::threadClassInfoHashTables(); 57 59 } 58 60 #endif -
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r32587 r32652 45 45 #include "string_object.h" 46 46 47 #if USE(MULTIPLE_THREADS) 48 #include <wtf/ThreadSpecific.h> 49 using namespace WTF; 50 #endif 51 47 52 #if HAVE(SYS_TIME_H) 48 53 #include <sys/time.h> … … 58 63 59 64 namespace KJS { 65 66 extern HashTable arrayTable; 67 extern HashTable dateTable; 68 extern HashTable mathTable; 69 extern HashTable numberTable; 70 extern HashTable RegExpImpTable; 71 extern HashTable RegExpObjectImpTable; 72 extern HashTable stringTable; 60 73 61 74 // Default number of ticks before a timeout check should be done. … … 119 132 } 120 133 121 void JSGlobalObject::init() 134 struct ThreadClassInfoHashTables { 135 ThreadClassInfoHashTables() 136 : arrayTable(KJS::arrayTable) 137 , dateTable(KJS::dateTable) 138 , mathTable(KJS::mathTable) 139 , numberTable(KJS::numberTable) 140 , RegExpImpTable(KJS::RegExpImpTable) 141 , RegExpObjectImpTable(KJS::RegExpObjectImpTable) 142 , stringTable(KJS::stringTable) 143 { 144 } 145 146 ~ThreadClassInfoHashTables() 147 { 148 #if USE(MULTIPLE_THREADS) 149 delete[] arrayTable.table; 150 delete[] dateTable.table; 151 delete[] mathTable.table; 152 delete[] numberTable.table; 153 delete[] RegExpImpTable.table; 154 delete[] RegExpObjectImpTable.table; 155 delete[] stringTable.table; 156 #endif 157 } 158 159 #if USE(MULTIPLE_THREADS) 160 HashTable arrayTable; 161 HashTable dateTable; 162 HashTable mathTable; 163 HashTable numberTable; 164 HashTable RegExpImpTable; 165 HashTable RegExpObjectImpTable; 166 HashTable stringTable; 167 #else 168 HashTable& arrayTable; 169 HashTable& dateTable; 170 HashTable& mathTable; 171 HashTable& numberTable; 172 HashTable& RegExpImpTable; 173 HashTable& RegExpObjectImpTable; 174 HashTable& stringTable; 175 #endif 176 }; 177 178 ThreadClassInfoHashTables* JSGlobalObject::threadClassInfoHashTables() 179 { 180 #if USE(MULTIPLE_THREADS) 181 static ThreadSpecific<ThreadClassInfoHashTables> sharedInstance; 182 return sharedInstance; 183 #else 184 static ThreadClassInfoHashTables sharedInstance; 185 return &sharedInstance; 186 #endif 187 } 188 189 void JSGlobalObject::init(JSObject* thisValue) 122 190 { 123 191 ASSERT(JSLock::currentThreadIsHoldingLock()); … … 142 210 d()->activations = newStackNode; 143 211 d()->activationCount = 0; 212 213 d()->perThreadData.arrayTable = &threadClassInfoHashTables()->arrayTable; 214 d()->perThreadData.dateTable = &threadClassInfoHashTables()->dateTable; 215 d()->perThreadData.mathTable = &threadClassInfoHashTables()->mathTable; 216 d()->perThreadData.numberTable = &threadClassInfoHashTables()->numberTable; 217 d()->perThreadData.RegExpImpTable = &threadClassInfoHashTables()->RegExpImpTable; 218 d()->perThreadData.RegExpObjectImpTable = &threadClassInfoHashTables()->RegExpObjectImpTable; 219 d()->perThreadData.stringTable = &threadClassInfoHashTables()->stringTable; 220 d()->perThreadData.propertyNames = CommonIdentifiers::shared(); 221 222 d()->globalExec.set(new GlobalExecState(this, thisValue)); 144 223 145 224 d()->pageGroupIdentifier = 0; … … 232 311 d()->evalFunction = 0; 233 312 234 ExecState* exec = &d()->globalExec;313 ExecState* exec = d()->globalExec.get(); 235 314 236 315 // Prototypes … … 419 498 (*it)->m_scopeChain.mark(); 420 499 421 markIfNeeded(d()->globalExec .exception());500 markIfNeeded(d()->globalExec->exception()); 422 501 423 502 markIfNeeded(d()->objectConstructor); … … 463 542 ExecState* JSGlobalObject::globalExec() 464 543 { 465 return &d()->globalExec;544 return d()->globalExec.get(); 466 545 } 467 546 … … 493 572 } 494 573 574 495 575 } // namespace KJS -
trunk/JavaScriptCore/kjs/JSGlobalObject.h
r32587 r32652 43 43 class FunctionObjectImp; 44 44 class FunctionPrototype; 45 struct HashTable; 45 46 class JSGlobalObject; 46 47 class NativeErrorImp; … … 68 69 class UriErrorPrototype; 69 70 struct ActivationStackNode; 71 struct ThreadClassInfoHashTables; 70 72 71 73 typedef Vector<ExecState*, 16> ExecStateStack; … … 76 78 77 79 struct JSGlobalObjectData : public JSVariableObjectData { 78 JSGlobalObjectData( JSGlobalObject* globalObject, JSObject* thisValue)80 JSGlobalObjectData() 79 81 : JSVariableObjectData(&inlineSymbolTable) 80 , globalExec(globalObject, thisValue)81 82 { 82 83 } … … 87 88 Debugger* debugger; 88 89 89 GlobalExecStateglobalExec;90 OwnPtr<GlobalExecState> globalExec; 90 91 int recursion; 91 92 … … 141 142 142 143 OwnPtr<HashSet<JSObject*> > arrayVisitedElements; // Global data shared by array prototype functions. 144 145 PerThreadData perThreadData; 143 146 }; 144 147 145 148 public: 146 149 JSGlobalObject() 147 : JSVariableObject(new JSGlobalObjectData (this, this))150 : JSVariableObject(new JSGlobalObjectData) 148 151 { 149 init( );152 init(this); 150 153 } 151 154 152 155 protected: 153 156 JSGlobalObject(JSValue* proto, JSObject* globalThisValue) 154 : JSVariableObject(proto, new JSGlobalObjectData (this, globalThisValue))157 : JSVariableObject(proto, new JSGlobalObjectData) 155 158 { 156 init( );159 init(globalThisValue); 157 160 } 158 161 … … 247 250 HashSet<JSObject*>& arrayVisitedElements() { if (!d()->arrayVisitedElements) d()->arrayVisitedElements.set(new HashSet<JSObject*>); return *d()->arrayVisitedElements; } 248 251 252 // Per-thread hash tables, cached on the global object for faster access. 253 const PerThreadData* perThreadData() const { return &d()->perThreadData; } 254 255 // Initialize and/or retrieve per-thread hash tables - use perThreadData() for faster access instead. 256 static ThreadClassInfoHashTables* threadClassInfoHashTables(); 257 249 258 private: 250 void init( );259 void init(JSObject* thisValue); 251 260 252 261 JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); } -
trunk/JavaScriptCore/kjs/JSVariableObject.cpp
r32609 r32652 54 54 } 55 55 56 bool JSVariableObject::getPropertyAttributes( const Identifier& propertyName, unsigned& attributes) const56 bool JSVariableObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const 57 57 { 58 58 size_t index = symbolTable().get(propertyName.ustring().rep()); … … 61 61 return true; 62 62 } 63 return JSObject::getPropertyAttributes( propertyName, attributes);63 return JSObject::getPropertyAttributes(exec, propertyName, attributes); 64 64 } 65 65 -
trunk/JavaScriptCore/kjs/JSVariableObject.h
r32609 r32652 51 51 virtual bool isDynamicScope() const = 0; 52 52 53 virtual bool getPropertyAttributes( const Identifier& propertyName, unsigned& attributes) const;53 virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; 54 54 55 55 protected: -
trunk/JavaScriptCore/kjs/array_instance.cpp
r32609 r32652 51 51 static const unsigned copyingSortCutoff = 50000; 52 52 53 const ClassInfo ArrayInstance::info = {"Array", 0, 0 };53 const ClassInfo ArrayInstance::info = {"Array", 0, 0, 0}; 54 54 55 55 static inline size_t storageSize(unsigned vectorLength) -
trunk/JavaScriptCore/kjs/array_object.cpp
r31807 r32652 39 39 // ------------------------------ ArrayPrototype ---------------------------- 40 40 41 const ClassInfo ArrayPrototype::info = {"Array", &ArrayInstance::info, &arrayTable};41 const ClassInfo ArrayPrototype::info = {"Array", &ArrayInstance::info, 0, ExecState::arrayTable}; 42 42 43 43 /* Source for array_object.lut.h … … 73 73 bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 74 74 { 75 return getStaticFunctionSlot<ArrayInstance>(exec, &arrayTable, this, propertyName, slot);75 return getStaticFunctionSlot<ArrayInstance>(exec, ExecState::arrayTable(exec), this, propertyName, slot); 76 76 } 77 77 -
trunk/JavaScriptCore/kjs/bool_object.cpp
r31730 r32652 31 31 // ------------------------------ BooleanInstance --------------------------- 32 32 33 const ClassInfo BooleanInstance::info = { "Boolean", 0, 0 };33 const ClassInfo BooleanInstance::info = { "Boolean", 0, 0, 0 }; 34 34 35 35 BooleanInstance::BooleanInstance(JSObject* proto) -
trunk/JavaScriptCore/kjs/create_hash_table
r31147 r32652 203 203 print " { 0, 0, 0, 0 }\n"; 204 204 print "};\n\n"; 205 print " const struct HashTable $name = ";205 print "extern const struct HashTable $name = "; 206 206 print "\{ ", $size - 1, ", $nameEntries, 0 \};\n\n"; 207 207 print "} // namespace\n"; -
trunk/JavaScriptCore/kjs/date_object.cpp
r31943 r32652 331 331 // ------------------------------ DateInstance ------------------------------ 332 332 333 const ClassInfo DateInstance::info = {"Date", 0, 0 };333 const ClassInfo DateInstance::info = {"Date", 0, 0, 0}; 334 334 335 335 DateInstance::DateInstance(JSObject *proto) … … 417 417 // ------------------------------ DatePrototype ----------------------------- 418 418 419 const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, &dateTable};419 const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState::dateTable}; 420 420 421 421 /* Source for date_object.lut.h … … 479 479 bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 480 480 { 481 return getStaticFunctionSlot<JSObject>(exec, &dateTable, this, propertyName, slot);481 return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), this, propertyName, slot); 482 482 } 483 483 … … 490 490 { 491 491 putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly); 492 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, CommonIdentifiers::shared()->parse), DontEnum);493 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, CommonIdentifiers::shared()->UTC), DontEnum);492 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, exec->propertyNames().parse), DontEnum); 493 putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, exec->propertyNames().UTC), DontEnum); 494 494 putDirect(exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum); 495 495 } -
trunk/JavaScriptCore/kjs/error_object.cpp
r30040 r32652 32 32 // ------------------------------ ErrorInstance ---------------------------- 33 33 34 const ClassInfo ErrorInstance::info = { "Error", 0, 0 };34 const ClassInfo ErrorInstance::info = { "Error", 0, 0, 0 }; 35 35 36 36 ErrorInstance::ErrorInstance(JSObject* prototype) … … 115 115 // ------------------------------ NativeErrorImp ------------------------------- 116 116 117 const ClassInfo NativeErrorImp::info = { "Function", &InternalFunctionImp::info, 0 };117 const ClassInfo NativeErrorImp::info = { "Function", &InternalFunctionImp::info, 0, 0 }; 118 118 119 119 NativeErrorImp::NativeErrorImp(ExecState* exec, FunctionPrototype* funcProto, NativeErrorPrototype* prot) -
trunk/JavaScriptCore/kjs/function.cpp
r32609 r32652 58 58 // ----------------------------- FunctionImp ---------------------------------- 59 59 60 const ClassInfo FunctionImp::info = { "Function", &InternalFunctionImp::info, 0 };60 const ClassInfo FunctionImp::info = { "Function", &InternalFunctionImp::info, 0, 0 }; 61 61 62 62 FunctionImp::FunctionImp(ExecState* exec, const Identifier& name, FunctionBodyNode* b, const ScopeChain& sc) … … 280 280 // ------------------------------ Arguments --------------------------------- 281 281 282 const ClassInfo Arguments::info = { "Arguments", 0, 0 };282 const ClassInfo Arguments::info = { "Arguments", 0, 0, 0 }; 283 283 284 284 // ECMA 10.1.8 … … 343 343 // ------------------------------ ActivationImp -------------------------------- 344 344 345 const ClassInfo ActivationImp::info = { "Activation", 0, 0 };345 const ClassInfo ActivationImp::info = { "Activation", 0, 0, 0 }; 346 346 347 347 ActivationImp::ActivationImp(const ActivationData& oldData, bool leaveRelic) -
trunk/JavaScriptCore/kjs/function_object.cpp
r31746 r32652 48 48 49 49 putDirectFunction(new PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 50 putDirectFunction(new PrototypeFunction(exec, this, 2, CommonIdentifiers::shared()->apply, functionProtoFuncApply), DontEnum);51 putDirectFunction(new PrototypeFunction(exec, this, 1, CommonIdentifiers::shared()->call, functionProtoFuncCall), DontEnum);50 putDirectFunction(new PrototypeFunction(exec, this, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum); 51 putDirectFunction(new PrototypeFunction(exec, this, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum); 52 52 } 53 53 -
trunk/JavaScriptCore/kjs/internal.cpp
r32609 r32652 221 221 // ------------------------------ InternalFunctionImp -------------------------- 222 222 223 const ClassInfo InternalFunctionImp::info = { "Function", 0, 0 };223 const ClassInfo InternalFunctionImp::info = { "Function", 0, 0, 0 }; 224 224 225 225 InternalFunctionImp::InternalFunctionImp() -
trunk/JavaScriptCore/kjs/lexer.cpp
r31948 r32652 89 89 , next2(0) 90 90 , next3(0) 91 , mainTable(KJS::mainTable) 91 92 { 92 93 m_buffer8.reserveCapacity(initialReadBufferCapacity); … … 94 95 m_strings.reserveCapacity(initialStringTableCapacity); 95 96 m_identifiers.reserveCapacity(initialStringTableCapacity); 97 } 98 99 Lexer::~Lexer() 100 { 101 delete[] mainTable.table; 96 102 } 97 103 -
trunk/JavaScriptCore/kjs/lexer.h
r31944 r32652 25 25 #define Lexer_h 26 26 27 #include "lookup.h" 27 28 #include "ustring.h" 28 29 #include <wtf/Vector.h> … … 95 96 friend class WTF::ThreadSpecific<Lexer>; 96 97 Lexer(); 98 ~Lexer(); 97 99 98 100 int yylineno; … … 146 148 UString m_pattern; 147 149 UString m_flags; 150 151 const HashTable mainTable; 148 152 }; 149 153 -
trunk/JavaScriptCore/kjs/lookup.h
r31208 r32652 282 282 283 283 #define KJS_IMPLEMENT_PROTOTYPE(ClassName, ClassPrototype) \ 284 const ClassInfo ClassPrototype::info = { ClassName"Prototype", 0, &ClassPrototype##Table }; \284 const ClassInfo ClassPrototype::info = { ClassName"Prototype", 0, &ClassPrototype##Table, 0 }; \ 285 285 JSObject* ClassPrototype::self(ExecState* exec) \ 286 286 { \ -
trunk/JavaScriptCore/kjs/math_object.cpp
r31560 r32652 32 32 // ------------------------------ MathObjectImp -------------------------------- 33 33 34 const ClassInfo MathObjectImp::info = { "Math", 0, &mathTable };34 const ClassInfo MathObjectImp::info = { "Math", 0, 0, ExecState::mathTable }; 35 35 36 36 /* Source for math_object.lut.h … … 74 74 bool MathObjectImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot) 75 75 { 76 return getStaticPropertySlot<MathObjectImp, JSObject>(exec, &mathTable, this, propertyName, slot);76 return getStaticPropertySlot<MathObjectImp, JSObject>(exec, ExecState::mathTable(exec), this, propertyName, slot); 77 77 } 78 78 -
trunk/JavaScriptCore/kjs/number_object.cpp
r31948 r32652 35 35 // ------------------------------ NumberInstance ---------------------------- 36 36 37 const ClassInfo NumberInstance::info = { "Number", 0, 0 };37 const ClassInfo NumberInstance::info = { "Number", 0, 0, 0 }; 38 38 39 39 NumberInstance::NumberInstance(JSObject* proto) … … 451 451 // ------------------------------ NumberObjectImp ------------------------------ 452 452 453 const ClassInfo NumberObjectImp::info = { "Function", &InternalFunctionImp::info, &numberTable };453 const ClassInfo NumberObjectImp::info = { "Function", &InternalFunctionImp::info, 0, ExecState::numberTable }; 454 454 455 455 /* Source for number_object.lut.h … … 474 474 bool NumberObjectImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 475 475 { 476 return getStaticValueSlot<NumberObjectImp, InternalFunctionImp>(exec, &numberTable, this, propertyName, slot);476 return getStaticValueSlot<NumberObjectImp, InternalFunctionImp>(exec, ExecState::numberTable(exec), this, propertyName, slot); 477 477 } 478 478 -
trunk/JavaScriptCore/kjs/object.cpp
r32609 r32652 28 28 #include "date_object.h" 29 29 #include "error_object.h" 30 #include "lookup.h"31 30 #include "nodes.h" 32 31 #include "operations.h" … … 319 318 320 319 // ECMA 8.6.2.5 321 bool JSObject::deleteProperty(ExecState* /*exec*/, const Identifier &propertyName)320 bool JSObject::deleteProperty(ExecState* exec, const Identifier &propertyName) 322 321 { 323 322 unsigned attributes; … … 333 332 334 333 // Look in the static hashtable of properties 335 const HashEntry* entry = findPropertyHashEntry( propertyName);334 const HashEntry* entry = findPropertyHashEntry(exec, propertyName); 336 335 if (entry && entry->attributes & DontDelete) 337 336 return false; // this builtin property can't be deleted … … 396 395 } 397 396 398 const HashEntry* JSObject::findPropertyHashEntry( const Identifier& propertyName) const397 const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifier& propertyName) const 399 398 { 400 399 for (const ClassInfo* info = classInfo(); info; info = info->parentClass) { 401 if (const HashTable* propHashTable = info->propHashTable ) {400 if (const HashTable* propHashTable = info->propHashTable(exec)) { 402 401 if (const HashEntry* e = propHashTable->entry(propertyName)) 403 402 return e; … … 530 529 } 531 530 532 bool JSObject::propertyIsEnumerable(ExecState* , const Identifier& propertyName) const531 bool JSObject::propertyIsEnumerable(ExecState* exec, const Identifier& propertyName) const 533 532 { 534 533 unsigned attributes; 535 534 536 if (!getPropertyAttributes( propertyName, attributes))535 if (!getPropertyAttributes(exec, propertyName, attributes)) 537 536 return false; 538 537 else … … 540 539 } 541 540 542 bool JSObject::getPropertyAttributes( const Identifier& propertyName, unsigned& attributes) const541 bool JSObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const 543 542 { 544 543 if (_prop.get(propertyName, attributes)) … … 546 545 547 546 // Look in the static hashtable of properties 548 const HashEntry* e = findPropertyHashEntry( propertyName);547 const HashEntry* e = findPropertyHashEntry(exec, propertyName); 549 548 if (e) { 550 549 attributes = e->attributes; … … 561 560 // Add properties from the static hashtables of properties 562 561 for (const ClassInfo* info = classInfo(); info; info = info->parentClass) { 563 const HashTable* table = info->propHashTable ;562 const HashTable* table = info->propHashTable(exec); 564 563 if (!table) 565 564 continue; -
trunk/JavaScriptCore/kjs/object.h
r32587 r32652 66 66 /** 67 67 * Static hash-table of properties. 68 */ 69 const HashTable* propHashTable; 68 * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value. 69 */ 70 const HashTable* propHashTable(ExecState* exec) const 71 { 72 if (classPropHashTableGetterFunction) 73 return classPropHashTableGetterFunction(exec); 74 return staticPropHashTable; 75 } 76 77 const HashTable* staticPropHashTable; 78 typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*); 79 const ClassPropHashTableGetterFunction classPropHashTableGetterFunction; 70 80 }; 71 81 … … 146 156 * 147 157 * \code 148 * const ClassInfo BarImp::info = { "Bar", 0, 0 }; // no parent class149 * const ClassInfo FooImp::info = { "Foo", &BarImp::info, 0 };158 * const ClassInfo BarImp::info = { "Bar", 0, 0, 0 }; // no parent class 159 * const ClassInfo FooImp::info = { "Foo", &BarImp::info, 0, 0 }; 150 160 * \endcode 151 161 * … … 410 420 virtual JSGlobalObject* toGlobalObject(ExecState*) const; 411 421 412 virtual bool getPropertyAttributes( const Identifier& propertyName, unsigned& attributes) const;422 virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; 413 423 414 424 // WebCore uses this to make document.all and style.filter undetectable … … 444 454 445 455 private: 446 const HashEntry* findPropertyHashEntry( const Identifier& propertyName) const;456 const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const; 447 457 JSValue *_proto; 448 458 }; -
trunk/JavaScriptCore/kjs/object_object.cpp
r31746 r32652 47 47 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum); 48 48 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum); 49 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);50 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);51 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);49 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum); 50 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum); 51 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum); 52 52 53 53 // Mozilla extensions 54 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, CommonIdentifiers::shared()->__defineGetter__, objectProtoFuncDefineGetter), DontEnum);55 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, CommonIdentifiers::shared()->__defineSetter__, objectProtoFuncDefineSetter), DontEnum);56 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);57 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);54 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum); 55 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum); 56 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum); 57 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum); 58 58 } 59 59 -
trunk/JavaScriptCore/kjs/regexp_object.cpp
r31208 r32652 47 47 // ECMA 15.10.5 48 48 49 const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0 };49 const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0, 0 }; 50 50 51 51 RegExpPrototype::RegExpPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype) 52 52 : JSObject(objectPrototype) 53 53 { 54 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->compile, regExpProtoFuncCompile), DontEnum);55 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->exec, regExpProtoFuncExec), DontEnum);56 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->test, regExpProtoFuncTest), DontEnum);54 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum); 55 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum); 56 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum); 57 57 putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum); 58 58 } … … 123 123 // ------------------------------ RegExpImp ------------------------------------ 124 124 125 const ClassInfo RegExpImp::info = { "RegExp", 0, &RegExpImpTable };125 const ClassInfo RegExpImp::info = { "RegExp", 0, 0, ExecState::RegExpImpTable }; 126 126 127 127 /* Source for regexp_object.lut.h … … 148 148 bool RegExpImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 149 149 { 150 return getStaticValueSlot<RegExpImp, JSObject>(exec, &RegExpImpTable, this, propertyName, slot);150 return getStaticValueSlot<RegExpImp, JSObject>(exec, ExecState::RegExpImpTable(exec), this, propertyName, slot); 151 151 } 152 152 … … 172 172 void RegExpImp::put(ExecState* exec, const Identifier& propertyName, JSValue* value) 173 173 { 174 lookupPut<RegExpImp, JSObject>(exec, propertyName, value, &RegExpImpTable, this);174 lookupPut<RegExpImp, JSObject>(exec, propertyName, value, ExecState::RegExpImpTable(exec), this); 175 175 } 176 176 … … 243 243 // ------------------------------ RegExpObjectImp ------------------------------ 244 244 245 const ClassInfo RegExpObjectImp::info = { "Function", &InternalFunctionImp::info, &RegExpObjectImpTable };245 const ClassInfo RegExpObjectImp::info = { "Function", &InternalFunctionImp::info, 0, ExecState::RegExpObjectImpTable }; 246 246 247 247 /* Source for regexp_object.lut.h … … 364 364 bool RegExpObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 365 365 { 366 return getStaticValueSlot<RegExpObjectImp, InternalFunctionImp>(exec, &RegExpObjectImpTable, this, propertyName, slot);366 return getStaticValueSlot<RegExpObjectImp, InternalFunctionImp>(exec, ExecState::RegExpObjectImpTable(exec), this, propertyName, slot); 367 367 } 368 368 … … 409 409 void RegExpObjectImp::put(ExecState *exec, const Identifier &propertyName, JSValue *value) 410 410 { 411 lookupPut<RegExpObjectImp, InternalFunctionImp>(exec, propertyName, value, &RegExpObjectImpTable, this);411 lookupPut<RegExpObjectImp, InternalFunctionImp>(exec, propertyName, value, ExecState::RegExpObjectImpTable(exec), this); 412 412 } 413 413 -
trunk/JavaScriptCore/kjs/string_object.cpp
r31746 r32652 39 39 // ------------------------------ StringInstance ---------------------------- 40 40 41 const ClassInfo StringInstance::info = { "String", 0, 0 };41 const ClassInfo StringInstance::info = { "String", 0, 0, 0 }; 42 42 43 43 StringInstance::StringInstance(JSObject *proto) … … 126 126 127 127 // ------------------------------ StringPrototype --------------------------- 128 const ClassInfo StringPrototype::info = { "String", &StringInstance::info, &stringTable };128 const ClassInfo StringPrototype::info = { "String", &StringInstance::info, 0, ExecState::stringTable }; 129 129 /* Source for string_object.lut.h 130 130 @begin stringTable 26 … … 174 174 bool StringPrototype::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot &slot) 175 175 { 176 return getStaticFunctionSlot<StringInstance>(exec, &stringTable, this, propertyName, slot);176 return getStaticFunctionSlot<StringInstance>(exec, ExecState::stringTable(exec), this, propertyName, slot); 177 177 } 178 178
Note:
See TracChangeset
for help on using the changeset viewer.