Changeset 117859 in webkit
- Timestamp:
- May 21, 2012 5:37:09 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117855 r117859 1 2012-05-15 Gavin Barraclough <barraclough@apple.com> 2 3 Add support for private names 4 https://bugs.webkit.org/show_bug.cgi?id=86509 5 6 Reviewed by Oliver Hunt. 7 8 The spec isn't final, but we can start adding support to allow property maps 9 to contain keys that aren't identifiers. 10 11 * fast/js/names-expected.txt: Added. 12 * fast/js/names.html: Added. 13 * fast/js/script-tests/names.js: Added. 14 - Added test cases. 15 1 16 2012-05-21 Emil A Eklund <eae@chromium.org> 2 17 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r117846 r117859 1437 1437 BUGWK78657 : fast/js/constructor-length.html = FAIL 1438 1438 1439 // This is JSC-only, preliminary implementation of a ES6 feature - doesn't exist in V8 (yet) 1440 BUGWK86509 SKIP WONTFIX : fast/js/names.html = FAIL 1441 1439 1442 // Linux pixeltest failure: The text suggests that the radios should not 1440 1443 // overlap, but it's very close and quite different from the Windows version -
trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
r116828 r117859 130 130 RefPtr<OpaqueJSString> propertyNameRef; 131 131 132 for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) { 133 // optional optimization to bypass getProperty in cases when we only need to know if the property exists 134 if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) { 135 if (!propertyNameRef) 136 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 137 APICallbackShim callbackShim(exec); 138 if (hasProperty(ctx, thisRef, propertyNameRef.get())) { 139 slot.setCustom(thisObject, callbackGetter); 140 return true; 141 } 142 } else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) { 143 if (!propertyNameRef) 144 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 145 JSValueRef exception = 0; 146 JSValueRef value; 147 { 132 if (StringImpl* name = propertyName.publicName()) { 133 for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) { 134 // optional optimization to bypass getProperty in cases when we only need to know if the property exists 135 if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) { 136 if (!propertyNameRef) 137 propertyNameRef = OpaqueJSString::create(name); 148 138 APICallbackShim callbackShim(exec); 149 value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); 150 } 151 if (exception) { 152 throwError(exec, toJS(exec, exception)); 153 slot.setValue(jsUndefined()); 154 return true; 155 } 156 if (value) { 157 slot.setValue(toJS(exec, value)); 158 return true; 159 } 160 } 161 162 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { 163 if (staticValues->contains(propertyName.impl())) { 164 JSValue value = thisObject->getStaticValue(exec, propertyName); 139 if (hasProperty(ctx, thisRef, propertyNameRef.get())) { 140 slot.setCustom(thisObject, callbackGetter); 141 return true; 142 } 143 } else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) { 144 if (!propertyNameRef) 145 propertyNameRef = OpaqueJSString::create(name); 146 JSValueRef exception = 0; 147 JSValueRef value; 148 { 149 APICallbackShim callbackShim(exec); 150 value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); 151 } 152 if (exception) { 153 throwError(exec, toJS(exec, exception)); 154 slot.setValue(jsUndefined()); 155 return true; 156 } 165 157 if (value) { 166 slot.setValue( value);158 slot.setValue(toJS(exec, value)); 167 159 return true; 168 160 } 169 161 } 170 } 171 172 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 173 if (staticFunctions->contains(propertyName.impl())) { 174 slot.setCustom(thisObject, staticFunctionGetter); 175 return true; 176 } 177 } 178 } 179 162 163 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { 164 if (staticValues->contains(name)) { 165 JSValue value = thisObject->getStaticValue(exec, propertyName); 166 if (value) { 167 slot.setValue(value); 168 return true; 169 } 170 } 171 } 172 173 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 174 if (staticFunctions->contains(name)) { 175 slot.setCustom(thisObject, staticFunctionGetter); 176 return true; 177 } 178 } 179 } 180 } 181 180 182 return Parent::getOwnPropertySlot(thisObject, exec, propertyName, slot); 181 183 } … … 234 236 JSValueRef valueRef = toRef(exec, value); 235 237 236 for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) { 237 if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) { 238 if (!propertyNameRef) 239 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 240 JSValueRef exception = 0; 241 bool result; 242 { 243 APICallbackShim callbackShim(exec); 244 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 245 } 246 if (exception) 247 throwError(exec, toJS(exec, exception)); 248 if (result || exception) 249 return; 250 } 251 252 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { 253 if (StaticValueEntry* entry = staticValues->get(propertyName.impl())) { 254 if (entry->attributes & kJSPropertyAttributeReadOnly) 238 if (StringImpl* name = propertyName.publicName()) { 239 for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) { 240 if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) { 241 if (!propertyNameRef) 242 propertyNameRef = OpaqueJSString::create(name); 243 JSValueRef exception = 0; 244 bool result; 245 { 246 APICallbackShim callbackShim(exec); 247 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 248 } 249 if (exception) 250 throwError(exec, toJS(exec, exception)); 251 if (result || exception) 255 252 return; 256 if (JSObjectSetPropertyCallback setProperty = entry->setProperty) { 257 if (!propertyNameRef) 258 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 259 JSValueRef exception = 0; 260 bool result; 261 { 262 APICallbackShim callbackShim(exec); 263 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 253 } 254 255 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { 256 if (StaticValueEntry* entry = staticValues->get(name)) { 257 if (entry->attributes & kJSPropertyAttributeReadOnly) 258 return; 259 if (JSObjectSetPropertyCallback setProperty = entry->setProperty) { 260 if (!propertyNameRef) 261 propertyNameRef = OpaqueJSString::create(name); 262 JSValueRef exception = 0; 263 bool result; 264 { 265 APICallbackShim callbackShim(exec); 266 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 267 } 268 if (exception) 269 throwError(exec, toJS(exec, exception)); 270 if (result || exception) 271 return; 264 272 } 265 if (exception) 266 throwError(exec, toJS(exec, exception)); 267 if (result || exception) 273 } 274 } 275 276 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 277 if (StaticFunctionEntry* entry = staticFunctions->get(name)) { 278 if (entry->attributes & kJSPropertyAttributeReadOnly) 268 279 return; 269 } 270 } 271 } 272 273 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 274 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) { 275 if (entry->attributes & kJSPropertyAttributeReadOnly) 280 thisObject->JSCallbackObject<Parent>::putDirect(exec->globalData(), propertyName, value); // put as override property 276 281 return; 277 thisObject->JSCallbackObject<Parent>::putDirect(exec->globalData(), propertyName, value); // put as override property 278 return; 279 } 280 } 281 } 282 282 } 283 } 284 } 285 } 286 283 287 return Parent::put(thisObject, exec, propertyName, value, slot); 284 288 } … … 292 296 RefPtr<OpaqueJSString> propertyNameRef; 293 297 294 for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) { 295 if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) { 296 if (!propertyNameRef) 297 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 298 JSValueRef exception = 0; 299 bool result; 300 { 301 APICallbackShim callbackShim(exec); 302 result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); 303 } 304 if (exception) 305 throwError(exec, toJS(exec, exception)); 306 if (result || exception) 307 return true; 308 } 309 310 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { 311 if (StaticValueEntry* entry = staticValues->get(propertyName.impl())) { 312 if (entry->attributes & kJSPropertyAttributeDontDelete) 313 return false; 314 return true; 315 } 316 } 317 318 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 319 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) { 320 if (entry->attributes & kJSPropertyAttributeDontDelete) 321 return false; 322 return true; 323 } 324 } 325 } 326 298 if (StringImpl* name = propertyName.publicName()) { 299 for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) { 300 if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) { 301 if (!propertyNameRef) 302 propertyNameRef = OpaqueJSString::create(name); 303 JSValueRef exception = 0; 304 bool result; 305 { 306 APICallbackShim callbackShim(exec); 307 result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); 308 } 309 if (exception) 310 throwError(exec, toJS(exec, exception)); 311 if (result || exception) 312 return true; 313 } 314 315 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { 316 if (StaticValueEntry* entry = staticValues->get(name)) { 317 if (entry->attributes & kJSPropertyAttributeDontDelete) 318 return false; 319 return true; 320 } 321 } 322 323 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 324 if (StaticFunctionEntry* entry = staticFunctions->get(name)) { 325 if (entry->attributes & kJSPropertyAttributeDontDelete) 326 return false; 327 return true; 328 } 329 } 330 } 331 } 332 327 333 return Parent::deleteProperty(thisObject, exec, propertyName); 328 334 } … … 510 516 RefPtr<OpaqueJSString> propertyNameRef; 511 517 512 for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) 513 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) 514 if (StaticValueEntry* entry = staticValues->get(propertyName.impl())) 515 if (JSObjectGetPropertyCallback getProperty = entry->getProperty) { 516 if (!propertyNameRef) 517 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 518 JSValueRef exception = 0; 519 JSValueRef value; 520 { 521 APICallbackShim callbackShim(exec); 522 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 518 if (StringImpl* name = propertyName.publicName()) { 519 for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { 520 if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { 521 if (StaticValueEntry* entry = staticValues->get(name)) { 522 if (JSObjectGetPropertyCallback getProperty = entry->getProperty) { 523 if (!propertyNameRef) 524 propertyNameRef = OpaqueJSString::create(name); 525 JSValueRef exception = 0; 526 JSValueRef value; 527 { 528 APICallbackShim callbackShim(exec); 529 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 530 } 531 if (exception) { 532 throwError(exec, toJS(exec, exception)); 533 return jsUndefined(); 534 } 535 if (value) 536 return toJS(exec, value); 523 537 } 524 if (exception) { 525 throwError(exec, toJS(exec, exception)); 526 return jsUndefined(); 527 } 528 if (value) 529 return toJS(exec, value); 530 } 538 } 539 } 540 } 541 } 531 542 532 543 return JSValue(); … … 543 554 return slot2.getValue(exec, propertyName); 544 555 545 for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) { 546 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 547 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) { 548 if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { 549 550 JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, propertyName.ustring()); 551 thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes); 552 return o; 553 } 554 } 555 } 556 } 557 556 if (StringImpl* name = propertyName.publicName()) { 557 for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) { 558 if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { 559 if (StaticFunctionEntry* entry = staticFunctions->get(name)) { 560 if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { 561 562 JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, name); 563 thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes); 564 return o; 565 } 566 } 567 } 568 } 569 } 570 558 571 return throwError(exec, createReferenceError(exec, "Static function property defined with NULL callAsFunction callback.")); 559 572 } … … 567 580 RefPtr<OpaqueJSString> propertyNameRef; 568 581 569 for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) 570 if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) { 571 if (!propertyNameRef) 572 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 573 JSValueRef exception = 0; 574 JSValueRef value; 575 { 576 APICallbackShim callbackShim(exec); 577 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 578 } 579 if (exception) { 580 throwError(exec, toJS(exec, exception)); 581 return jsUndefined(); 582 } 583 if (value) 584 return toJS(exec, value); 585 } 586 582 if (StringImpl* name = propertyName.publicName()) { 583 for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) { 584 if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) { 585 if (!propertyNameRef) 586 propertyNameRef = OpaqueJSString::create(name); 587 JSValueRef exception = 0; 588 JSValueRef value; 589 { 590 APICallbackShim callbackShim(exec); 591 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 592 } 593 if (exception) { 594 throwError(exec, toJS(exec, exception)); 595 return jsUndefined(); 596 } 597 if (value) 598 return toJS(exec, value); 599 } 600 } 601 } 602 587 603 return throwError(exec, createReferenceError(exec, "hasProperty callback returned true for a property that doesn't exist.")); 588 604 } -
trunk/Source/JavaScriptCore/CMakeLists.txt
r117646 r117859 193 193 runtime/Lookup.cpp 194 194 runtime/MathObject.cpp 195 runtime/NameConstructor.cpp 196 runtime/NameConstructor.h 197 runtime/NameInstance.cpp 198 runtime/NameInstance.h 199 runtime/NamePrototype.cpp 200 runtime/NamePrototype.h 195 201 runtime/NativeErrorConstructor.cpp 196 202 runtime/NativeErrorPrototype.cpp … … 244 250 runtime/JSONObject.cpp 245 251 runtime/MathObject.cpp 252 runtime/NamePrototype.cpp 246 253 runtime/NumberConstructor.cpp 247 254 runtime/NumberPrototype.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r117823 r117859 1 2012-05-15 Gavin Barraclough <barraclough@apple.com> 2 3 Add support for private names 4 https://bugs.webkit.org/show_bug.cgi?id=86509 5 6 Reviewed by Oliver Hunt. 7 8 The spec isn't final, but we can start adding support to allow property maps 9 to contain keys that aren't identifiers. 10 11 * API/JSCallbackObjectFunctions.h: 12 (JSC::::getOwnPropertySlot): 13 (JSC::::put): 14 (JSC::::deleteProperty): 15 (JSC::::getStaticValue): 16 (JSC::::staticFunctionGetter): 17 (JSC::::callbackGetter): 18 - Only expose public named properties over the JSC API. 19 * CMakeLists.txt: 20 * DerivedSources.make: 21 * DerivedSources.pri: 22 * GNUmakefile.list.am: 23 * JavaScriptCore.gypi: 24 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 25 * JavaScriptCore.xcodeproj/project.pbxproj: 26 * Target.pri: 27 - Added new files to build system. 28 * dfg/DFGOperations.cpp: 29 (JSC::DFG::operationPutByValInternal): 30 - Added support for property access with name objects. 31 * interpreter/CallFrame.h: 32 (JSC::ExecState::privateNamePrototypeTable): 33 - Added hash table for NamePrototype 34 * interpreter/Interpreter.cpp: 35 (JSC::Interpreter::privateExecute): 36 - Added support for property access with name objects. 37 * jit/JITStubs.cpp: 38 (JSC::DEFINE_STUB_FUNCTION): 39 - Added support for property access with name objects. 40 * llint/LLIntSlowPaths.cpp: 41 (JSC::LLInt::getByVal): 42 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 43 * runtime/CommonSlowPaths.h: 44 (JSC::CommonSlowPaths::opIn): 45 * runtime/JSActivation.cpp: 46 (JSC::JSActivation::symbolTableGet): 47 (JSC::JSActivation::symbolTablePut): 48 (JSC::JSActivation::symbolTablePutWithAttributes): 49 - Added support for property access with name objects. 50 * runtime/JSGlobalData.cpp: 51 (JSC): 52 (JSC::JSGlobalData::JSGlobalData): 53 (JSC::JSGlobalData::~JSGlobalData): 54 * runtime/JSGlobalData.h: 55 (JSGlobalData): 56 - Added hash table for NamePrototype 57 * runtime/JSGlobalObject.cpp: 58 (JSC::JSGlobalObject::reset): 59 * runtime/JSGlobalObject.h: 60 (JSGlobalObject): 61 (JSC::JSGlobalObject::privateNameStructure): 62 (JSC::JSGlobalObject::symbolTableHasProperty): 63 - Added new global properties. 64 * runtime/JSType.h: 65 * runtime/JSTypeInfo.h: 66 (JSC::TypeInfo::isName): 67 - Added type for NameInstances, for fast isName check. 68 * runtime/JSVariableObject.cpp: 69 (JSC::JSVariableObject::deleteProperty): 70 (JSC::JSVariableObject::symbolTableGet): 71 * runtime/JSVariableObject.h: 72 (JSC::JSVariableObject::symbolTableGet): 73 (JSC::JSVariableObject::symbolTablePut): 74 (JSC::JSVariableObject::symbolTablePutWithAttributes): 75 - symbol table lookup should take a PropertyName. 76 * runtime/Lookup.cpp: 77 (JSC::setUpStaticFunctionSlot): 78 * runtime/Lookup.h: 79 (JSC::HashTable::entry): 80 - entry lookup should take a PropertyName. 81 * runtime/NameConstructor.cpp: Added. 82 (JSC): 83 (JSC::NameConstructor::NameConstructor): 84 (JSC::NameConstructor::finishCreation): 85 (JSC::constructPrivateName): 86 (JSC::NameConstructor::getConstructData): 87 (JSC::NameConstructor::getCallData): 88 * runtime/NameConstructor.h: Added. 89 (JSC): 90 (NameConstructor): 91 (JSC::NameConstructor::create): 92 (JSC::NameConstructor::createStructure): 93 - Added constructor. 94 * runtime/NameInstance.cpp: Added. 95 (JSC): 96 (JSC::NameInstance::NameInstance): 97 (JSC::NameInstance::destroy): 98 * runtime/NameInstance.h: Added. 99 (JSC): 100 (NameInstance): 101 (JSC::NameInstance::createStructure): 102 (JSC::NameInstance::create): 103 (JSC::NameInstance::privateName): 104 (JSC::NameInstance::nameString): 105 (JSC::NameInstance::finishCreation): 106 (JSC::isName): 107 - Added instance. 108 * runtime/NamePrototype.cpp: Added. 109 (JSC): 110 (JSC::NamePrototype::NamePrototype): 111 (JSC::NamePrototype::finishCreation): 112 (JSC::NamePrototype::getOwnPropertySlot): 113 (JSC::NamePrototype::getOwnPropertyDescriptor): 114 (JSC::privateNameProtoFuncToString): 115 * runtime/NamePrototype.h: Added. 116 (JSC): 117 (NamePrototype): 118 (JSC::NamePrototype::create): 119 (JSC::NamePrototype::createStructure): 120 - Added prototype. 121 * runtime/PrivateName.h: Added. 122 (JSC): 123 (PrivateName): 124 (JSC::PrivateName::PrivateName): 125 (JSC::PrivateName::uid): 126 - A private name object holds a StringImpl that can be used as a unique key in a property map. 127 * runtime/PropertyMapHashTable.h: 128 (JSC::PropertyTable::find): 129 (JSC::PropertyTable::findWithString): 130 - Strings should only match keys in the table that are identifiers. 131 * runtime/PropertyName.h: 132 (JSC::PropertyName::PropertyName): 133 (PropertyName): 134 (JSC::PropertyName::uid): 135 (JSC::PropertyName::publicName): 136 (JSC::PropertyName::asIndex): 137 (JSC::operator==): 138 (JSC::operator!=): 139 - replaced impl() & ustring() with uid() [to get the raw impl] and publicName() [impl or null, if not an identifier]. 140 * runtime/Structure.cpp: 141 (JSC::Structure::despecifyDictionaryFunction): 142 (JSC::Structure::addPropertyTransitionToExistingStructure): 143 (JSC::Structure::addPropertyTransition): 144 (JSC::Structure::attributeChangeTransition): 145 (JSC::Structure::get): 146 (JSC::Structure::despecifyFunction): 147 (JSC::Structure::putSpecificValue): 148 (JSC::Structure::remove): 149 (JSC::Structure::getPropertyNamesFromStructure): 150 * runtime/Structure.h: 151 (JSC::Structure::get): 152 - call uid() to get a PropertyName raw impl, for use as a key. 153 1 154 2012-04-30 Filip Pizlo <fpizlo@apple.com> 2 155 -
trunk/Source/JavaScriptCore/DerivedSources.make
r106606 r117859 48 48 Lexer.lut.h \ 49 49 MathObject.lut.h \ 50 NamePrototype.lut.h \ 50 51 NumberConstructor.lut.h \ 51 52 NumberPrototype.lut.h \ -
trunk/Source/JavaScriptCore/DerivedSources.pri
r99274 r117859 17 17 runtime/JSONObject.cpp \ 18 18 runtime/MathObject.cpp \ 19 runtime/NamePrototype.cpp \ 19 20 runtime/NumberConstructor.cpp \ 20 21 runtime/NumberPrototype.cpp \ -
trunk/Source/JavaScriptCore/GNUmakefile.list.am
r117783 r117859 21 21 DerivedSources/JavaScriptCore/JSONObject.lut.h \ 22 22 DerivedSources/JavaScriptCore/MathObject.lut.h \ 23 DerivedSources/JavaScriptCore/NamePrototype.lut.h \ 23 24 DerivedSources/JavaScriptCore/NumberConstructor.lut.h \ 24 25 DerivedSources/JavaScriptCore/NumberPrototype.lut.h \ … … 508 509 Source/JavaScriptCore/runtime/MathObject.h \ 509 510 Source/JavaScriptCore/runtime/MemoryStatistics.h \ 511 Source/JavaScriptCore/runtime/NameConstructor.cpp \ 512 Source/JavaScriptCore/runtime/NameConstructor.h \ 513 Source/JavaScriptCore/runtime/NameInstance.cpp \ 514 Source/JavaScriptCore/runtime/NameInstance.h \ 515 Source/JavaScriptCore/runtime/NamePrototype.cpp \ 516 Source/JavaScriptCore/runtime/NamePrototype.h \ 510 517 Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp \ 511 518 Source/JavaScriptCore/runtime/NativeErrorConstructor.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.gypi
r115590 r117859 273 273 'runtime/MathObject.h', 274 274 'runtime/MemoryStatistics.h', 275 'runtime/NameConstructor.h', 276 'runtime/NameInstance.h', 277 'runtime/NamePrototype.h', 275 278 'runtime/NativeErrorConstructor.h', 276 279 'runtime/NativeErrorPrototype.h', … … 498 501 'runtime/MathObject.cpp', 499 502 'runtime/MemoryStatistics.cpp', 503 'runtime/NameConstructor.cpp', 504 'runtime/NameInstance.cpp', 505 'runtime/NamePrototype.cpp', 500 506 'runtime/NativeErrorConstructor.cpp', 501 507 'runtime/NativeErrorPrototype.cpp', … … 550 556 '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/JSONObject.lut.h', 551 557 '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/MathObject.lut.h', 558 '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/NamePrototype.lut.h', 552 559 '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/NumberConstructor.lut.h', 553 560 '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/NumberPrototype.lut.h', -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
r115590 r117859 959 959 </File> 960 960 <File 961 RelativePath="..\..\runtime\NameConstructor.cpp" 962 > 963 </File> 964 <File 965 RelativePath="..\..\runtime\NameConstructor.h" 966 > 967 </File> 968 <File 969 RelativePath="..\..\runtime\NameInstance.cpp" 970 > 971 </File> 972 <File 973 RelativePath="..\..\runtime\NameInstance.h" 974 > 975 </File> 976 <File 977 RelativePath="..\..\runtime\NamePrototype.cpp" 978 > 979 </File> 980 <File 981 RelativePath="..\..\runtime\NamePrototype.h" 982 > 983 </File> 984 <File 961 985 RelativePath="..\..\runtime\NativeErrorConstructor.cpp" 962 986 > … … 2056 2080 <File 2057 2081 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\MathObject.lut.h" 2082 > 2083 </File> 2084 <File 2085 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\NamePrototype.lut.h" 2058 2086 > 2059 2087 </File> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r117646 r117859 390 390 86880F1F14328BB900B08D42 /* DFGSpeculativeJIT32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86880F1B14328BB900B08D42 /* DFGSpeculativeJIT32_64.cpp */; }; 391 391 86880F4D14353B2100B08D42 /* DFGSpeculativeJIT64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86880F4C14353B2100B08D42 /* DFGSpeculativeJIT64.cpp */; }; 392 868916B0155F286300CB2B9A /* PrivateName.h in Headers */ = {isa = PBXBuildFile; fileRef = 868916A9155F285400CB2B9A /* PrivateName.h */; settings = {ATTRIBUTES = (Private, ); }; }; 392 393 869D04AF1193B54D00803475 /* CachedTranscendentalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 869D04AE1193B54D00803475 /* CachedTranscendentalFunction.h */; settings = {ATTRIBUTES = (Private, ); }; }; 393 394 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 869EBCB60E8C6D4A008722CC /* ResultType.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 423 424 86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; }; 424 425 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E85538111B9968001AF51E /* JSStringBuilder.h */; }; 426 86EBF2FF1560F06A008E9222 /* NameConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EBF2F91560F036008E9222 /* NameConstructor.cpp */; }; 427 86EBF3001560F06A008E9222 /* NameConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EBF2FA1560F036008E9222 /* NameConstructor.h */; }; 428 86EBF3011560F06A008E9222 /* NameInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EBF2FB1560F036008E9222 /* NameInstance.cpp */; }; 429 86EBF3021560F06A008E9222 /* NameInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EBF2FC1560F036008E9222 /* NameInstance.h */; }; 430 86EBF3031560F06A008E9222 /* NamePrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EBF2FD1560F036008E9222 /* NamePrototype.cpp */; }; 431 86EBF3041560F06A008E9222 /* NamePrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EBF2FE1560F036008E9222 /* NamePrototype.h */; }; 425 432 86EC9DC41328DF82002B2AD7 /* DFGByteCodeParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EC9DB41328DF82002B2AD7 /* DFGByteCodeParser.cpp */; }; 426 433 86EC9DC51328DF82002B2AD7 /* DFGByteCodeParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EC9DB51328DF82002B2AD7 /* DFGByteCodeParser.h */; }; … … 1057 1064 86880F1B14328BB900B08D42 /* DFGSpeculativeJIT32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGSpeculativeJIT32_64.cpp; path = dfg/DFGSpeculativeJIT32_64.cpp; sourceTree = "<group>"; }; 1058 1065 86880F4C14353B2100B08D42 /* DFGSpeculativeJIT64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGSpeculativeJIT64.cpp; path = dfg/DFGSpeculativeJIT64.cpp; sourceTree = "<group>"; }; 1066 868916A9155F285400CB2B9A /* PrivateName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateName.h; sourceTree = "<group>"; }; 1059 1067 869D04AE1193B54D00803475 /* CachedTranscendentalFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedTranscendentalFunction.h; sourceTree = "<group>"; }; 1060 1068 869EBCB60E8C6D4A008722CC /* ResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultType.h; sourceTree = "<group>"; }; … … 1096 1104 86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; }; 1097 1105 86E85538111B9968001AF51E /* JSStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringBuilder.h; sourceTree = "<group>"; }; 1106 86EBF2F91560F036008E9222 /* NameConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameConstructor.cpp; sourceTree = "<group>"; }; 1107 86EBF2FA1560F036008E9222 /* NameConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NameConstructor.h; sourceTree = "<group>"; }; 1108 86EBF2FB1560F036008E9222 /* NameInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameInstance.cpp; sourceTree = "<group>"; }; 1109 86EBF2FC1560F036008E9222 /* NameInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NameInstance.h; sourceTree = "<group>"; }; 1110 86EBF2FD1560F036008E9222 /* NamePrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NamePrototype.cpp; sourceTree = "<group>"; }; 1111 86EBF2FE1560F036008E9222 /* NamePrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NamePrototype.h; sourceTree = "<group>"; }; 1098 1112 86EC9DB41328DF82002B2AD7 /* DFGByteCodeParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGByteCodeParser.cpp; path = dfg/DFGByteCodeParser.cpp; sourceTree = "<group>"; }; 1099 1113 86EC9DB51328DF82002B2AD7 /* DFGByteCodeParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGByteCodeParser.h; path = dfg/DFGByteCodeParser.h; sourceTree = "<group>"; }; … … 1811 1825 isa = PBXGroup; 1812 1826 children = ( 1813 0F21C27914BE727300ADC64B /* CodeSpecializationKind.h */,1814 0F21C27A14BE727300ADC64B /* ExecutionHarness.h */,1815 0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */,1816 1827 BCF605110E203EF800B9A64D /* ArgList.cpp */, 1817 1828 BCF605120E203EF800B9A64D /* ArgList.h */, … … 1834 1845 145C507F0D9DF63B0088F6B9 /* CallData.h */, 1835 1846 BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */, 1847 0F21C27914BE727300ADC64B /* CodeSpecializationKind.h */, 1836 1848 65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */, 1837 1849 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */, 1850 0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */, 1838 1851 969A09220ED1E09C00F1F681 /* Completion.cpp */, 1839 1852 F5BB2BC5030F772101FCFE1D /* Completion.h */, … … 1861 1874 86CA032D1038E8440028A609 /* Executable.cpp */, 1862 1875 86CAFEE21035DDE60028A609 /* Executable.h */, 1876 0F21C27A14BE727300ADC64B /* ExecutionHarness.h */, 1863 1877 BC2680C00E16D4E900A06E92 /* FunctionConstructor.cpp */, 1864 1878 BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */, … … 1932 1946 90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */, 1933 1947 90213E3C123A40C200D422F3 /* MemoryStatistics.h */, 1948 86EBF2F91560F036008E9222 /* NameConstructor.cpp */, 1949 86EBF2FA1560F036008E9222 /* NameConstructor.h */, 1950 86EBF2FB1560F036008E9222 /* NameInstance.cpp */, 1951 86EBF2FC1560F036008E9222 /* NameInstance.h */, 1952 86EBF2FD1560F036008E9222 /* NamePrototype.cpp */, 1953 86EBF2FE1560F036008E9222 /* NamePrototype.h */, 1934 1954 BC02E9080E1839DB000F9297 /* NativeErrorConstructor.cpp */, 1935 1955 BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */, … … 1951 1971 0FE228EA1436AB2300196C48 /* Options.cpp */, 1952 1972 0FE228EB1436AB2300196C48 /* Options.h */, 1973 868916A9155F285400CB2B9A /* PrivateName.h */, 1953 1974 A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */, 1954 1975 A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */, … … 2609 2630 14816E1C154CC56C00B8054C /* BlockAllocator.h in Headers */, 2610 2631 86158AB3155C8B4000B45C9C /* PropertyName.h in Headers */, 2632 868916B0155F286300CB2B9A /* PrivateName.h in Headers */, 2633 86EBF3001560F06A008E9222 /* NameConstructor.h in Headers */, 2634 86EBF3021560F06A008E9222 /* NameInstance.h in Headers */, 2635 86EBF3041560F06A008E9222 /* NamePrototype.h in Headers */, 2611 2636 0F1E3A67153A21E2000F9456 /* DFGSilentRegisterSavePlan.h in Headers */, 2612 2637 0F3B3A281544C997003ED0FF /* DFGCFGSimplificationPhase.h in Headers */, … … 3175 3200 863C6D9C1521111A00585E4E /* YarrCanonicalizeUCS2.cpp in Sources */, 3176 3201 14816E1B154CC56C00B8054C /* BlockAllocator.cpp in Sources */, 3202 86EBF2FF1560F06A008E9222 /* NameConstructor.cpp in Sources */, 3203 86EBF3011560F06A008E9222 /* NameInstance.cpp in Sources */, 3204 86EBF3031560F06A008E9222 /* NamePrototype.cpp in Sources */, 3177 3205 0F3B3A1A153E68F2003ED0FF /* DFGConstantFoldingPhase.cpp in Sources */, 3178 3206 0F3B3A271544C995003ED0FF /* DFGCFGSimplificationPhase.cpp in Sources */, -
trunk/Source/JavaScriptCore/Target.pri
r117646 r117859 201 201 runtime/Lookup.cpp \ 202 202 runtime/MathObject.cpp \ 203 runtime/NameConstructor.cpp \ 204 runtime/NameInstance.cpp \ 205 runtime/NamePrototype.cpp \ 203 206 runtime/NativeErrorConstructor.cpp \ 204 207 runtime/NativeErrorPrototype.cpp \ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r117729 r117859 37 37 #include "JSGlobalData.h" 38 38 #include "JSStaticScopeObject.h" 39 #include "NameInstance.h" 39 40 #include "Operations.h" 40 41 … … 201 202 } 202 203 204 if (isName(property)) { 205 PutPropertySlot slot(strict); 206 baseValue.put(exec, jsCast<NameInstance*>(property.asCell())->privateName(), value, slot); 207 return; 208 } 203 209 204 210 // Don't put to an object if toString throws an exception. … … 308 314 } 309 315 316 if (isName(property)) 317 return JSValue::encode(baseValue.get(exec, jsCast<NameInstance*>(property.asCell())->privateName())); 318 310 319 Identifier ident(exec, property.toString(exec)->value(exec)); 311 320 return JSValue::encode(baseValue.get(exec, ident)); … … 330 339 return JSValue::encode(result); 331 340 } 341 342 if (isName(property)) 343 return JSValue::encode(JSValue(base).get(exec, jsCast<NameInstance*>(property.asCell())->privateName())); 332 344 333 345 Identifier ident(exec, property.toString(exec)->value(exec)); -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r115861 r117859 91 91 static const HashTable* objectConstructorTable(CallFrame* callFrame) { return callFrame->globalData().objectConstructorTable; } 92 92 static const HashTable* objectPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().objectPrototypeTable; } 93 static const HashTable* privateNamePrototypeTable(CallFrame* callFrame) { return callFrame->globalData().privateNamePrototypeTable; } 93 94 static const HashTable* regExpTable(CallFrame* callFrame) { return callFrame->globalData().regExpTable; } 94 95 static const HashTable* regExpConstructorTable(CallFrame* callFrame) { return callFrame->globalData().regExpConstructorTable; } -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r117646 r117859 51 51 #include "JSStaticScopeObject.h" 52 52 #include "JSString.h" 53 #include "NameInstance.h" 53 54 #include "ObjectPrototype.h" 54 55 #include "Operations.h" … … 2796 2797 if (propName.getUInt32(i)) 2797 2798 callFrame->uncheckedR(dst) = jsBoolean(baseObj->hasProperty(callFrame, i)); 2799 else if (isName(propName)) 2800 callFrame->uncheckedR(dst) = jsBoolean(baseObj->hasProperty(callFrame, jsCast<NameInstance*>(propName.asCell())->privateName())); 2798 2801 else { 2799 2802 Identifier property(callFrame, propName.toString(callFrame)->value(callFrame)); … … 3776 3779 else 3777 3780 result = baseValue.get(callFrame, i); 3778 } else { 3781 } else if (isName(subscript)) 3782 result = baseValue.get(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName()); 3783 else { 3779 3784 Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); 3780 3785 result = baseValue.get(callFrame, property); … … 3814 3819 } else 3815 3820 baseValue.putByIndex(callFrame, i, callFrame->r(value).jsValue(), codeBlock->isStrictMode()); 3821 } else if (isName(subscript)) { 3822 PutPropertySlot slot(codeBlock->isStrictMode()); 3823 baseValue.put(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName(), callFrame->r(value).jsValue(), slot); 3816 3824 } else { 3817 3825 Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); … … 3845 3853 if (subscript.getUInt32(i)) 3846 3854 result = baseObj->methodTable()->deletePropertyByIndex(baseObj, callFrame, i); 3855 else if (isName(subscript)) 3856 result = baseObj->methodTable()->deleteProperty(baseObj, callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName()); 3847 3857 else { 3848 3858 CHECK_FOR_EXCEPTION(); -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r117646 r117859 55 55 #include "JSStaticScopeObject.h" 56 56 #include "JSString.h" 57 #include "NameInstance.h" 57 58 #include "ObjectPrototype.h" 58 59 #include "Operations.h" … … 2448 2449 return JSValue::encode(result); 2449 2450 } 2450 2451 2452 if (isName(subscript)) { 2453 JSValue result = baseValue.get(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName()); 2454 CHECK_FOR_EXCEPTION(); 2455 return JSValue::encode(result); 2456 } 2457 2451 2458 Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); 2452 2459 JSValue result = baseValue.get(callFrame, property); … … 2475 2482 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val)); 2476 2483 } 2477 } else { 2484 } else if (isName(subscript)) 2485 result = baseValue.get(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName()); 2486 else { 2478 2487 Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); 2479 2488 result = baseValue.get(callFrame, property); … … 2521 2530 } else 2522 2531 baseValue.putByIndex(callFrame, i, value, callFrame->codeBlock()->isStrictMode()); 2532 } else if (isName(subscript)) { 2533 PutPropertySlot slot(callFrame->codeBlock()->isStrictMode()); 2534 baseValue.put(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 2523 2535 } else { 2524 2536 Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); … … 3242 3254 return JSValue::encode(jsBoolean(baseObj->hasProperty(callFrame, i))); 3243 3255 3256 if (isName(propName)) 3257 return JSValue::encode(jsBoolean(baseObj->hasProperty(callFrame, jsCast<NameInstance*>(propName.asCell())->privateName()))); 3258 3244 3259 Identifier property(callFrame, propName.toString(callFrame)->value(callFrame)); 3245 3260 CHECK_FOR_EXCEPTION(); … … 3354 3369 if (subscript.getUInt32(i)) 3355 3370 result = baseObj->methodTable()->deletePropertyByIndex(baseObj, callFrame, i); 3371 else if (isName(subscript)) 3372 result = baseObj->methodTable()->deleteProperty(baseObj, callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName()); 3356 3373 else { 3357 3374 CHECK_FOR_EXCEPTION(); -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r117823 r117859 953 953 return baseValue.get(exec, i); 954 954 } 955 956 if (isName(subscript)) 957 return baseValue.get(exec, jsCast<NameInstance*>(subscript.asCell())->privateName()); 955 958 956 959 Identifier property(exec, subscript.toString(exec)->value(exec)); … … 1005 1008 LLINT_END(); 1006 1009 } 1007 1010 1011 if (isName(subscript)) { 1012 PutPropertySlot slot(exec->codeBlock()->isStrictMode()); 1013 baseValue.put(exec, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 1014 LLINT_END(); 1015 } 1016 1008 1017 Identifier property(exec, subscript.toString(exec)->value(exec)); 1009 1018 LLINT_CHECK_EXCEPTION(); … … 1026 1035 if (subscript.getUInt32(i)) 1027 1036 couldDelete = baseObject->methodTable()->deletePropertyByIndex(baseObject, exec, i); 1037 else if (isName(subscript)) 1038 couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, jsCast<NameInstance*>(subscript.asCell())->privateName()); 1028 1039 else { 1029 1040 LLINT_CHECK_EXCEPTION(); -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h
r115861 r117859 31 31 #include "ExceptionHelpers.h" 32 32 #include "JSArray.h" 33 #include "NameInstance.h" 33 34 34 35 namespace JSC { … … 109 110 if (propName.getUInt32(i)) 110 111 return baseObj->hasProperty(exec, i); 112 113 if (isName(propName)) 114 return baseObj->hasProperty(exec, jsCast<NameInstance*>(propName.asCell())->privateName()); 111 115 112 116 Identifier property(exec, propName.toString(exec)->value(exec)); -
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r116828 r117859 93 93 inline bool JSActivation::symbolTableGet(PropertyName propertyName, PropertySlot& slot) 94 94 { 95 SymbolTableEntry entry = symbolTable().inlineGet(propertyName. impl());95 SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); 96 96 if (entry.isNull()) 97 97 return false; … … 108 108 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); 109 109 110 SymbolTableEntry entry = symbolTable().inlineGet(propertyName. impl());110 SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); 111 111 if (entry.isNull()) 112 112 return false; … … 142 142 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); 143 143 144 SymbolTable::iterator iter = symbolTable().find(propertyName. impl());144 SymbolTable::iterator iter = symbolTable().find(propertyName.publicName()); 145 145 if (iter == symbolTable().end()) 146 146 return false; -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r117729 r117859 87 87 JS_EXPORTDATA extern const HashTable objectConstructorTable; 88 88 extern const HashTable objectPrototypeTable; 89 extern const HashTable privateNamePrototypeTable; 89 90 extern const HashTable regExpTable; 90 91 extern const HashTable regExpConstructorTable; … … 136 137 , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable)) 137 138 , objectPrototypeTable(fastNew<HashTable>(JSC::objectPrototypeTable)) 139 , privateNamePrototypeTable(fastNew<HashTable>(JSC::privateNamePrototypeTable)) 138 140 , regExpTable(fastNew<HashTable>(JSC::regExpTable)) 139 141 , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) … … 242 244 objectConstructorTable->deleteTable(); 243 245 objectPrototypeTable->deleteTable(); 246 privateNamePrototypeTable->deleteTable(); 244 247 regExpTable->deleteTable(); 245 248 regExpConstructorTable->deleteTable(); … … 261 264 fastDelete(const_cast<HashTable*>(objectConstructorTable)); 262 265 fastDelete(const_cast<HashTable*>(objectPrototypeTable)); 266 fastDelete(const_cast<HashTable*>(privateNamePrototypeTable)); 263 267 fastDelete(const_cast<HashTable*>(regExpTable)); 264 268 fastDelete(const_cast<HashTable*>(regExpConstructorTable)); -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.h
r117729 r117859 193 193 const HashTable* objectConstructorTable; 194 194 const HashTable* objectPrototypeTable; 195 const HashTable* privateNamePrototypeTable; 195 196 const HashTable* regExpTable; 196 197 const HashTable* regExpConstructorTable; -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r116828 r117859 57 57 #include "Lookup.h" 58 58 #include "MathObject.h" 59 #include "NameConstructor.h" 60 #include "NameInstance.h" 61 #include "NamePrototype.h" 59 62 #include "NativeErrorConstructor.h" 60 63 #include "NativeErrorPrototype.h" … … 245 248 m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), this, errorPrototype)); 246 249 250 NamePrototype* privateNamePrototype = NamePrototype::create(exec, NamePrototype::createStructure(exec->globalData(), this, m_objectPrototype.get())); 251 m_privateNameStructure.set(exec->globalData(), this, NameInstance::createStructure(exec->globalData(), this, privateNamePrototype)); 252 247 253 // Constructors 248 254 … … 258 264 259 265 m_errorConstructor.set(exec->globalData(), this, ErrorConstructor::create(exec, this, ErrorConstructor::createStructure(exec->globalData(), this, m_functionPrototype.get()), errorPrototype)); 266 JSCell* privateNameConstructor = NameConstructor::create(exec, this, NameConstructor::createStructure(exec->globalData(), this, m_functionPrototype.get()), privateNamePrototype); 260 267 261 268 Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), this, errorPrototype); … … 277 284 m_regExpPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum); 278 285 errorPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum); 286 privateNamePrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, privateNameConstructor, DontEnum); 279 287 280 288 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum); … … 293 301 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum); 294 302 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum); 303 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Name"), privateNameConstructor, DontEnum); 295 304 296 305 m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, 1, exec->propertyNames().eval.ustring(), globalFuncEval)); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r116828 r117859 131 131 size_t m_functionNameOffset; 132 132 WriteBarrier<Structure> m_numberObjectStructure; 133 WriteBarrier<Structure> m_privateNameStructure; 133 134 WriteBarrier<Structure> m_regExpMatchesArrayStructure; 134 135 WriteBarrier<Structure> m_regExpStructure; … … 264 265 size_t functionNameOffset() const { return m_functionNameOffset; } 265 266 Structure* numberObjectStructure() const { return m_numberObjectStructure.get(); } 267 Structure* privateNameStructure() const { return m_privateNameStructure.get(); } 266 268 Structure* internalFunctionStructure() const { return m_internalFunctionStructure.get(); } 267 269 Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); } … … 377 379 inline bool JSGlobalObject::symbolTableHasProperty(PropertyName propertyName) 378 380 { 379 SymbolTableEntry entry = symbolTable().inlineGet(propertyName. impl());381 SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); 380 382 return !entry.isNull(); 381 383 } -
trunk/Source/JavaScriptCore/runtime/JSType.h
r106999 r117859 46 46 FinalObjectType, 47 47 JSFunctionType, 48 NameInstanceType, 48 49 NumberObjectType, 49 50 ErrorInstanceType, -
trunk/Source/JavaScriptCore/runtime/JSTypeInfo.h
r108444 r117859 68 68 bool isFinalObject() const { return type() == FinalObjectType; } 69 69 bool isNumberObject() const { return type() == NumberObjectType; } 70 bool isName() const { return type() == NameInstanceType; } 70 71 71 72 bool masqueradesAsUndefined() const { return isSetOnFlags1(MasqueradesAsUndefined); } -
trunk/Source/JavaScriptCore/runtime/JSVariableObject.cpp
r116828 r117859 46 46 { 47 47 JSVariableObject* thisObject = jsCast<JSVariableObject*>(cell); 48 if (thisObject->symbolTable().contains(propertyName. impl()))48 if (thisObject->symbolTable().contains(propertyName.publicName())) 49 49 return false; 50 50 … … 66 66 bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertyDescriptor& descriptor) 67 67 { 68 SymbolTableEntry entry = symbolTable().inlineGet(propertyName. impl());68 SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); 69 69 if (!entry.isNull()) { 70 70 descriptor.setDescriptor(registerAt(entry.getIndex()).get(), entry.getAttributes() | DontDelete); -
trunk/Source/JavaScriptCore/runtime/JSVariableObject.h
r116828 r117859 103 103 inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot) 104 104 { 105 SymbolTableEntry entry = symbolTable().inlineGet(propertyName. impl());105 SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); 106 106 if (!entry.isNull()) { 107 107 slot.setValue(registerAt(entry.getIndex()).get()); … … 113 113 inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot, bool& slotIsWriteable) 114 114 { 115 SymbolTableEntry entry = symbolTable().inlineGet(propertyName. impl());115 SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); 116 116 if (!entry.isNull()) { 117 117 slot.setValue(registerAt(entry.getIndex()).get()); … … 127 127 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); 128 128 129 SymbolTableEntry entry = symbolTable().inlineGet(propertyName. impl());129 SymbolTableEntry entry = symbolTable().inlineGet(propertyName.publicName()); 130 130 if (entry.isNull()) 131 131 return false; … … 143 143 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); 144 144 145 SymbolTable::iterator iter = symbolTable().find(propertyName. impl());145 SymbolTable::iterator iter = symbolTable().find(propertyName.publicName()); 146 146 if (iter == symbolTable().end()) 147 147 return false; -
trunk/Source/JavaScriptCore/runtime/Lookup.cpp
r116828 r117859 77 77 return false; 78 78 79 JSFunction* function = JSFunction::create(exec, thisObj->globalObject(), entry->functionLength(), propertyName.ustring(), entry->function(), entry->intrinsic()); 79 StringImpl* name = propertyName.publicName(); 80 ASSERT(name); 81 82 JSFunction* function = JSFunction::create(exec, thisObj->globalObject(), entry->functionLength(), name, entry->function(), entry->intrinsic()); 80 83 thisObj->putDirect(exec->globalData(), propertyName, function, entry->attributes()); 81 84 location = thisObj->getDirectLocation(exec->globalData(), propertyName); -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r116828 r117859 200 200 201 201 private: 202 ALWAYS_INLINE const HashEntry* entry(PropertyName identifier) const 203 { 202 ALWAYS_INLINE const HashEntry* entry(PropertyName propertyName) const 203 { 204 StringImpl* impl = propertyName.publicName(); 205 if (!impl) 206 return 0; 207 204 208 ASSERT(table); 205 209 206 const HashEntry* entry = &table[i dentifier.impl()->existingHash() & compactHashSizeMask];210 const HashEntry* entry = &table[impl->existingHash() & compactHashSizeMask]; 207 211 208 212 if (!entry->key()) … … 210 214 211 215 do { 212 if (entry->key() == i dentifier.impl())216 if (entry->key() == impl) 213 217 return entry; 214 218 entry = entry->next(); -
trunk/Source/JavaScriptCore/runtime/PropertyMapHashTable.h
r92569 r117859 326 326 { 327 327 ASSERT(key); 328 ASSERT(key->isIdentifier() );328 ASSERT(key->isIdentifier() || key->isEmptyUnique()); 329 329 unsigned hash = key->existingHash(); 330 330 unsigned step = 0; … … 370 370 if (entryIndex == EmptyEntryIndex) 371 371 return std::make_pair((ValueType*)0, hash & m_indexMask); 372 if (equal(key, table()[entryIndex - 1].key)) 372 const KeyType& keyInMap = table()[entryIndex - 1].key; 373 if (equal(key, keyInMap) && keyInMap->isIdentifier()) 373 374 return std::make_pair(&table()[entryIndex - 1], hash & m_indexMask); 374 375 -
trunk/Source/JavaScriptCore/runtime/PropertyName.h
r116926 r117859 28 28 29 29 #include "Identifier.h" 30 #include "PrivateName.h" 30 31 31 32 namespace JSC { … … 81 82 : m_impl(propertyName.impl()) 82 83 { 84 ASSERT(!m_impl || m_impl->isIdentifier()); 83 85 } 84 86 85 StringImpl* impl() const { return m_impl; } 86 UString ustring() const { return m_impl; } 87 PropertyName(const PrivateName& propertyName) 88 : m_impl(propertyName.uid()) 89 { 90 ASSERT(m_impl && m_impl->isEmptyUnique()); 91 } 92 93 StringImpl* uid() const 94 { 95 ASSERT(!m_impl || (m_impl->isIdentifier() == !m_impl->isEmptyUnique())); 96 return m_impl; 97 } 98 99 StringImpl* publicName() const 100 { 101 ASSERT(!m_impl || (m_impl->isIdentifier() == !m_impl->isEmptyUnique())); 102 return m_impl->isIdentifier() ? m_impl : 0; 103 } 87 104 88 105 static const uint32_t NotAnIndex = UINT_MAX; 106 89 107 uint32_t asIndex() 90 108 { 91 return toUInt32FromStringImpl(m_impl); 109 ASSERT(!m_impl || (m_impl->isIdentifier() == !m_impl->isEmptyUnique())); 110 return m_impl ? toUInt32FromStringImpl(m_impl) : NotAnIndex; 92 111 } 93 112 … … 98 117 inline bool operator==(PropertyName a, const Identifier& b) 99 118 { 100 return a. impl() == b.impl();119 return a.uid() == b.impl(); 101 120 } 102 121 103 122 inline bool operator==(const Identifier& a, PropertyName b) 104 123 { 105 return a.impl() == b. impl();124 return a.impl() == b.uid(); 106 125 } 107 126 108 127 inline bool operator==(PropertyName a, PropertyName b) 109 128 { 110 return a. impl() == b.impl();129 return a.uid() == b.uid(); 111 130 } 112 131 113 132 inline bool operator!=(PropertyName a, const Identifier& b) 114 133 { 115 return a. impl() != b.impl();134 return a.uid() != b.impl(); 116 135 } 117 136 118 137 inline bool operator!=(const Identifier& a, PropertyName b) 119 138 { 120 return a.impl() != b. impl();139 return a.impl() != b.uid(); 121 140 } 122 141 123 142 inline bool operator!=(PropertyName a, PropertyName b) 124 143 { 125 return a. impl() != b.impl();144 return a.uid() != b.uid(); 126 145 } 127 146 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r117343 r117859 276 276 void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, PropertyName propertyName) 277 277 { 278 StringImpl* rep = propertyName. impl();278 StringImpl* rep = propertyName.uid(); 279 279 280 280 materializePropertyMapIfNecessary(globalData); … … 293 293 ASSERT(structure->isObject()); 294 294 295 if (Structure* existingTransition = structure->m_transitionTable.get(propertyName. impl(), attributes)) {295 if (Structure* existingTransition = structure->m_transitionTable.get(propertyName.uid(), attributes)) { 296 296 JSCell* specificValueInPrevious = existingTransition->m_specificValueInPrevious.get(); 297 297 if (specificValueInPrevious && specificValueInPrevious != specificValue) … … 314 314 // in us adding a non-specific transition, and any subsequent lookup in 315 315 // Structure::addPropertyTransitionToExistingStructure will just use that. 316 if (specificValue && structure->m_transitionTable.contains(propertyName. impl(), attributes))316 if (specificValue && structure->m_transitionTable.contains(propertyName.uid(), attributes)) 317 317 specificValue = 0; 318 318 … … 337 337 transition->m_cachedPrototypeChain.setMayBeNull(globalData, transition, structure->m_cachedPrototypeChain.get()); 338 338 transition->m_previous.set(globalData, transition, structure); 339 transition->m_nameInPrevious = propertyName. impl();339 transition->m_nameInPrevious = propertyName.uid(); 340 340 transition->m_attributesInPrevious = attributes; 341 341 transition->m_specificValueInPrevious.setMayBeNull(globalData, transition, specificValue); … … 426 426 427 427 ASSERT(structure->m_propertyTable); 428 PropertyMapEntry* entry = structure->m_propertyTable->find(propertyName. impl()).first;428 PropertyMapEntry* entry = structure->m_propertyTable->find(propertyName.uid()).first; 429 429 ASSERT(entry); 430 430 entry->attributes = attributes; … … 651 651 return WTF::notFound; 652 652 653 PropertyMapEntry* entry = m_propertyTable->find(propertyName. impl()).first;653 PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first; 654 654 if (!entry) 655 655 return WTF::notFound; … … 666 666 return false; 667 667 668 PropertyMapEntry* entry = m_propertyTable->find(propertyName. impl()).first;668 PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first; 669 669 if (!entry) 670 670 return false; … … 694 694 m_hasNonEnumerableProperties = true; 695 695 696 StringImpl* rep = propertyName. impl();696 StringImpl* rep = propertyName.uid(); 697 697 698 698 if (!m_propertyTable) … … 716 716 checkConsistency(); 717 717 718 StringImpl* rep = propertyName. impl();718 StringImpl* rep = propertyName.uid(); 719 719 720 720 if (!m_propertyTable) … … 754 754 for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) { 755 755 ASSERT(m_hasNonEnumerableProperties || !(iter->attributes & DontEnum)); 756 if ( !(iter->attributes & DontEnum) || (mode == IncludeDontEnumProperties)) {756 if (iter->key->isIdentifier() && (!(iter->attributes & DontEnum) || mode == IncludeDontEnumProperties)) { 757 757 if (knownUnique) 758 758 propertyNames.addKnownUnique(iter->key); -
trunk/Source/JavaScriptCore/runtime/Structure.h
r117343 r117859 318 318 return notFound; 319 319 320 PropertyMapEntry* entry = m_propertyTable->find(propertyName. impl()).first;320 PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first; 321 321 return entry ? entry->offset : notFound; 322 322 } -
trunk/Source/WTF/ChangeLog
r117815 r117859 1 2012-05-15 Gavin Barraclough <barraclough@apple.com> 2 3 Add support for private names 4 https://bugs.webkit.org/show_bug.cgi?id=86509 5 6 Reviewed by Oliver Hunt. 7 8 The spec isn't final, but we can start adding support to allow property maps 9 to contain keys that aren't identifiers. 10 11 * wtf/text/StringImpl.h: 12 (WTF::StringImpl::StringImpl): 13 (StringImpl): 14 (WTF::StringImpl::createEmptyUnique): 15 (WTF::StringImpl::isEmptyUnique): 16 - Allow empty string impls to be allocated, which can be used as unique keys. 17 1 18 2012-05-21 Emil A Eklund <eae@chromium.org> and Levi Weintraub <leviw@chromium.org> 2 19 -
trunk/Source/WTF/wtf/text/StringImpl.h
r115669 r117859 158 158 // Create a StringImpl adopting ownership of the provided buffer (BufferOwned) 159 159 StringImpl(const UChar* characters, unsigned length) 160 : m_refCount(s_refCountIncrement)161 , m_length(length)162 , m_data16(characters)163 , m_buffer(0)164 , m_hashAndFlags(BufferOwned)160 : m_refCount(s_refCountIncrement) 161 , m_length(length) 162 , m_data16(characters) 163 , m_buffer(0) 164 , m_hashAndFlags(BufferOwned) 165 165 { 166 166 ASSERT(m_data16); … … 194 194 ASSERT(m_length); 195 195 ASSERT(m_substringBuffer->bufferOwnership() != BufferSubstring); 196 } 197 198 enum CreateEmptyUnique_T { CreateEmptyUnique }; 199 StringImpl(CreateEmptyUnique_T) 200 : m_refCount(s_refCountIncrement) 201 , m_length(0) 202 , m_data16(reinterpret_cast<const UChar*>(1)) 203 , m_buffer(0) 204 { 205 ASSERT(m_data16); 206 // Set the hash early, so that all empty unique StringImpls have a hash, 207 // and don't use the normal hashing algorithm - the unique nature of these 208 // keys means that we don't need them to match any other string (in fact, 209 // that's exactly the oposite of what we want!), and teh normal hash would 210 // lead to lots of conflicts. 211 unsigned hash = reinterpret_cast<uintptr_t>(this); 212 hash <<= s_flagCount; 213 if (!hash) 214 hash = 1 << s_flagCount; 215 m_hashAndFlags = hash | BufferInternal; 196 216 } 197 217 … … 258 278 } 259 279 280 static PassRefPtr<StringImpl> createEmptyUnique() 281 { 282 return adoptRef(new StringImpl(CreateEmptyUnique)); 283 } 284 260 285 // Reallocate the StringImpl. The originalString must be only owned by the PassRefPtr, 261 286 // and the buffer ownership must be BufferInternal. Just like the input pointer of realloc(), … … 324 349 else 325 350 m_hashAndFlags &= ~s_hashFlagIsIdentifier; 351 } 352 353 bool isEmptyUnique() const 354 { 355 return !length() && !isStatic(); 326 356 } 327 357 -
trunk/Source/WebCore/ChangeLog
r117858 r117859 1 2012-05-15 Gavin Barraclough <barraclough@apple.com> 2 3 Add support for private names 4 https://bugs.webkit.org/show_bug.cgi?id=86509 5 6 Reviewed by Oliver Hunt. 7 8 The spec isn't final, but we can start adding support to allow property maps 9 to contain keys that aren't identifiers. 10 11 Test: fast/js/names.html 12 13 * bindings/js/JSCSSStyleDeclarationCustom.cpp: 14 (WebCore::cssPropertyIDForJSCSSPropertyName): 15 * bindings/js/JSDOMBinding.cpp: 16 (WebCore::findAtomicString): 17 (WebCore::objectToStringFunctionGetter): 18 * bindings/js/JSDOMBinding.h: 19 (WebCore::propertyNameToString): 20 (WebCore::propertyNameToAtomicString): 21 * bindings/js/JSDOMWindowCustom.cpp: 22 (WebCore::nonCachingStaticFunctionGetter): 23 * bindings/js/JSHistoryCustom.cpp: 24 (WebCore::nonCachingStaticBackFunctionGetter): 25 (WebCore::nonCachingStaticForwardFunctionGetter): 26 (WebCore::nonCachingStaticGoFunctionGetter): 27 * bindings/js/JSLocationCustom.cpp: 28 (WebCore::nonCachingStaticReplaceFunctionGetter): 29 (WebCore::nonCachingStaticReloadFunctionGetter): 30 (WebCore::nonCachingStaticAssignFunctionGetter): 31 * bridge/c/c_class.cpp: 32 (JSC::Bindings::CClass::methodsNamed): 33 (JSC::Bindings::CClass::fieldNamed): 34 * bridge/c/c_instance.cpp: 35 (JSC::Bindings::CInstance::getMethod): 36 * bridge/jni/jsc/JavaClassJSC.cpp: 37 (JavaClass::methodsNamed): 38 (JavaClass::fieldNamed): 39 * bridge/jni/jsc/JavaInstanceJSC.cpp: 40 * bridge/objc/objc_class.mm: 41 (JSC::Bindings::ObjcClass::methodsNamed): 42 (JSC::Bindings::ObjcClass::fieldNamed): 43 (JSC::Bindings::ObjcClass::fallbackObject): 44 * bridge/objc/objc_instance.mm: 45 (ObjcInstance::setValueOfUndefinedField): 46 (ObjcInstance::getValueOfUndefinedField): 47 - Removed PropertyName::impl(), call publicName() to get the string associated with a name. 48 1 49 2012-05-21 Tim Horton <timothy_horton@apple.com> 2 50 -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r116828 r117859 182 182 bool hadPixelOrPosPrefix = false; 183 183 184 StringImpl* propertyNameString = propertyName.impl(); 184 StringImpl* propertyNameString = propertyName.publicName(); 185 if (!propertyNameString) 186 return propertyInfo; 185 187 unsigned length = propertyNameString->length(); 186 188 if (!length) -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r116828 r117859 110 110 AtomicStringImpl* findAtomicString(PropertyName propertyName) 111 111 { 112 StringImpl* impl = propertyName. impl();112 StringImpl* impl = propertyName.publicName(); 113 113 if (!impl) 114 114 return 0; … … 246 246 JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 247 247 { 248 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName. impl(), objectProtoFuncToString);248 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), objectProtoFuncToString); 249 249 } 250 250 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r117795 r117859 374 374 inline String propertyNameToString(JSC::PropertyName propertyName) 375 375 { 376 return propertyName. impl();376 return propertyName.publicName(); 377 377 } 378 378 … … 384 384 inline AtomicString propertyNameToAtomicString(JSC::PropertyName propertyName) 385 385 { 386 return AtomicString(propertyName. impl());386 return AtomicString(propertyName.publicName()); 387 387 } 388 388 -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r117646 r117859 95 95 JSValue nonCachingStaticFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 96 96 { 97 return JSFunction::create(exec, exec->lexicalGlobalObject(), length, propertyName. impl(), nativeFunction);97 return JSFunction::create(exec, exec->lexicalGlobalObject(), length, propertyName.publicName(), nativeFunction); 98 98 } 99 99 -
trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp
r116828 r117859 41 41 static JSValue nonCachingStaticBackFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 42 42 { 43 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName. impl(), jsHistoryPrototypeFunctionBack);43 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionBack); 44 44 } 45 45 46 46 static JSValue nonCachingStaticForwardFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 47 47 { 48 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName. impl(), jsHistoryPrototypeFunctionForward);48 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionForward); 49 49 } 50 50 51 51 static JSValue nonCachingStaticGoFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 52 52 { 53 return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName. impl(), jsHistoryPrototypeFunctionGo);53 return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsHistoryPrototypeFunctionGo); 54 54 } 55 55 -
trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp
r116828 r117859 33 33 static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 34 34 { 35 return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName. impl(), jsLocationPrototypeFunctionReplace);35 return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionReplace); 36 36 } 37 37 38 38 static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 39 39 { 40 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName. impl(), jsLocationPrototypeFunctionReload);40 return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsLocationPrototypeFunctionReload); 41 41 } 42 42 43 43 static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName) 44 44 { 45 return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName. impl(), jsLocationPrototypeFunctionAssign);45 return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionAssign); 46 46 } 47 47 -
trunk/Source/WebCore/bridge/c/c_class.cpp
r116828 r117859 74 74 } 75 75 76 MethodList CClass::methodsNamed(PropertyName identifier, Instance* instance) const76 MethodList CClass::methodsNamed(PropertyName propertyName, Instance* instance) const 77 77 { 78 UString name( identifier.impl());78 UString name(propertyName.publicName()); 79 79 80 80 MethodList methodList; … … 101 101 } 102 102 103 Field* CClass::fieldNamed(PropertyName identifier, Instance* instance) const103 Field* CClass::fieldNamed(PropertyName propertyName, Instance* instance) const 104 104 { 105 UString name( identifier.impl());105 UString name(propertyName.publicName()); 106 106 107 107 Field* aField = _fields.get(name.impl()); -
trunk/Source/WebCore/bridge/c/c_instance.cpp
r116828 r117859 150 150 { 151 151 MethodList methodList = getClass()->methodsNamed(propertyName, this); 152 return CRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName. impl(), methodList);152 return CRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName.publicName(), methodList); 153 153 } 154 154 -
trunk/Source/WebCore/bridge/jni/jsc/JavaClassJSC.cpp
r116828 r117859 115 115 } 116 116 117 MethodList JavaClass::methodsNamed(PropertyName identifier, Instance*) const117 MethodList JavaClass::methodsNamed(PropertyName propertyName, Instance*) const 118 118 { 119 MethodList* methodList = m_methods.get( identifier.ustring().impl());119 MethodList* methodList = m_methods.get(propertyName.publicName()); 120 120 121 121 if (methodList) … … 124 124 } 125 125 126 Field* JavaClass::fieldNamed(PropertyName identifier, Instance*) const126 Field* JavaClass::fieldNamed(PropertyName propertyName, Instance*) const 127 127 { 128 return m_fields.get( identifier.ustring().impl());128 return m_fields.get(propertyName.publicName()); 129 129 } 130 130 -
trunk/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
r116828 r117859 154 154 { 155 155 MethodList methodList = getClass()->methodsNamed(propertyName, this); 156 return JavaRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName. ustring(), methodList);156 return JavaRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName.publicName(), methodList); 157 157 } 158 158 -
trunk/Source/WebCore/bridge/objc/objc_class.mm
r116828 r117859 96 96 } 97 97 98 MethodList ObjcClass::methodsNamed(PropertyName identifier, Instance*) const 99 { 98 MethodList ObjcClass::methodsNamed(PropertyName propertyName, Instance*) const 99 { 100 UString name(propertyName.publicName()); 101 if (name.isNull()) 102 return MethodList(); 103 100 104 MethodList methodList; 101 if (Method* method = m_methodCache.get( identifier.impl())) {105 if (Method* method = m_methodCache.get(name.impl())) { 102 106 methodList.append(method); 103 107 return methodList; 104 108 } 105 109 106 CString jsName = identifier.ustring().ascii();110 CString jsName = name.ascii(); 107 111 JSNameConversionBuffer buffer; 108 112 convertJSMethodNameToObjc(jsName, buffer); … … 133 137 OwnPtr<Method> method = adoptPtr(new ObjcMethod(thisClass, objcMethodSelector)); 134 138 methodList.append(method.get()); 135 m_methodCache.add( identifier.impl(), method.release());139 m_methodCache.add(name.impl(), method.release()); 136 140 break; 137 141 } … … 144 148 } 145 149 146 Field* ObjcClass::fieldNamed(PropertyName identifier, Instance* instance) const 147 { 148 Field* field = m_fieldCache.get(identifier.impl()); 150 Field* ObjcClass::fieldNamed(PropertyName propertyName, Instance* instance) const 151 { 152 UString name(propertyName.publicName()); 153 if (name.isNull()) 154 return 0; 155 156 Field* field = m_fieldCache.get(name.impl()); 149 157 if (field) 150 158 return field; … … 152 160 ClassStructPtr thisClass = _isa; 153 161 154 CString jsName = identifier.ustring().ascii();162 CString jsName = name.ascii(); 155 163 RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, jsName.data(), kCFStringEncodingASCII)); 156 164 id targetObject = (static_cast<ObjcInstance*>(instance))->getObject(); … … 178 186 OwnPtr<Field> newField = adoptPtr(new ObjcField((CFStringRef)keyName)); 179 187 field = newField.get(); 180 m_fieldCache.add( identifier.impl(), newField.release());188 m_fieldCache.add(name.impl(), newField.release()); 181 189 break; 182 190 } … … 209 217 OwnPtr<Field> newField = adoptPtr(new ObjcField(objcIVar)); 210 218 field = newField.get(); 211 m_fieldCache.add( identifier.impl(), newField.release());219 m_fieldCache.add(name.impl(), newField.release()); 212 220 break; 213 221 } … … 229 237 if (![targetObject respondsToSelector:@selector(invokeUndefinedMethodFromWebScript:withArguments:)]) 230 238 return jsUndefined(); 231 return ObjcFallbackObjectImp::create(exec, exec->lexicalGlobalObject(), objcInstance, propertyName. impl());232 } 233 234 } 235 } 239 return ObjcFallbackObjectImp::create(exec, exec->lexicalGlobalObject(), objcInstance, propertyName.publicName()); 240 } 241 242 } 243 } -
trunk/Source/WebCore/bridge/objc/objc_instance.mm
r116828 r117859 219 219 { 220 220 MethodList methodList = getClass()->methodsNamed(propertyName, this); 221 return ObjCRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName. ustring(), methodList);221 return ObjCRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName.publicName(), methodList); 222 222 } 223 223 … … 402 402 } 403 403 404 bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, PropertyName property, JSValue aValue) 405 { 404 bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, PropertyName propertyName, JSValue aValue) 405 { 406 UString name(propertyName.publicName()); 407 if (name.isNull()) 408 return false; 409 406 410 id targetObject = getObject(); 407 411 if (![targetObject respondsToSelector:@selector(setValue:forUndefinedKey:)]) … … 419 423 420 424 @try { 421 [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString: property.ustring().ascii().data() encoding:NSASCIIStringEncoding]];425 [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:name.ascii().data() encoding:NSASCIIStringEncoding]]; 422 426 } @catch(NSException* localException) { 423 427 // Do nothing. Class did not override valueForUndefinedKey:. … … 430 434 } 431 435 432 JSValue ObjcInstance::getValueOfUndefinedField(ExecState* exec, PropertyName property) const 433 { 436 JSValue ObjcInstance::getValueOfUndefinedField(ExecState* exec, PropertyName propertyName) const 437 { 438 UString name(propertyName.publicName()); 439 if (name.isNull()) 440 return jsUndefined(); 441 434 442 JSValue result = jsUndefined(); 435 443 … … 445 453 446 454 @try { 447 id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString: property.ustring().ascii().data() encoding:NSASCIIStringEncoding]];455 id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString:name.ascii().data() encoding:NSASCIIStringEncoding]]; 448 456 result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, m_rootObject.get()); 449 457 } @catch(NSException* localException) { -
trunk/Source/WebCore/bridge/qt/qt_class.cpp
r116828 r117859 71 71 QtInstance* qtinst = static_cast<QtInstance*>(inst); 72 72 73 const UString& ustring = identifier.ustring();73 UString ustring(identifier.publicName()); 74 74 const QByteArray name = QString(reinterpret_cast<const QChar*>(ustring.characters()), ustring.length()).toAscii(); 75 75 … … 134 134 135 135 QObject* obj = qtinst->getObject(); 136 const UString& ustring = identifier.ustring();136 UString ustring(identifier.publicName()); 137 137 const QString name(reinterpret_cast<const QChar*>(ustring.characters()), ustring.length()); 138 138 const QByteArray ascii = name.toAscii(); -
trunk/Source/WebCore/bridge/qt/qt_instance.cpp
r116828 r117859 254 254 return jsNull(); 255 255 MethodList methodList = m_class->methodsNamed(propertyName, this); 256 return RuntimeMethod::create(exec, exec->lexicalGlobalObject(), WebCore::deprecatedGetDOMStructure<RuntimeMethod>(exec), propertyName. ustring(), methodList);256 return RuntimeMethod::create(exec, exec->lexicalGlobalObject(), WebCore::deprecatedGetDOMStructure<RuntimeMethod>(exec), propertyName.publicName(), methodList); 257 257 } 258 258 -
trunk/Source/WebCore/bridge/qt/qt_pixmapruntime.cpp
r116828 r117859 243 243 { 244 244 MethodList methodList = getClass()->methodsNamed(propertyName, this); 245 return RuntimeMethod::create(exec, exec->lexicalGlobalObject(), WebCore::deprecatedGetDOMStructure<RuntimeMethod>(exec), propertyName. ustring(), methodList);245 return RuntimeMethod::create(exec, exec->lexicalGlobalObject(), WebCore::deprecatedGetDOMStructure<RuntimeMethod>(exec), propertyName.publicName(), methodList); 246 246 } 247 247 … … 260 260 { 261 261 MethodList methods; 262 if (identifier.ustring() == QtPixmapToDataUrlMethod::name()) 262 UString ustring(identifier.publicName()); 263 if (ustring == QtPixmapToDataUrlMethod::name()) 263 264 methods.append(&qt_pixmap_metaData.toDataUrlMethod); 264 else if ( identifier.ustring()== QtPixmapToImageDataMethod::name())265 else if (ustring == QtPixmapToImageDataMethod::name()) 265 266 methods.append(&qt_pixmap_metaData.toImageDataMethod); 266 else if ( identifier.ustring()== QtPixmapAssignToElementMethod::name())267 else if (ustring == QtPixmapAssignToElementMethod::name()) 267 268 methods.append(&qt_pixmap_metaData.assignToElementMethod); 268 else if ( identifier.ustring()== QtPixmapToStringMethod::name())269 else if (ustring == QtPixmapToStringMethod::name()) 269 270 methods.append(&qt_pixmap_metaData.toStringMethod); 270 271 return methods; … … 273 274 Field* QtPixmapClass::fieldNamed(PropertyName identifier, Instance*) const 274 275 { 275 if (identifier.ustring() == QtPixmapWidthField::name()) 276 UString ustring(identifier.publicName()); 277 if (ustring == QtPixmapWidthField::name()) 276 278 return &qt_pixmap_metaData.widthField; 277 if ( identifier.ustring()== QtPixmapHeightField::name())279 if (ustring == QtPixmapHeightField::name()) 278 280 return &qt_pixmap_metaData.heightField; 279 281 return 0; -
trunk/Source/WebCore/bridge/qt/qt_runtime.cpp
r117650 r117859 1522 1522 1523 1523 if (!d->m_connect) 1524 d->m_connect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident. impl(), true, d->m_instance, d->m_index, d->m_signature));1524 d->m_connect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident.publicName(), true, d->m_instance, d->m_index, d->m_signature)); 1525 1525 return d->m_connect.get(); 1526 1526 } … … 1532 1532 1533 1533 if (!d->m_disconnect) 1534 d->m_disconnect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident. impl(), false, d->m_instance, d->m_index, d->m_signature));1534 d->m_disconnect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident.publicName(), false, d->m_instance, d->m_index, d->m_signature)); 1535 1535 return d->m_disconnect.get(); 1536 1536 } -
trunk/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp
r117650 r117859 1531 1531 1532 1532 if (!d->m_connect) 1533 d->m_connect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident. ustring(), true, d->m_instance, d->m_index, d->m_signature));1533 d->m_connect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident.publicName(), true, d->m_instance, d->m_index, d->m_signature)); 1534 1534 return d->m_connect.get(); 1535 1535 } … … 1541 1541 1542 1542 if (!d->m_disconnect) 1543 d->m_disconnect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident. ustring(), false, d->m_instance, d->m_index, d->m_signature));1543 d->m_disconnect.set(exec->globalData(), thisObj, QtRuntimeConnectionMethod::create(exec, ident.publicName(), false, d->m_instance, d->m_index, d->m_signature)); 1544 1544 return d->m_disconnect.get(); 1545 1545 } -
trunk/Source/WebKit/mac/ChangeLog
r117771 r117859 1 2012-05-15 Gavin Barraclough <barraclough@apple.com> 2 3 Add support for private names 4 https://bugs.webkit.org/show_bug.cgi?id=86509 5 6 Reviewed by Oliver Hunt. 7 8 The spec isn't final, but we can start adding support to allow property maps 9 to contain keys that aren't identifiers. 10 11 * Plugins/Hosted/ProxyInstance.mm: 12 (WebKit::ProxyClass::methodsNamed): 13 (WebKit::ProxyClass::fieldNamed): 14 (WebKit::ProxyInstance::getMethod): 15 (WebKit::ProxyInstance::methodsNamed): 16 (WebKit::ProxyInstance::fieldNamed): 17 - Removed PropertyName::impl(), call publicName() to get the string associated with a name. 18 1 19 2012-05-21 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 20 -
trunk/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
r116828 r117859 55 55 }; 56 56 57 MethodList ProxyClass::methodsNamed(PropertyName identifier, Instance* instance) const58 { 59 return static_cast<ProxyInstance*>(instance)->methodsNamed( identifier);60 } 61 62 Field* ProxyClass::fieldNamed(PropertyName identifier, Instance* instance) const63 { 64 return static_cast<ProxyInstance*>(instance)->fieldNamed( identifier);57 MethodList ProxyClass::methodsNamed(PropertyName propertyName, Instance* instance) const 58 { 59 return static_cast<ProxyInstance*>(instance)->methodsNamed(propertyName); 60 } 61 62 Field* ProxyClass::fieldNamed(PropertyName propertyName, Instance* instance) const 63 { 64 return static_cast<ProxyInstance*>(instance)->fieldNamed(propertyName); 65 65 } 66 66 … … 217 217 { 218 218 MethodList methodList = getClass()->methodsNamed(propertyName, this); 219 return ProxyRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName. impl(), methodList);219 return ProxyRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName.publicName(), methodList); 220 220 } 221 221 … … 347 347 } 348 348 349 MethodList ProxyInstance::methodsNamed(PropertyName identifier) 350 { 351 if (!m_instanceProxy) 349 MethodList ProxyInstance::methodsNamed(PropertyName propertyName) 350 { 351 UString name(propertyName.publicName()); 352 if (name.isNull()) 352 353 return MethodList(); 354 355 if (!m_instanceProxy) 356 return MethodList(); 353 357 354 358 // If we already have an entry in the map, use it. 355 MethodMap::iterator existingMapEntry = m_methods.find( identifier.impl());359 MethodMap::iterator existingMapEntry = m_methods.find(name.impl()); 356 360 if (existingMapEntry != m_methods.end()) { 357 361 MethodList methodList; … … 361 365 } 362 366 363 uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier( identifier.ustring().ascii().data()));367 uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(name.ascii().data())); 364 368 uint32_t requestID = m_instanceProxy->nextRequestID(); 365 369 … … 377 381 378 382 // Add a new entry to the map unless an entry was added while we were in waitForReply. 379 MethodMap::AddResult mapAddResult = m_methods.add( identifier.impl(), 0);383 MethodMap::AddResult mapAddResult = m_methods.add(name.impl(), 0); 380 384 if (mapAddResult.isNewEntry && reply->m_result) 381 385 mapAddResult.iterator->second = new ProxyMethod(methodName); … … 387 391 } 388 392 389 Field* ProxyInstance::fieldNamed(PropertyName identifier) 390 { 391 if (!m_instanceProxy) 393 Field* ProxyInstance::fieldNamed(PropertyName propertyName) 394 { 395 UString name(propertyName.publicName()); 396 if (name.isNull()) 392 397 return 0; 398 399 if (!m_instanceProxy) 400 return 0; 393 401 394 402 // If we already have an entry in the map, use it. 395 FieldMap::iterator existingMapEntry = m_fields.find( identifier.impl());403 FieldMap::iterator existingMapEntry = m_fields.find(name.impl()); 396 404 if (existingMapEntry != m_fields.end()) 397 405 return existingMapEntry->second; 398 406 399 uint64_t propertyName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ustring().ascii().data()));407 uint64_t identifier = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(name.ascii().data())); 400 408 uint32_t requestID = m_instanceProxy->nextRequestID(); 401 409 402 410 if (_WKPHNPObjectHasProperty(m_instanceProxy->hostProxy()->port(), 403 411 m_instanceProxy->pluginID(), requestID, 404 m_objectID, propertyName) != KERN_SUCCESS)412 m_objectID, identifier) != KERN_SUCCESS) 405 413 return 0; 406 414 … … 413 421 414 422 // Add a new entry to the map unless an entry was added while we were in waitForReply. 415 FieldMap::AddResult mapAddResult = m_fields.add( identifier.impl(), 0);423 FieldMap::AddResult mapAddResult = m_fields.add(name.impl(), 0); 416 424 if (mapAddResult.isNewEntry && reply->m_result) 417 mapAddResult.iterator->second = new ProxyField( propertyName);425 mapAddResult.iterator->second = new ProxyField(identifier); 418 426 return mapAddResult.iterator->second; 419 427 } -
trunk/Source/WebKit2/ChangeLog
r117820 r117859 1 2012-05-15 Gavin Barraclough <barraclough@apple.com> 2 3 Add support for private names 4 https://bugs.webkit.org/show_bug.cgi?id=86509 5 6 Reviewed by Oliver Hunt. 7 8 The spec isn't final, but we can start adding support to allow property maps 9 to contain keys that aren't identifiers. 10 11 * WebProcess/Plugins/Netscape/JSNPObject.cpp: 12 (WebKit::npIdentifierFromIdentifier): 13 (WebKit::JSNPObject::methodGetter): 14 - Removed PropertyName::impl(), call publicName() to get the string associated with a name. 15 1 16 2012-05-21 Hugo Parente Lima <hugo.lima@openbossa.org> 2 17 -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
r117212 r117859 46 46 namespace WebKit { 47 47 48 static NPIdentifier npIdentifierFromIdentifier(PropertyName identifier) 49 { 50 return static_cast<NPIdentifier>(IdentifierRep::get(identifier.ustring().utf8().data())); 48 static NPIdentifier npIdentifierFromIdentifier(PropertyName propertyName) 49 { 50 UString name(propertyName.publicName()); 51 if (name.isNull()) 52 return 0; 53 return static_cast<NPIdentifier>(IdentifierRep::get(name.utf8().data())); 51 54 } 52 55 … … 475 478 } 476 479 477 JSValue JSNPObject::methodGetter(ExecState* exec, JSValue slotBase, PropertyName methodName)480 JSValue JSNPObject::methodGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName) 478 481 { 479 482 JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase)); … … 483 486 return throwInvalidAccessError(exec); 484 487 485 NPIdentifier npIdentifier = npIdentifierFromIdentifier( methodName);486 return JSNPMethod::create(exec, thisObj->globalObject(), methodName.ustring(), npIdentifier);488 NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); 489 return JSNPMethod::create(exec, thisObj->globalObject(), propertyName.publicName(), npIdentifier); 487 490 } 488 491
Note: See TracChangeset
for help on using the changeset viewer.