Skip to content
  • barraclough@apple.com's avatar
    Most built-in properties are not deletable · dfe18a56
    barraclough@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=61014
    
    Reviewed by Filip Pizlo.
    
    Source/JavaScriptCore: 
    
    Our static hash tables don't allow for deleting properties.
    This is the cause of a bunch of expected failures in LayoutTests/sputnik.
    
    This fixes the problem by reifying all static functions immediately prior
    to the first deletion.  Reification is tracked by a flag on the structure,
    so properties will no longer 'bounce-back' on later access.
    
    Theoretically there could probably also be an issue with custom accessor
    properties, but we probably do not really require any of these to be
    Configurable anyway. I'll follow up with a separate patch to address this.
    
    * runtime/ClassInfo.h:
    (JSC::ClassInfo::hasStaticProperties):
        - detects static property tables.
    * runtime/JSObject.cpp:
    (JSC::JSObject::deleteProperty):
        - call reifyStaticFunctions before deletion.
    (JSC::JSObject::reifyStaticFunctions):
        - If the class has static functions, set them up now.
    * runtime/JSObject.h:
    (JSC::JSObject::staticFunctionsReified):
        - returns true if static functions have been reified,
          and as such should no longer be added.
    * runtime/Lookup.cpp:
    (JSC::setUpStaticFunctionSlot):
        - If static functions have been reified do not add.
    * runtime/Lookup.h:
    (JSC::HashTable::ConstIterator::ConstIterator):
    (JSC::HashTable::ConstIterator::operator->):
    (JSC::HashTable::ConstIterator::operator*):
    (JSC::HashTable::ConstIterator::operator!=):
    (JSC::HashTable::ConstIterator::operator++):
    (JSC::HashTable::ConstIterator::skipInvalidKeys):
    (JSC::HashTable::begin):
    (JSC::HashTable::end):
    (JSC::getStaticPropertySlot):
    (JSC::getStaticPropertyDescriptor):
    (JSC::getStaticFunctionSlot):
    (JSC::getStaticFunctionDescriptor):
        - setUpStaticFunctionSlot may not add, returns a bool.
    (JSC::lookupPut):
        - remove redundant branch.
    * runtime/Structure.cpp:
    (JSC::Structure::Structure):
        - initialize new flag in constructors.
    * runtime/Structure.h:
    (JSC::Structure::staticFunctionsReified):
    (JSC::Structure::setStaticFunctionsReified):
        - added flag
    
    LayoutTests: 
    
    Mostly checking in passing results, added a couple of extra test cases to fast/js/delete-syntax.
    
    * fast/js/delete-syntax-expected.txt:
    * fast/js/script-tests/delete-syntax.js:
    * ietestcenter/Javascript/11.4.1-4.a-10-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.4_Array/15.4.4/S15.4.4_A1.1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/S15.5.4.1_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/S15.5.4_A1-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/S15.5.4_A3-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.2/S15.6.2.1_A4-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.3/15.6.3.1_Boolean.prototype/S15.6.3.1_A1-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.4/S15.6.4_A1-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.2/S15.7.2.1_A4-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.3/15.7.3.1_Number.prototype/S15.7.3.1_A2_T1-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.4/S15.7.4_A1-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.2_Date.parse/S15.9.4.2_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.3_Date.UTC/S15.9.4.3_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.10_Date.prototype.getFullYear/S15.9.5.10_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.11_Date.prototype.getUTCFullYear/S15.9.5.11_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.12_Date.prototype.getMonth/S15.9.5.12_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.13_Date.prototype.getUTCMonth/S15.9.5.13_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.14_Date.prototype.getDate/S15.9.5.14_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.15_Date.prototype.getUTCDate/S15.9.5.15_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.16_Date.prototype.getDay/S15.9.5.16_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.17_Date.prototype.getUTCDay/S15.9.5.17_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.18_Date.prototype.getHours/S15.9.5.18_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.19_Date.prototype.getUTCHours/S15.9.5.19_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.20_Date.prototype.getMinutes/S15.9.5.20_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.21_Date.prototype.getUTCMinutes/S15.9.5.21_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.22_Date.prototype.getSeconds/S15.9.5.22_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.23_Date.prototype.getUTCSeconds/S15.9.5.23_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.24_Date.prototype.getMilliseconds/S15.9.5.24_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.25_Date.prototype.getUTCMilliseconds/S15.9.5.25_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.26_Date.prototype.getTimezoneOffset/S15.9.5.26_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.27_Date.prototype.setTime/S15.9.5.27_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.28_Date.prototype.setMilliseconds/S15.9.5.28_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.29_Date.prototype.setUTCMilliseconds/S15.9.5.29_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.2_Date.prototype.toString/S15.9.5.2_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.30_Date.prototype.setSeconds/S15.9.5.30_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.31_Date.prototype.setUTCSeconds/S15.9.5.31_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.32_Date.prototype.setMinutes/S15.9.5.32_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.33_Date.prototype.setUTCMinutes/S15.9.5.33_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.34_Date.prototype.setHours/S15.9.5.34_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.35_Date.prototype.setUTCHours/S15.9.5.35_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.36_Date.prototype.setDate/S15.9.5.36_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.37_Date.prototype.setUTCDate/S15.9.5.37_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.38_Date.prototype.setMonth/S15.9.5.38_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.39_Date.prototype.setUTCMonth/S15.9.5.39_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.3_Date.prototype.toDateString/S15.9.5.3_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.40_Date.prototype.setFullYear/S15.9.5.40_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.41_Date.prototype.setUTCFullYear/S15.9.5.41_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.42_Date.prototype.toUTCString/S15.9.5.42_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.4_Date.prototype.toTimeString/S15.9.5.4_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.5_Date.prototype.toLocaleString/S15.9.5.5_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.6_Date.prototype.toLocaleDateString/S15.9.5.6_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.7_Date.prototype.toLocaleTimeString/S15.9.5.7_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.8_Date.prototype.valueOf/S15.9.5.8_A1_T2-expected.txt:
    * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.9_Date.prototype.getTime/S15.9.5.9_A1_T2-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    dfe18a56