Changeset 179429 in webkit
- Timestamp:
- Jan 30, 2015 5:23:56 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 18 added
- 2 deleted
- 52 edited
- 7 copied
- 7 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r179425 r179429 1 2015-01-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Implement ES6 Symbol 4 https://bugs.webkit.org/show_bug.cgi?id=140435 5 6 Reviewed by Geoffrey Garen. 7 8 * js/script-tests/symbol-abstract-equality-comparison.js: Added. 9 (Pair): 10 (relationalOperators.forEach): 11 * js/script-tests/symbol-abstract-relational-comparison.js: Added. 12 (relationalOperators.forEach): 13 * js/script-tests/symbol-in-map.js: Added. 14 (set shouldBe): 15 * js/script-tests/symbol-object.js: Added. 16 * js/script-tests/symbol-prototype-is-ordinary-object.js: Added. 17 * js/script-tests/symbol-strict-equality-comparison.js: Added. 18 (Pair): 19 (relationalOperators.forEach): 20 * js/script-tests/symbol-tostring.js: Added. 21 * js/script-tests/symbols.js: Renamed from LayoutTests/js/script-tests/names.js. 22 (forIn): 23 * js/symbol-abstract-equality-comparison-expected.txt: Added. 24 * js/symbol-abstract-equality-comparison.html: Copied from LayoutTests/js/names.html. 25 * js/symbol-abstract-relational-comparison-expected.txt: Added. 26 * js/symbol-abstract-relational-comparison.html: Copied from LayoutTests/js/names.html. 27 * js/symbol-in-map-expected.txt: Added. 28 * js/symbol-in-map.html: Copied from LayoutTests/js/names.html. 29 * js/symbol-object-expected.txt: Added. 30 * js/symbol-object.html: Copied from LayoutTests/js/names.html. 31 * js/symbol-prototype-is-ordinary-object-expected.txt: Added. 32 * js/symbol-prototype-is-ordinary-object.html: Copied from LayoutTests/js/names.html. 33 * js/symbol-strict-equality-comparison-expected.txt: Added. 34 * js/symbol-strict-equality-comparison.html: Copied from LayoutTests/js/names.html. 35 * js/symbol-tostring-expected.txt: Added. 36 * js/symbol-tostring.html: Copied from LayoutTests/js/names.html. 37 * js/symbols-expected.txt: Renamed from LayoutTests/js/names-expected.txt. 38 * js/symbols.html: Renamed from LayoutTests/js/names.html. 39 1 40 2015-01-30 Dariusz Frankiewicz <d.frankiewic@samsung.com> 2 41 -
trunk/LayoutTests/js/script-tests/symbols.js
r179427 r179429 1 1 description( 2 "This tests an early experimental implementation of ES6-esque private names."2 "This tests an early experimental implementation of ES6-esque Symbols." 3 3 ); 4 4 … … 11 11 } 12 12 13 var prop = Name("prop");13 var prop = Symbol("prop"); 14 14 var o = {}; 15 15 -
trunk/LayoutTests/js/symbol-abstract-equality-comparison.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbol-abstract-equality-comparison.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/LayoutTests/js/symbol-abstract-relational-comparison.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbol-abstract-relational-comparison.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/LayoutTests/js/symbol-in-map.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbol-in-map.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/LayoutTests/js/symbol-object.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbol-object.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/LayoutTests/js/symbol-prototype-is-ordinary-object.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbol-prototype-is-ordinary-object.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/LayoutTests/js/symbol-strict-equality-comparison.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbol-strict-equality-comparison.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/LayoutTests/js/symbol-tostring.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbol-tostring.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/LayoutTests/js/symbols-expected.txt
r179427 r179429 1 This tests an early experimental implementation of ES6-esque private names.1 This tests an early experimental implementation of ES6-esque Symbols. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -
trunk/LayoutTests/js/symbols.html
r179427 r179429 5 5 </head> 6 6 <body> 7 <script src="script-tests/ names.js"></script>7 <script src="script-tests/symbols.js"></script> 8 8 <script src="../resources/js-test-post.js"></script> 9 9 </body> -
trunk/Source/JavaScriptCore/CMakeLists.txt
r179392 r179429 509 509 runtime/MathObject.cpp 510 510 runtime/MemoryStatistics.cpp 511 runtime/NameConstructor.cpp512 runtime/NameInstance.cpp513 runtime/NamePrototype.cpp514 511 runtime/NativeErrorConstructor.cpp 515 512 runtime/NativeErrorPrototype.cpp … … 552 549 runtime/StructureIDTable.cpp 553 550 runtime/StructureRareData.cpp 551 runtime/Symbol.cpp 552 runtime/SymbolObject.cpp 553 runtime/SymbolPrototype.cpp 554 runtime/SymbolConstructor.cpp 554 555 runtime/SymbolTable.cpp 555 556 runtime/TestRunnerUtils.cpp … … 585 586 runtime/JSPromiseConstructor.cpp 586 587 runtime/JSPromisePrototype.cpp 587 runtime/NamePrototype.cpp588 588 runtime/NumberConstructor.cpp 589 589 runtime/NumberPrototype.cpp … … 593 593 runtime/RegExpPrototype.cpp 594 594 runtime/StringConstructor.cpp 595 runtime/SymbolPrototype.cpp 595 596 ) 596 597 -
trunk/Source/JavaScriptCore/ChangeLog
r179426 r179429 1 2015-01-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Implement ES6 Symbol 4 https://bugs.webkit.org/show_bug.cgi?id=140435 5 6 Reviewed by Geoffrey Garen. 7 8 This patch implements ES6 Symbol. In this patch, we don't support 9 Symbol.keyFor, Symbol.for, Object.getOwnPropertySymbols. They will be 10 supported in the subsequent patches. 11 12 Since ES6 Symbol is introduced as new primitive value, we implement 13 Symbol as a derived class from JSCell. And now JSValue accepts Symbol* 14 as a new primitive value. 15 16 Symbol has a *unique* flagged StringImpl* as an `uid`. Which pointer 17 value represents the Symbol's identity. So don't compare Symbol's 18 JSCell pointer value for comparison. 19 This enables re-producing Symbol primitive value from StringImpl* uid 20 by executing`Symbol::create(vm, uid)`. This is needed to produce 21 Symbol primitive values from stored StringImpl* in `Object.getOwnPropertySymbols`. 22 23 And Symbol.[[Description]] is folded into the string value of Symbol's uid. 24 By doing so, we can represent ES6 Symbol without extending current PropertyTable key; StringImpl*. 25 26 * CMakeLists.txt: 27 * DerivedSources.make: 28 * JavaScriptCore.order: 29 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 30 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 31 * JavaScriptCore.xcodeproj/project.pbxproj: 32 * builtins/BuiltinExecutables.cpp: 33 (JSC::BuiltinExecutables::createBuiltinExecutable): 34 * builtins/BuiltinNames.h: 35 * dfg/DFGOperations.cpp: 36 (JSC::DFG::operationPutByValInternal): 37 * inspector/JSInjectedScriptHost.cpp: 38 (Inspector::JSInjectedScriptHost::subtype): 39 * interpreter/Interpreter.cpp: 40 * jit/JITOperations.cpp: 41 (JSC::getByVal): 42 * llint/LLIntData.cpp: 43 (JSC::LLInt::Data::performAssertions): 44 * llint/LLIntSlowPaths.cpp: 45 (JSC::LLInt::getByVal): 46 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 47 * llint/LowLevelInterpreter.asm: 48 * runtime/CommonIdentifiers.h: 49 * runtime/CommonSlowPaths.cpp: 50 (JSC::SLOW_PATH_DECL): 51 * runtime/CommonSlowPaths.h: 52 (JSC::CommonSlowPaths::opIn): 53 * runtime/ExceptionHelpers.cpp: 54 (JSC::createUndefinedVariableError): 55 * runtime/JSCJSValue.cpp: 56 (JSC::JSValue::synthesizePrototype): 57 (JSC::JSValue::dumpInContextAssumingStructure): 58 (JSC::JSValue::toStringSlowCase): 59 * runtime/JSCJSValue.h: 60 * runtime/JSCJSValueInlines.h: 61 (JSC::JSValue::isSymbol): 62 (JSC::JSValue::isPrimitive): 63 (JSC::JSValue::toPropertyKey): 64 65 It represents ToPropertyKey abstract operation in the ES6 spec. 66 It cleans up the old implementation's `isName` checks. 67 And to prevent performance regressions in 68 js/regress/fold-get-by-id-to-multi-get-by-offset-rare-int.html 69 js/regress/fold-get-by-id-to-multi-get-by-offset.html 70 we annnotate this function as ALWAYS_INLINE. 71 72 (JSC::JSValue::getPropertySlot): 73 (JSC::JSValue::get): 74 (JSC::JSValue::equalSlowCaseInline): 75 (JSC::JSValue::strictEqualSlowCaseInline): 76 * runtime/JSCell.cpp: 77 (JSC::JSCell::put): 78 (JSC::JSCell::putByIndex): 79 (JSC::JSCell::toPrimitive): 80 (JSC::JSCell::getPrimitiveNumber): 81 (JSC::JSCell::toNumber): 82 (JSC::JSCell::toObject): 83 * runtime/JSCell.h: 84 * runtime/JSCellInlines.h: 85 (JSC::JSCell::isSymbol): 86 (JSC::JSCell::toBoolean): 87 (JSC::JSCell::pureToBoolean): 88 * runtime/JSGlobalObject.cpp: 89 (JSC::JSGlobalObject::init): 90 (JSC::JSGlobalObject::visitChildren): 91 * runtime/JSGlobalObject.h: 92 (JSC::JSGlobalObject::symbolPrototype): 93 (JSC::JSGlobalObject::symbolObjectStructure): 94 * runtime/JSONObject.cpp: 95 (JSC::Stringifier::Stringifier): 96 * runtime/JSSymbolTableObject.cpp: 97 (JSC::JSSymbolTableObject::getOwnNonIndexPropertyNames): 98 * runtime/JSType.h: 99 * runtime/JSTypeInfo.h: 100 (JSC::TypeInfo::isName): Deleted. 101 * runtime/MapData.cpp: 102 (JSC::MapData::find): 103 (JSC::MapData::add): 104 (JSC::MapData::remove): 105 (JSC::MapData::replaceAndPackBackingStore): 106 * runtime/MapData.h: 107 (JSC::MapData::clear): 108 * runtime/NameInstance.h: Removed. 109 * runtime/NamePrototype.cpp: Removed. 110 * runtime/ObjectConstructor.cpp: 111 (JSC::objectConstructorGetOwnPropertyDescriptor): 112 (JSC::objectConstructorDefineProperty): 113 * runtime/ObjectPrototype.cpp: 114 (JSC::objectProtoFuncHasOwnProperty): 115 (JSC::objectProtoFuncDefineGetter): 116 (JSC::objectProtoFuncDefineSetter): 117 (JSC::objectProtoFuncLookupGetter): 118 (JSC::objectProtoFuncLookupSetter): 119 (JSC::objectProtoFuncPropertyIsEnumerable): 120 * runtime/Operations.cpp: 121 (JSC::jsTypeStringForValue): 122 (JSC::jsIsObjectType): 123 * runtime/PrivateName.h: 124 (JSC::PrivateName::PrivateName): 125 (JSC::PrivateName::operator==): 126 (JSC::PrivateName::operator!=): 127 * runtime/PropertyMapHashTable.h: 128 (JSC::PropertyTable::find): 129 (JSC::PropertyTable::get): 130 * runtime/PropertyName.h: 131 (JSC::PropertyName::PropertyName): 132 (JSC::PropertyName::publicName): 133 * runtime/SmallStrings.h: 134 * runtime/StringConstructor.cpp: 135 (JSC::callStringConstructor): 136 137 In ES6, String constructor accepts Symbol to execute `String(symbol)`. 138 139 * runtime/Structure.cpp: 140 (JSC::Structure::getPropertyNamesFromStructure): 141 * runtime/StructureInlines.h: 142 (JSC::Structure::prototypeForLookup): 143 * runtime/Symbol.cpp: Added. 144 (JSC::Symbol::Symbol): 145 (JSC::SymbolObject::create): 146 (JSC::Symbol::toPrimitive): 147 (JSC::Symbol::toBoolean): 148 (JSC::Symbol::getPrimitiveNumber): 149 (JSC::Symbol::toObject): 150 (JSC::Symbol::toNumber): 151 (JSC::Symbol::destroy): 152 (JSC::Symbol::descriptiveString): 153 * runtime/Symbol.h: Added. 154 (JSC::Symbol::createStructure): 155 (JSC::Symbol::create): 156 (JSC::Symbol::privateName): 157 (JSC::Symbol::finishCreation): 158 (JSC::asSymbol): 159 * runtime/SymbolConstructor.cpp: Renamed from Source/JavaScriptCore/runtime/NameConstructor.cpp. 160 (JSC::SymbolConstructor::SymbolConstructor): 161 (JSC::SymbolConstructor::finishCreation): 162 (JSC::callSymbol): 163 (JSC::SymbolConstructor::getConstructData): 164 (JSC::SymbolConstructor::getCallData): 165 * runtime/SymbolConstructor.h: Renamed from Source/JavaScriptCore/runtime/NameConstructor.h. 166 (JSC::SymbolConstructor::create): 167 (JSC::SymbolConstructor::createStructure): 168 * runtime/SymbolObject.cpp: Renamed from Source/JavaScriptCore/runtime/NameInstance.cpp. 169 (JSC::SymbolObject::SymbolObject): 170 (JSC::SymbolObject::finishCreation): 171 (JSC::SymbolObject::defaultValue): 172 173 Now JSC doesn't support @@toPrimitive. So instead of it, we implement 174 Symbol.prototype[@@toPrimitive] as ES5 Symbol.[[DefaultValue]]. 175 176 * runtime/SymbolObject.h: Added. 177 (JSC::SymbolObject::create): 178 (JSC::SymbolObject::internalValue): 179 (JSC::SymbolObject::createStructure): 180 * runtime/SymbolPrototype.cpp: Added. 181 (JSC::SymbolPrototype::SymbolPrototype): 182 (JSC::SymbolPrototype::finishCreation): 183 (JSC::SymbolPrototype::getOwnPropertySlot): 184 (JSC::symbolProtoFuncToString): 185 (JSC::symbolProtoFuncValueOf): 186 * runtime/SymbolPrototype.h: Renamed from Source/JavaScriptCore/runtime/NamePrototype.h. 187 (JSC::SymbolPrototype::create): 188 (JSC::SymbolPrototype::createStructure): 189 190 SymbolPrototype object is ordinary JS object. Not wrapper object of Symbol. 191 It is tested in js/symbol-prototype-is-ordinary-object.html. 192 193 * runtime/VM.cpp: 194 (JSC::VM::VM): 195 * runtime/VM.h: 196 1 197 2015-01-30 Geoffrey Garen <ggaren@apple.com> 2 198 -
trunk/Source/JavaScriptCore/DerivedSources.make
r178631 r179429 49 49 KeywordLookup.h \ 50 50 Lexer.lut.h \ 51 NamePrototype.lut.h \52 51 NumberConstructor.lut.h \ 53 52 NumberPrototype.lut.h \ … … 58 57 RegExpObject.lut.h \ 59 58 StringConstructor.lut.h \ 59 SymbolPrototype.lut.h \ 60 60 udis86_itab.h \ 61 61 Bytecodes.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.order
r175078 r179429 4600 4600 __ZN3JSC4Yarr13YarrGeneratorILNS0_18YarrJITCompileModeE1EE33generatePatternCharacterNonGreedyEm 4601 4601 __ZN3JSC4Yarr13YarrGeneratorILNS0_18YarrJITCompileModeE1EE34backtrackPatternCharacterNonGreedyEm 4602 __ZN3JSC13NamePrototypeC1EPNS_9ExecStateEPNS_9StructureE4603 __ZN3JSC12NameInstanceC2ERNS_2VMEPNS_9StructureEPNS_8JSStringE4604 __ZN3JSC13NamePrototype14finishCreationEPNS_9ExecStateE4605 __ZN3JSC15NameConstructorC1EPNS_14JSGlobalObjectEPNS_9StructureE4606 __ZN3JSC15NameConstructor14finishCreationEPNS_9ExecStateEPNS_13NamePrototypeE4607 4602 _JSStringIsEqualToUTF8CString 4608 4603 _JSStringIsEqual 4609 __ZN3JSC12NameInstance7destroyEPNS_6JSCellE4610 4604 __ZN3WTF3MD5C1Ev 4611 4605 __ZN3WTF3MD58addBytesEPKhm … … 4757 4751 __ZN3JSC11JSNameScope3putEPNS_6JSCellEPNS_9ExecStateENS_12PropertyNameENS_7JSValueERNS_15PutPropertySlotE 4758 4752 __ZN3JSC14symbolTablePutINS_11JSNameScopeEEEbPT_PNS_9ExecStateENS_12PropertyNameENS_7JSValueEb 4759 __ZN3JSC15NameConstructor11getCallDataEPNS_6JSCellERNS_8CallDataE4760 4753 __ZN3JSCL20constructPrivateNameEPNS_9ExecStateE 4761 __ZN3JSC12NameInstanceC1ERNS_2VMEPNS_9StructureEPNS_8JSStringE4762 4754 __ZN3JSCL29objectProtoFuncToLocaleStringEPNS_9ExecStateE 4763 4755 __ZN3JSC13JSNotAnObject24getOwnPropertyDescriptorEPNS_8JSObjectEPNS_9ExecStateENS_12PropertyNameERNS_18PropertyDescriptorE -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r179392 r179429 774 774 <ClCompile Include="..\runtime\MathObject.cpp" /> 775 775 <ClCompile Include="..\runtime\MemoryStatistics.cpp" /> 776 <ClCompile Include="..\runtime\NameConstructor.cpp" />777 <ClCompile Include="..\runtime\NameInstance.cpp" />778 <ClCompile Include="..\runtime\NamePrototype.cpp" />779 776 <ClCompile Include="..\runtime\NativeErrorConstructor.cpp" /> 780 777 <ClCompile Include="..\runtime\NativeErrorPrototype.cpp" /> … … 817 814 <ClCompile Include="..\runtime\StructureIDTable.cpp" /> 818 815 <ClCompile Include="..\runtime\StructureRareData.cpp" /> 816 <ClCompile Include="..\runtime\Symbol.cpp" /> 817 <ClCompile Include="..\runtime\SymbolConstructor.cpp" /> 818 <ClCompile Include="..\runtime\SymbolObject.cpp" /> 819 <ClCompile Include="..\runtime\SymbolPrototype.cpp" /> 819 820 <ClCompile Include="..\runtime\SymbolTable.cpp" /> 820 821 <ClCompile Include="..\runtime\TestRunnerUtils.cpp" /> … … 864 865 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\KeywordLookup.lut.h" /> 865 866 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\Lexer.lut.h" /> 866 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\NamePrototype.lut.h" />867 867 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\NumberConstructor.lut.h" /> 868 868 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\NumberPrototype.lut.h" /> … … 873 873 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\RegExpPrototype.lut.h" /> 874 874 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\StringConstructor.lut.h" /> 875 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SymbolPrototype.lut.h" /> 875 876 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCBuiltins.h" /> 876 877 </ItemGroup> … … 1569 1570 <ClInclude Include="..\runtime\MemoryStatistics.h" /> 1570 1571 <ClInclude Include="..\runtime\Microtask.h" /> 1571 <ClInclude Include="..\runtime\NameConstructor.h" />1572 <ClInclude Include="..\runtime\NameInstance.h" />1573 <ClInclude Include="..\runtime\NamePrototype.h" />1574 1572 <ClInclude Include="..\runtime\NativeErrorConstructor.h" /> 1575 1573 <ClInclude Include="..\runtime\NativeErrorPrototype.h" /> … … 1626 1624 <ClInclude Include="..\runtime\StructureRareDataInlines.h" /> 1627 1625 <ClInclude Include="..\runtime\StructureTransitionTable.h" /> 1626 <ClInclude Include="..\runtime\Symbol.h" /> 1627 <ClInclude Include="..\runtime\SymbolConstructor.h" /> 1628 <ClInclude Include="..\runtime\SymbolObject.h" /> 1629 <ClInclude Include="..\runtime\SymbolPrototype.h" /> 1628 1630 <ClInclude Include="..\runtime\SymbolTable.h" /> 1629 1631 <ClInclude Include="..\runtime\TestRunnerUtils.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r179211 r179429 742 742 <Filter>runtime</Filter> 743 743 </ClCompile> 744 <ClCompile Include="..\runtime\NameConstructor.cpp">745 <Filter>runtime</Filter>746 </ClCompile>747 <ClCompile Include="..\runtime\NameInstance.cpp">748 <Filter>runtime</Filter>749 </ClCompile>750 <ClCompile Include="..\runtime\NamePrototype.cpp">751 <Filter>runtime</Filter>752 </ClCompile>753 744 <ClCompile Include="..\runtime\NativeErrorConstructor.cpp"> 754 745 <Filter>runtime</Filter> … … 860 851 </ClCompile> 861 852 <ClCompile Include="..\runtime\StructureIDTable.cpp"> 853 <Filter>runtime</Filter> 854 </ClCompile> 855 <ClCompile Include="..\runtime\Symbol.cpp"> 856 <Filter>runtime</Filter> 857 </ClInclude> 858 <ClCompile Include="..\runtime\SymbolConstructor.cpp"> 859 <Filter>runtime</Filter> 860 </ClCompile> 861 <ClCompile Include="..\runtime\SymbolObject.cpp"> 862 <Filter>runtime</Filter> 863 </ClCompile> 864 <ClCompile Include="..\runtime\SymbolPrototype.cpp"> 862 865 <Filter>runtime</Filter> 863 866 </ClCompile> … … 2760 2763 <Filter>runtime</Filter> 2761 2764 </ClInclude> 2762 <ClInclude Include="..\runtime\NameConstructor.h">2763 <Filter>runtime</Filter>2764 </ClInclude>2765 <ClInclude Include="..\runtime\NameInstance.h">2766 <Filter>runtime</Filter>2767 </ClInclude>2768 <ClInclude Include="..\runtime\NamePrototype.h">2769 <Filter>runtime</Filter>2770 </ClInclude>2771 2765 <ClInclude Include="..\runtime\NativeErrorConstructor.h"> 2772 2766 <Filter>runtime</Filter> … … 2902 2896 </ClInclude> 2903 2897 <ClInclude Include="..\runtime\StructureTransitionTable.h"> 2898 <Filter>runtime</Filter> 2899 </ClInclude> 2900 <ClInclude Include="..\runtime\Symbol.h"> 2901 <Filter>runtime</Filter> 2902 </ClInclude> 2903 <ClInclude Include="..\runtime\SymbolConstructor.h"> 2904 <Filter>runtime</Filter> 2905 </ClInclude> 2906 <ClInclude Include="..\runtime\SymbolObject.h"> 2907 <Filter>runtime</Filter> 2908 </ClInclude> 2909 <ClInclude Include="..\runtime\SymbolPrototype.h"> 2904 2910 <Filter>runtime</Filter> 2905 2911 </ClInclude> … … 3250 3256 <Filter>Derived Sources</Filter> 3251 3257 </ClInclude> 3252 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ NamePrototype.lut.h">3258 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SymbolPrototype.lut.h"> 3253 3259 <Filter>Derived Sources</Filter> 3254 3260 </ClInclude> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r179392 r179429 933 933 65FB5117184EEE7000C12B70 /* ProtoCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */; }; 934 934 6AD2CB4D19B9140100065719 /* DebuggerEvalEnabler.h in Headers */ = {isa = PBXBuildFile; fileRef = 6AD2CB4C19B9140100065719 /* DebuggerEvalEnabler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 935 705B41AB1A6E501E00716757 /* Symbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 705B41A31A6E501E00716757 /* Symbol.cpp */; }; 936 705B41AC1A6E501E00716757 /* Symbol.h in Headers */ = {isa = PBXBuildFile; fileRef = 705B41A41A6E501E00716757 /* Symbol.h */; settings = {ATTRIBUTES = (Private, ); }; }; 937 705B41AD1A6E501E00716757 /* SymbolConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 705B41A51A6E501E00716757 /* SymbolConstructor.cpp */; }; 938 705B41AE1A6E501E00716757 /* SymbolConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 705B41A61A6E501E00716757 /* SymbolConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; }; 939 705B41AF1A6E501E00716757 /* SymbolObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 705B41A71A6E501E00716757 /* SymbolObject.cpp */; }; 940 705B41B01A6E501E00716757 /* SymbolObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 705B41A81A6E501E00716757 /* SymbolObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 941 705B41B11A6E501E00716757 /* SymbolPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 705B41A91A6E501E00716757 /* SymbolPrototype.cpp */; }; 942 705B41B21A6E501E00716757 /* SymbolPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 705B41AA1A6E501E00716757 /* SymbolPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; }; 935 943 7C008CD2186F8A9300955C24 /* JSPromiseFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C008CD0186F8A9300955C24 /* JSPromiseFunctions.cpp */; }; 936 944 7C008CD3186F8A9300955C24 /* JSPromiseFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C008CD1186F8A9300955C24 /* JSPromiseFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1018 1026 86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C611167BAB87006D760A /* JSVirtualMachineInternal.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1019 1027 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E85538111B9968001AF51E /* JSStringBuilder.h */; }; 1020 86EBF2FF1560F06A008E9222 /* NameConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EBF2F91560F036008E9222 /* NameConstructor.cpp */; };1021 86EBF3001560F06A008E9222 /* NameConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EBF2FA1560F036008E9222 /* NameConstructor.h */; };1022 86EBF3011560F06A008E9222 /* NameInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EBF2FB1560F036008E9222 /* NameInstance.cpp */; };1023 86EBF3021560F06A008E9222 /* NameInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EBF2FC1560F036008E9222 /* NameInstance.h */; };1024 86EBF3031560F06A008E9222 /* NamePrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EBF2FD1560F036008E9222 /* NamePrototype.cpp */; };1025 86EBF3041560F06A008E9222 /* NamePrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EBF2FE1560F036008E9222 /* NamePrototype.h */; };1026 1028 86EC9DC41328DF82002B2AD7 /* DFGByteCodeParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EC9DB41328DF82002B2AD7 /* DFGByteCodeParser.cpp */; }; 1027 1029 86EC9DC51328DF82002B2AD7 /* DFGByteCodeParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EC9DB51328DF82002B2AD7 /* DFGByteCodeParser.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2600 2602 6AD2CB4C19B9140100065719 /* DebuggerEvalEnabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerEvalEnabler.h; sourceTree = "<group>"; }; 2601 2603 704FD35305697E6D003DBED9 /* BooleanObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BooleanObject.h; sourceTree = "<group>"; tabWidth = 8; }; 2604 705B41A31A6E501E00716757 /* Symbol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Symbol.cpp; sourceTree = "<group>"; }; 2605 705B41A41A6E501E00716757 /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = "<group>"; }; 2606 705B41A51A6E501E00716757 /* SymbolConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolConstructor.cpp; sourceTree = "<group>"; }; 2607 705B41A61A6E501E00716757 /* SymbolConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolConstructor.h; sourceTree = "<group>"; }; 2608 705B41A71A6E501E00716757 /* SymbolObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolObject.cpp; sourceTree = "<group>"; }; 2609 705B41A81A6E501E00716757 /* SymbolObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolObject.h; sourceTree = "<group>"; }; 2610 705B41A91A6E501E00716757 /* SymbolPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolPrototype.cpp; sourceTree = "<group>"; }; 2611 705B41AA1A6E501E00716757 /* SymbolPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolPrototype.h; sourceTree = "<group>"; }; 2602 2612 7C008CD0186F8A9300955C24 /* JSPromiseFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = JSPromiseFunctions.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 2603 2613 7C008CD1186F8A9300955C24 /* JSPromiseFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPromiseFunctions.h; sourceTree = "<group>"; }; … … 2697 2707 86E3C611167BAB87006D760A /* JSVirtualMachineInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVirtualMachineInternal.h; sourceTree = "<group>"; }; 2698 2708 86E85538111B9968001AF51E /* JSStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringBuilder.h; sourceTree = "<group>"; }; 2699 86EBF2F91560F036008E9222 /* NameConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameConstructor.cpp; sourceTree = "<group>"; };2700 86EBF2FA1560F036008E9222 /* NameConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NameConstructor.h; sourceTree = "<group>"; };2701 86EBF2FB1560F036008E9222 /* NameInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameInstance.cpp; sourceTree = "<group>"; };2702 86EBF2FC1560F036008E9222 /* NameInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NameInstance.h; sourceTree = "<group>"; };2703 86EBF2FD1560F036008E9222 /* NamePrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NamePrototype.cpp; sourceTree = "<group>"; };2704 86EBF2FE1560F036008E9222 /* NamePrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NamePrototype.h; sourceTree = "<group>"; };2705 2709 86EC9DB41328DF82002B2AD7 /* DFGByteCodeParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGByteCodeParser.cpp; path = dfg/DFGByteCodeParser.cpp; sourceTree = "<group>"; }; 2706 2710 86EC9DB51328DF82002B2AD7 /* DFGByteCodeParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGByteCodeParser.h; path = dfg/DFGByteCodeParser.h; sourceTree = "<group>"; }; … … 4441 4445 90213E3C123A40C200D422F3 /* MemoryStatistics.h */, 4442 4446 7C008CE5187631B600955C24 /* Microtask.h */, 4443 86EBF2F91560F036008E9222 /* NameConstructor.cpp */,4444 86EBF2FA1560F036008E9222 /* NameConstructor.h */,4445 86EBF2FB1560F036008E9222 /* NameInstance.cpp */,4446 86EBF2FC1560F036008E9222 /* NameInstance.h */,4447 86EBF2FD1560F036008E9222 /* NamePrototype.cpp */,4448 86EBF2FE1560F036008E9222 /* NamePrototype.h */,4449 4447 BC02E9080E1839DB000F9297 /* NativeErrorConstructor.cpp */, 4450 4448 BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */, … … 4544 4542 C20BA92C16BB1C1500B3AEA2 /* StructureRareDataInlines.h */, 4545 4543 BC9041470EB9250900FE26FA /* StructureTransitionTable.h */, 4544 705B41A31A6E501E00716757 /* Symbol.cpp */, 4545 705B41A41A6E501E00716757 /* Symbol.h */, 4546 705B41A51A6E501E00716757 /* SymbolConstructor.cpp */, 4547 705B41A61A6E501E00716757 /* SymbolConstructor.h */, 4548 705B41A71A6E501E00716757 /* SymbolObject.cpp */, 4549 705B41A81A6E501E00716757 /* SymbolObject.h */, 4550 705B41A91A6E501E00716757 /* SymbolPrototype.cpp */, 4551 705B41AA1A6E501E00716757 /* SymbolPrototype.h */, 4546 4552 0F919D2715856770004A4E7D /* SymbolTable.cpp */, 4547 4553 14A396A60CD2933100B5B4FF /* SymbolTable.h */, … … 6054 6060 7C008CE7187631B600955C24 /* Microtask.h in Headers */, 6055 6061 86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */, 6056 86EBF3001560F06A008E9222 /* NameConstructor.h in Headers */,6057 86EBF3021560F06A008E9222 /* NameInstance.h in Headers */,6058 86EBF3041560F06A008E9222 /* NamePrototype.h in Headers */,6059 6062 BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */, 6060 6063 BC02E9130E1839DB000F9297 /* NativeErrorPrototype.h in Headers */, … … 6215 6218 BC9041480EB9250900FE26FA /* StructureTransitionTable.h in Headers */, 6216 6219 C2DF44301707AC0100A5CA96 /* SuperRegion.h in Headers */, 6220 705B41AC1A6E501E00716757 /* Symbol.h in Headers */, 6221 705B41AE1A6E501E00716757 /* SymbolConstructor.h in Headers */, 6222 705B41B01A6E501E00716757 /* SymbolObject.h in Headers */, 6223 705B41B21A6E501E00716757 /* SymbolPrototype.h in Headers */, 6217 6224 BC18C46B0E16F5CD00B34460 /* SymbolTable.h in Headers */, 6218 6225 A784A26411D16622005776AC /* SyntaxChecker.h in Headers */, … … 7181 7188 90213E3D123A40C200D422F3 /* MemoryStatistics.cpp in Sources */, 7182 7189 0FB5467D14F5CFD6002C2989 /* MethodOfGettingAValueProfile.cpp in Sources */, 7183 86EBF2FF1560F06A008E9222 /* NameConstructor.cpp in Sources */,7184 86EBF3011560F06A008E9222 /* NameInstance.cpp in Sources */,7185 86EBF3031560F06A008E9222 /* NamePrototype.cpp in Sources */,7186 7190 14469DE0107EC7E700650446 /* NativeErrorConstructor.cpp in Sources */, 7187 7191 14469DE1107EC7E700650446 /* NativeErrorPrototype.cpp in Sources */, … … 7284 7288 BCCF0D0C0EF0B8A500413C8F /* StructureStubInfo.cpp in Sources */, 7285 7289 C2DF442F1707AC0100A5CA96 /* SuperRegion.cpp in Sources */, 7290 705B41AB1A6E501E00716757 /* Symbol.cpp in Sources */, 7291 705B41AD1A6E501E00716757 /* SymbolConstructor.cpp in Sources */, 7292 705B41AF1A6E501E00716757 /* SymbolObject.cpp in Sources */, 7293 705B41B11A6E501E00716757 /* SymbolPrototype.cpp in Sources */, 7286 7294 0F919D2815856773004A4E7D /* SymbolTable.cpp in Sources */, 7287 7295 0FC314131814559100033232 /* TempRegisterSet.cpp in Sources */, -
trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
r176825 r179429 76 76 if (closedVariable == m_vm.propertyNames->undefinedKeyword.impl()) 77 77 continue; 78 RELEASE_ASSERT(closedVariable->is EmptyUnique());78 RELEASE_ASSERT(closedVariable->isUnique()); 79 79 } 80 80 body->overrideName(name); -
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r164346 r179429 32 32 namespace JSC { 33 33 34 #define INITIALISE_BUILTIN_NAMES(name) , m_##name(vm, #name), m_##name##PrivateName(Identifier::from(PrivateName( )))34 #define INITIALISE_BUILTIN_NAMES(name) , m_##name(vm, #name), m_##name##PrivateName(Identifier::from(PrivateName(ASCIILiteral("Symbol." #name)))) 35 35 #define DECLARE_BUILTIN_NAMES(name) const Identifier m_##name; const Identifier m_##name##PrivateName;; 36 36 #define DECLARE_BUILTIN_IDENTIFIER_ACCESSOR(name) \ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r179392 r179429 49 49 #include "VM.h" 50 50 #include "JSNameScope.h" 51 #include "NameInstance.h"52 51 #include "ObjectConstructor.h" 53 52 #include "JSCInlines.h" 54 53 #include "Repatch.h" 55 54 #include "StringConstructor.h" 55 #include "Symbol.h" 56 56 #include "TypeProfilerLog.h" 57 57 #include "TypedArrayInlines.h" … … 111 111 } 112 112 113 if (isName(property)) {114 PutPropertySlot slot(baseValue, strict);115 if (direct) {116 RELEASE_ASSERT(baseValue.isObject());117 asObject(baseValue)->putDirect(*vm, jsCast<NameInstance*>(property.asCell())->privateName(), value, slot);118 } else119 baseValue.put(exec, jsCast<NameInstance*>(property.asCell())->privateName(), value, slot);120 return;121 }122 123 113 // Don't put to an object if toString throws an exception. 124 Identifier ident = property.toString(exec)->toIdentifier(exec);114 PropertyName propertyName = property.toPropertyKey(exec); 125 115 if (!vm->exception()) { 126 116 PutPropertySlot slot(baseValue, strict); 127 117 if (direct) { 128 118 RELEASE_ASSERT(baseValue.isObject()); 129 asObject(baseValue)->putDirect(*vm, ident, value, slot);119 asObject(baseValue)->putDirect(*vm, propertyName, value, slot); 130 120 } else 131 baseValue.put(exec, ident, value, slot);121 baseValue.put(exec, propertyName, value, slot); 132 122 } 133 123 } … … 307 297 } 308 298 309 if (isName(property)) 310 return JSValue::encode(baseValue.get(exec, jsCast<NameInstance*>(property.asCell())->privateName())); 311 312 Identifier ident = property.toString(exec)->toIdentifier(exec); 313 return JSValue::encode(baseValue.get(exec, ident)); 299 PropertyName propertyName = property.toPropertyKey(exec); 300 return JSValue::encode(baseValue.get(exec, propertyName)); 314 301 } 315 302 … … 338 325 } 339 326 340 if (isName(property)) 341 return JSValue::encode(JSValue(base).get(exec, jsCast<NameInstance*>(property.asCell())->privateName())); 342 343 Identifier ident = property.toString(exec)->toIdentifier(exec); 344 return JSValue::encode(JSValue(base).get(exec, ident)); 327 PropertyName propertyName = property.toPropertyKey(exec); 328 return JSValue::encode(JSValue(base).get(exec, propertyName)); 345 329 } 346 330 -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
r179349 r179429 123 123 if (value.isNumber()) 124 124 return exec->vm().smallStrings.numberString(); 125 if (value.isSymbol()) 126 return exec->vm().smallStrings.symbolString(); 125 127 126 128 JSObject* object = asObject(value); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r178856 r179429 55 55 #include "LegacyProfiler.h" 56 56 #include "LiteralParser.h" 57 #include "NameInstance.h"58 57 #include "ObjectPrototype.h" 59 58 #include "JSCInlines.h" … … 68 67 #include "StrictEvalActivation.h" 69 68 #include "StrongInlines.h" 69 #include "Symbol.h" 70 70 #include "VMEntryScope.h" 71 71 #include "VirtualRegister.h" -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r179392 r179429 160 160 VM* vm = &exec->vm(); 161 161 NativeCallFrameTracer tracer(vm, exec); 162 Identifier ident = uid->is EmptyUnique() ? Identifier::from(PrivateName(uid)) : Identifier(vm, uid);162 Identifier ident = uid->isUnique() ? Identifier::from(PrivateName(uid)) : Identifier(vm, uid); 163 163 164 164 JSValue baseValue = JSValue::decode(base); … … 467 467 } else 468 468 baseValue.putByIndex(callFrame, i, value, callFrame->codeBlock()->isStrictMode()); 469 } else if (isName(subscript)) {470 PutPropertySlot slot(baseValue, callFrame->codeBlock()->isStrictMode());471 baseValue.put(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);472 469 } else { 473 Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame);470 PropertyName property = subscript.toPropertyKey(callFrame); 474 471 if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception. 475 472 PutPropertySlot slot(baseValue, callFrame->codeBlock()->isStrictMode()); … … 484 481 uint32_t i = subscript.asUInt32(); 485 482 baseObject->putDirectIndex(callFrame, i, value); 486 } else if (isName(subscript)) {487 PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());488 baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);489 483 } else { 490 Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame);484 PropertyName property = subscript.toPropertyKey(callFrame); 491 485 if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception. 492 486 PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode()); … … 1468 1462 } 1469 1463 1470 if (isName(subscript)) 1471 return baseValue.get(exec, jsCast<NameInstance*>(subscript.asCell())->privateName()); 1472 1473 Identifier property = subscript.toString(exec)->toIdentifier(exec); 1464 PropertyName property = subscript.toPropertyKey(exec); 1474 1465 return baseValue.get(exec, property); 1475 1466 } … … 1606 1597 ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationGetByValDefault)); 1607 1598 } 1608 } else if (isName(subscript)) 1609 result = baseValue.get(exec, jsCast<NameInstance*>(subscript.asCell())->privateName()); 1610 else { 1611 Identifier property = subscript.toString(exec)->toIdentifier(exec); 1599 } else { 1600 PropertyName property = subscript.toPropertyKey(exec); 1612 1601 result = baseValue.get(exec, property); 1613 1602 } -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r178856 r179429 133 133 #endif 134 134 ASSERT(StringType == 6); 135 ASSERT(ObjectType == 1 7);136 ASSERT(FinalObjectType == 1 8);135 ASSERT(ObjectType == 18); 136 ASSERT(FinalObjectType == 19); 137 137 ASSERT(MasqueradesAsUndefined == 1); 138 138 ASSERT(ImplementsHasInstance == 2); -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r179392 r179429 745 745 } 746 746 747 if (isName(subscript)) 748 return baseValue.get(exec, jsCast<NameInstance*>(subscript.asCell())->privateName()); 749 750 Identifier property = subscript.toString(exec)->toIdentifier(exec); 747 PropertyName property = subscript.toPropertyKey(exec); 751 748 return baseValue.get(exec, property); 752 749 } … … 798 795 } 799 796 800 if (isName(subscript)) { 801 PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode()); 802 baseValue.put(exec, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 803 LLINT_END(); 804 } 805 806 Identifier property = subscript.toString(exec)->toIdentifier(exec); 797 PropertyName property = subscript.toPropertyKey(exec); 807 798 LLINT_CHECK_EXCEPTION(); 808 799 PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode()); … … 823 814 uint32_t i = subscript.asUInt32(); 824 815 baseObject->putDirectIndex(exec, i, value); 825 } else if (isName(subscript)) {826 PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());827 baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);828 816 } else { 829 Identifier property = subscript.toString(exec)->toIdentifier(exec);817 PropertyName property = subscript.toPropertyKey(exec); 830 818 if (!exec->vm().exception()) { // Don't put to an object if toString threw an exception. 831 819 PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode()); … … 849 837 if (subscript.getUInt32(i)) 850 838 couldDelete = baseObject->methodTable()->deletePropertyByIndex(baseObject, exec, i); 851 else if (isName(subscript))852 couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, jsCast<NameInstance*>(subscript.asCell())->privateName());853 839 else { 854 840 LLINT_CHECK_EXCEPTION(); 855 Identifier property = subscript.toString(exec)->toIdentifier(exec);841 PropertyName property = subscript.toPropertyKey(exec); 856 842 LLINT_CHECK_EXCEPTION(); 857 843 couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, property); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r178856 r179429 154 154 # Type constants. 155 155 const StringType = 6 156 const ObjectType = 1 7157 const FinalObjectType = 1 8156 const ObjectType = 18 157 const FinalObjectType = 19 158 158 159 159 # Type flags constants. -
trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r174066 r179429 53 53 macro(SetIterator)\ 54 54 macro(String) \ 55 macro(Symbol) \ 55 56 macro(SyntaxError) \ 56 57 macro(TypeError) \ … … 220 221 macro(yield) 221 222 223 #define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(macro) \ 224 macro(hasInstance) \ 225 macro(isConcatSpreadable) \ 226 macro(iterator) \ 227 macro(match) \ 228 macro(replace) \ 229 macro(search) \ 230 macro(species) \ 231 macro(split) \ 232 macro(toPrimitive) \ 233 macro(toStringTag) \ 234 macro(unscopable) 235 222 236 #define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \ 223 macro(iterator) \237 JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(macro) \ 224 238 macro(iteratorNext) \ 225 239 macro(resolve) \ -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r178143 r179429 487 487 if (subscript.getUInt32(i)) 488 488 couldDelete = baseObject->methodTable()->deletePropertyByIndex(baseObject, exec, i); 489 else if (isName(subscript))490 couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, jsCast<NameInstance*>(subscript.asCell())->privateName());491 489 else { 492 490 CHECK_EXCEPTION(); 493 Identifier property = subscript.toString(exec)->toIdentifier(exec);491 PropertyName property = subscript.toPropertyKey(exec); 494 492 CHECK_EXCEPTION(); 495 493 couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, property); … … 576 574 JSValue property = OP(3).jsValue(); 577 575 ASSERT(property.isString()); 578 RETURN(baseValue.get(exec, property.to String(exec)->toIdentifier(exec)));576 RETURN(baseValue.get(exec, property.toPropertyKey(exec))); 579 577 } 580 578 -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h
r178073 r179429 31 31 #include "ExceptionHelpers.h" 32 32 #include "JSStackInlines.h" 33 #include "NameInstance.h"34 33 #include "StackAlignment.h" 34 #include "Symbol.h" 35 35 #include "VM.h" 36 36 #include <wtf/StdLibExtras.h> … … 83 83 return baseObj->hasProperty(exec, i); 84 84 85 if (isName(propName)) 86 return baseObj->hasProperty(exec, jsCast<NameInstance*>(propName.asCell())->privateName()); 87 88 Identifier property = propName.toString(exec)->toIdentifier(exec); 85 PropertyName property = propName.toPropertyKey(exec); 89 86 if (exec->vm().exception()) 90 87 return false; -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
r173120 r179429 83 83 { 84 84 85 if (ident.impl()->is EmptyUnique()) {85 if (ident.impl()->isUnique()) { 86 86 String message(makeString("Can't find private variable: @", exec->propertyNames().getPublicName(ident).string())); 87 87 return createReferenceError(exec, message); -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r178928 r179429 100 100 { 101 101 if (isCell()) { 102 ASSERT(isString()); 103 return exec->lexicalGlobalObject()->stringPrototype(); 102 if (isString()) 103 return exec->lexicalGlobalObject()->stringPrototype(); 104 ASSERT(isSymbol()); 105 return exec->lexicalGlobalObject()->symbolPrototype(); 104 106 } 105 107 … … 232 234 if (impl->isAtomic()) 233 235 out.print(" (identifier)"); 234 if (impl->is EmptyUnique())236 if (impl->isUnique()) 235 237 out.print(" (unique)"); 236 238 } else … … 365 367 if (isUndefined()) 366 368 return vm.smallStrings.undefinedString(); 369 if (isSymbol()) { 370 throwTypeError(exec); 371 return jsEmptyString(exec); 372 } 367 373 368 374 ASSERT(isCell()); -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.h
r176676 r179429 218 218 bool isNumber() const; 219 219 bool isString() const; 220 bool isSymbol() const; 220 221 bool isPrimitive() const; 221 222 bool isGetterSetter() const; … … 243 244 double toNumber(ExecState*) const; 244 245 JSString* toString(ExecState*) const; 246 PropertyName toPropertyKey(ExecState*) const; 245 247 WTF::String toWTFString(ExecState*) const; 246 248 WTF::String toWTFStringInline(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r176676 r179429 27 27 #define JSValueInlines_h 28 28 29 #include "Identifier.h" 29 30 #include "InternalFunction.h" 30 31 #include "JSCJSValue.h" … … 550 551 } 551 552 553 inline bool JSValue::isSymbol() const 554 { 555 return isCell() && asCell()->isSymbol(); 556 } 557 552 558 inline bool JSValue::isPrimitive() const 553 559 { 554 return !isCell() || asCell()->isString() ;560 return !isCell() || asCell()->isString() || asCell()->isSymbol(); 555 561 } 556 562 … … 603 609 } 604 610 return false; 611 } 612 613 ALWAYS_INLINE PropertyName JSValue::toPropertyKey(ExecState* exec) const 614 { 615 if (isString()) 616 return asString(*this)->toIdentifier(exec); 617 618 JSValue primitive = toPrimitive(exec, PreferString); 619 if (primitive.isSymbol()) 620 return asSymbol(primitive)->privateName(); 621 return primitive.toString(exec)->toIdentifier(exec); 605 622 } 606 623 … … 693 710 JSObject* object; 694 711 if (UNLIKELY(!isObject())) { 695 if (is Cell() && asString(*this)->getStringPropertySlot(exec, propertyName, slot))712 if (isString() && asString(*this)->getStringPropertySlot(exec, propertyName, slot)) 696 713 return true; 697 714 object = synthesizePrototype(exec); … … 714 731 JSObject* object; 715 732 if (UNLIKELY(!isObject())) { 716 if (is Cell() && asString(*this)->getStringPropertySlot(exec, propertyName, slot))733 if (isString() && asString(*this)->getStringPropertySlot(exec, propertyName, slot)) 717 734 return slot.getValue(exec, propertyName); 718 735 object = synthesizePrototype(exec); … … 807 824 } 808 825 826 bool sym1 = v1.isSymbol(); 827 bool sym2 = v2.isSymbol(); 828 if (sym1 || sym2) { 829 if (sym1 && sym2) 830 return asSymbol(v1)->privateName() == asSymbol(v2)->privateName(); 831 return false; 832 } 833 809 834 if (s1 || s2) { 810 835 double d1 = v1.toNumber(exec); … … 832 857 if (v1.asCell()->isString() && v2.asCell()->isString()) 833 858 return WTF::equal(*asString(v1)->value(exec).impl(), *asString(v2)->value(exec).impl()); 859 if (v1.asCell()->isSymbol() && v2.asCell()->isSymbol()) 860 return asSymbol(v1)->privateName() == asSymbol(v2)->privateName(); 834 861 835 862 return v1 == v2; -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r172196 r179429 97 97 void JSCell::put(JSCell* cell, ExecState* exec, PropertyName identifier, JSValue value, PutPropertySlot& slot) 98 98 { 99 if (cell->isString() ) {99 if (cell->isString() || cell->isSymbol()) { 100 100 JSValue(cell).putToPrimitive(exec, identifier, value, slot); 101 101 return; … … 107 107 void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSValue value, bool shouldThrow) 108 108 { 109 if (cell->isString() ) {109 if (cell->isString() || cell->isSymbol()) { 110 110 PutPropertySlot slot(cell, shouldThrow); 111 111 JSValue(cell).putToPrimitive(exec, Identifier::from(exec, identifier), value, slot); … … 139 139 if (isString()) 140 140 return static_cast<const JSString*>(this)->toPrimitive(exec, preferredType); 141 if (isSymbol()) 142 return static_cast<const Symbol*>(this)->toPrimitive(exec, preferredType); 141 143 return static_cast<const JSObject*>(this)->toPrimitive(exec, preferredType); 142 144 } … … 146 148 if (isString()) 147 149 return static_cast<const JSString*>(this)->getPrimitiveNumber(exec, number, value); 150 if (isSymbol()) 151 return static_cast<const Symbol*>(this)->getPrimitiveNumber(exec, number, value); 148 152 return static_cast<const JSObject*>(this)->getPrimitiveNumber(exec, number, value); 149 153 } … … 153 157 if (isString()) 154 158 return static_cast<const JSString*>(this)->toNumber(exec); 159 if (isSymbol()) 160 return static_cast<const Symbol*>(this)->toNumber(exec); 155 161 return static_cast<const JSObject*>(this)->toNumber(exec); 156 162 } … … 160 166 if (isString()) 161 167 return static_cast<const JSString*>(this)->toObject(exec, globalObject); 168 if (isSymbol()) 169 return static_cast<const Symbol*>(this)->toObject(exec, globalObject); 162 170 ASSERT(isObject()); 163 171 return jsCast<JSObject*>(const_cast<JSCell*>(this)); -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r175593 r179429 86 86 // Querying the type. 87 87 bool isString() const; 88 bool isSymbol() const; 88 89 bool isObject() const; 89 90 bool isGetterSetter() const; -
trunk/Source/JavaScriptCore/runtime/JSCellInlines.h
r173706 r179429 36 36 #include "MarkedBlock.h" 37 37 #include "Structure.h" 38 #include "Symbol.h" 38 39 #include <wtf/CompilationThread.h> 39 40 … … 165 166 } 166 167 168 inline bool JSCell::isSymbol() const 169 { 170 return m_type == SymbolType; 171 } 172 167 173 inline bool JSCell::isGetterSetter() const 168 174 { … … 248 254 inline bool JSCell::toBoolean(ExecState* exec) const 249 255 { 250 if (isString()) 256 if (isString()) 251 257 return static_cast<const JSString*>(this)->toBoolean(); 258 if (isSymbol()) 259 return static_cast<const Symbol*>(this)->toBoolean(); 252 260 return !structure()->masqueradesAsUndefined(exec->lexicalGlobalObject()); 253 261 } … … 255 263 inline TriState JSCell::pureToBoolean() const 256 264 { 257 if (isString()) 265 if (isString()) 258 266 return static_cast<const JSString*>(this)->toBoolean() ? TrueTriState : FalseTriState; 267 if (isSymbol()) 268 return static_cast<const Symbol*>(this)->toBoolean() ? TrueTriState : FalseTriState; 259 269 return MixedTriState; 260 270 } -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r178728 r179429 95 95 #include "MathObject.h" 96 96 #include "Microtask.h" 97 #include "NameConstructor.h"98 #include "NameInstance.h"99 #include "NamePrototype.h"100 97 #include "NativeErrorConstructor.h" 101 98 #include "NativeErrorPrototype.h" … … 119 116 #include "StringConstructor.h" 120 117 #include "StringPrototype.h" 118 #include "Symbol.h" 119 #include "SymbolConstructor.h" 120 #include "SymbolPrototype.h" 121 121 #include "VariableWatchpointSetInlines.h" 122 122 #include "WeakMapConstructor.h" … … 426 426 putDirectWithoutTransition(vm, Identifier(exec, "console"), consoleObject, DontEnum); 427 427 428 if (m_experimentsEnabled) {429 NamePrototype* privateNamePrototype = NamePrototype::create(exec, NamePrototype::createStructure(vm, this, m_objectPrototype.get()));430 m_privateNameStructure.set(vm, this, NameInstance::createStructure(vm, this, privateNamePrototype));431 432 JSCell* privateNameConstructor = NameConstructor::create(vm, NameConstructor::createStructure(vm, this, m_functionPrototype.get()), privateNamePrototype);433 privateNamePrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, privateNameConstructor, DontEnum);434 putDirectWithoutTransition(vm, Identifier(exec, "Name"), privateNameConstructor, DontEnum);435 }436 437 428 resetPrototype(vm, prototype()); 438 429 } … … 696 687 visitor.append(&thisObject->m_boundFunctionStructure); 697 688 visitor.append(&thisObject->m_namedFunctionStructure); 698 visitor.append(&thisObject->m_ privateNameStructure);689 visitor.append(&thisObject->m_symbolObjectStructure); 699 690 visitor.append(&thisObject->m_regExpMatchesArrayStructure); 700 691 visitor.append(&thisObject->m_regExpStructure); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r178696 r179429 36 36 #include "StructureChain.h" 37 37 #include "StructureRareDataInlines.h" 38 #include "SymbolPrototype.h" 38 39 #include "VM.h" 39 40 #include "Watchpoint.h" … … 92 93 macro(Date, date, date, DateInstance, Date) \ 93 94 macro(String, string, stringObject, StringObject, String) \ 95 macro(Symbol, symbol, symbolObject, SymbolObject, Symbol) \ 94 96 macro(Boolean, boolean, booleanObject, BooleanObject, Boolean) \ 95 97 macro(Number, number, numberObject, NumberObject, Number) \ … … 394 396 BooleanPrototype* booleanPrototype() const { return m_booleanPrototype.get(); } 395 397 StringPrototype* stringPrototype() const { return m_stringPrototype.get(); } 398 SymbolPrototype* symbolPrototype() const { return m_symbolPrototype.get(); } 396 399 NumberPrototype* numberPrototype() const { return m_numberPrototype.get(); } 397 400 DatePrototype* datePrototype() const { return m_datePrototype.get(); } … … 452 455 Structure* setStructure() const { return m_setStructure.get(); } 453 456 Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); } 457 Structure* symbolObjectStructure() const { return m_symbolObjectStructure.get(); } 454 458 Structure* iteratorResultStructure() const { return m_iteratorResultStructure.get(); } 455 459 static ptrdiff_t iteratorResultStructureOffset() { return OBJECT_OFFSETOF(JSGlobalObject, m_iteratorResultStructure); } -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r173082 r179429 227 227 if (!asObject(name)->inherits(NumberObject::info()) && !asObject(name)->inherits(StringObject::info())) 228 228 continue; 229 } 229 } else if (!name.isNumber() && !name.isString()) 230 continue; 230 231 231 232 m_arrayReplacerPropertyNames.add(name.toString(exec)->toIdentifier(exec)); -
trunk/Source/JavaScriptCore/runtime/JSSymbolTableObject.cpp
r173517 r179429 62 62 SymbolTable::Map::iterator end = thisObject->symbolTable()->end(locker); 63 63 for (SymbolTable::Map::iterator it = thisObject->symbolTable()->begin(locker); it != end; ++it) { 64 if (it->key->is EmptyUnique())64 if (it->key->isUnique()) 65 65 continue; 66 66 if (!(it->value.getAttributes() & DontEnum) || shouldIncludeDontEnumProperties(mode)) -
trunk/Source/JavaScriptCore/runtime/JSType.h
r173541 r179429 34 34 CellType, 35 35 StringType, 36 SymbolType, 36 37 37 38 GetterSetterType, … … 53 54 JSCalleeType, 54 55 JSFunctionType, 55 NameInstanceType,56 56 NumberObjectType, 57 57 ErrorInstanceType, -
trunk/Source/JavaScriptCore/runtime/JSTypeInfo.h
r173269 r179429 78 78 bool isFinalObject() const { return type() == FinalObjectType; } 79 79 bool isNumberObject() const { return type() == NumberObjectType; } 80 bool isName() const { return type() == NameInstanceType; }81 80 82 81 unsigned flags() const { return (static_cast<unsigned>(m_flags2) << 8) | static_cast<unsigned>(m_flags); } -
trunk/Source/JavaScriptCore/runtime/MapData.cpp
r178224 r179429 61 61 return &m_entries[iter->value]; 62 62 } 63 if (key.value.isSymbol()) { 64 auto iter = m_symbolKeyedTable.find(asSymbol(key.value)->privateName().uid()); 65 if (iter == m_symbolKeyedTable.end()) 66 return 0; 67 return &m_entries[iter->value]; 68 } 63 69 if (key.value.isCell()) { 64 70 auto iter = m_cellKeyedTable.find(key.value.asCell()); … … 108 114 if (key.value.isString()) 109 115 return add(callFrame, m_stringKeyedTable, asString(key.value)->value(callFrame).impl(), key); 116 if (key.value.isSymbol()) 117 return add(callFrame, m_symbolKeyedTable, asSymbol(key.value)->privateName().uid(), key); 110 118 if (key.value.isCell()) 111 119 return add(callFrame, m_cellKeyedTable, key.value.asCell(), key); … … 129 137 location = iter->value; 130 138 m_stringKeyedTable.remove(iter); 139 } else if (key.value.isSymbol()) { 140 auto iter = m_symbolKeyedTable.find(asSymbol(key.value)->privateName().uid()); 141 if (iter == m_symbolKeyedTable.end()) 142 return false; 143 location = iter->value; 144 m_symbolKeyedTable.remove(iter); 131 145 } else if (key.value.isCell()) { 132 146 auto iter = m_cellKeyedTable.find(key.value.asCell()); … … 173 187 ptr->value = m_entries[ptr->value].value.get().asInt32(); 174 188 for (auto ptr = m_stringKeyedTable.begin(); ptr != m_stringKeyedTable.end(); ++ptr) 189 ptr->value = m_entries[ptr->value].value.get().asInt32(); 190 for (auto ptr = m_symbolKeyedTable.begin(); ptr != m_symbolKeyedTable.end(); ++ptr) 175 191 ptr->value = m_entries[ptr->value].value.get().asInt32(); 176 192 -
trunk/Source/JavaScriptCore/runtime/MapData.h
r176803 r179429 113 113 typedef HashMap<EncodedJSValue, int32_t, EncodedJSValueHash, EncodedJSValueHashTraits, IndexTraits> ValueKeyedMap; 114 114 typedef HashMap<StringImpl*, int32_t, typename WTF::DefaultHash<StringImpl*>::Hash, WTF::HashTraits<StringImpl*>, IndexTraits> StringKeyedMap; 115 typedef HashMap<AtomicStringImpl*, int32_t, typename WTF::DefaultHash<AtomicStringImpl*>::Hash, WTF::HashTraits<AtomicStringImpl*>, IndexTraits> SymbolKeyedMap; 115 116 116 117 size_t capacityInBytes() { return m_capacity * sizeof(Entry); } … … 135 136 ValueKeyedMap m_valueKeyedTable; 136 137 StringKeyedMap m_stringKeyedTable; 138 SymbolKeyedMap m_symbolKeyedTable; 137 139 int32_t m_capacity; 138 140 int32_t m_size; … … 147 149 m_valueKeyedTable.clear(); 148 150 m_stringKeyedTable.clear(); 151 m_symbolKeyedTable.clear(); 149 152 m_capacity = 0; 150 153 m_size = 0; -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r173082 r179429 174 174 if (!exec->argument(0).isObject()) 175 175 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested property descriptor of a value that is not an object."))); 176 Identifier propertyName = exec->argument(1).toString(exec)->toIdentifier(exec);176 PropertyName propertyName = exec->argument(1).toPropertyKey(exec); 177 177 if (exec->hadException()) 178 178 return JSValue::encode(jsNull()); … … 317 317 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Properties can only be defined on Objects."))); 318 318 JSObject* O = asObject(exec->argument(0)); 319 Identifier propertyName = exec->argument(1).toString(exec)->toIdentifier(exec);319 PropertyName propertyName = exec->argument(1).toPropertyKey(exec); 320 320 if (exec->hadException()) 321 321 return JSValue::encode(jsNull()); -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
r177030 r179429 86 86 { 87 87 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 88 return JSValue::encode(jsBoolean(thisValue.toObject(exec)->hasOwnProperty(exec, exec->argument(0).to String(exec)->toIdentifier(exec))));88 return JSValue::encode(jsBoolean(thisValue.toObject(exec)->hasOwnProperty(exec, exec->argument(0).toPropertyKey(exec)))); 89 89 } 90 90 … … 123 123 descriptor.setEnumerable(true); 124 124 descriptor.setConfigurable(true); 125 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).to String(exec)->toIdentifier(exec), descriptor, false);125 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).toPropertyKey(exec), descriptor, false); 126 126 127 127 return JSValue::encode(jsUndefined()); … … 143 143 descriptor.setEnumerable(true); 144 144 descriptor.setConfigurable(true); 145 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).to String(exec)->toIdentifier(exec), descriptor, false);145 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).toPropertyKey(exec), descriptor, false); 146 146 147 147 return JSValue::encode(jsUndefined()); … … 155 155 156 156 PropertySlot slot(thisObject); 157 if (thisObject->getPropertySlot(exec, exec->argument(0).to String(exec)->toIdentifier(exec), slot)157 if (thisObject->getPropertySlot(exec, exec->argument(0).toPropertyKey(exec), slot) 158 158 && slot.isAccessor()) { 159 159 GetterSetter* getterSetter = slot.getterSetter(); … … 171 171 172 172 PropertySlot slot(thisObject); 173 if (thisObject->getPropertySlot(exec, exec->argument(0).to String(exec)->toIdentifier(exec), slot)173 if (thisObject->getPropertySlot(exec, exec->argument(0).toPropertyKey(exec), slot) 174 174 && slot.isAccessor()) { 175 175 GetterSetter* getterSetter = slot.getterSetter(); … … 183 183 { 184 184 JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 185 Identifier propertyName = exec->argument(0).toString(exec)->toIdentifier(exec);185 PropertyName propertyName = exec->argument(0).toPropertyKey(exec); 186 186 187 187 PropertyDescriptor descriptor; -
trunk/Source/JavaScriptCore/runtime/Operations.cpp
r164764 r179429 66 66 if (v.isString()) 67 67 return vm.smallStrings.stringString(); 68 if (v.isSymbol()) 69 return vm.smallStrings.symbolString(); 68 70 if (v.isObject()) { 69 71 // Return "undefined" for objects that should be treated … … 90 92 91 93 JSType type = v.asCell()->type(); 92 if (type == StringType )94 if (type == StringType || type == SymbolType) 93 95 return false; 94 96 if (type >= ObjectType) { -
trunk/Source/JavaScriptCore/runtime/PrivateName.h
r176622 r179429 34 34 public: 35 35 PrivateName() 36 : m_impl(StringImpl::create EmptyUnique())36 : m_impl(StringImpl::createUniqueEmpty()) 37 37 { 38 ASSERT(m_impl->isUnique()); 39 } 40 PrivateName(const String& description) 41 : m_impl(StringImpl::createUnique(description.impl())) 42 { 43 ASSERT(m_impl->isUnique()); 38 44 } 39 45 explicit PrivateName(StringImpl* uid) 40 46 : m_impl(uid) 41 47 { 42 ASSERT(m_impl->is EmptyUnique());48 ASSERT(m_impl->isUnique()); 43 49 } 44 50 45 51 AtomicStringImpl* uid() const { return static_cast<AtomicStringImpl*>(m_impl.get()); } 52 53 bool operator==(const PrivateName& other) const { return uid() == other.uid(); } 54 bool operator!=(const PrivateName& other) const { return uid() != other.uid(); } 46 55 47 56 private: -
trunk/Source/JavaScriptCore/runtime/PropertyMapHashTable.h
r177222 r179429 272 272 { 273 273 ASSERT(key); 274 ASSERT(key->isAtomic() || key->is EmptyUnique());274 ASSERT(key->isAtomic() || key->isUnique()); 275 275 unsigned hash = key->existingHash(); 276 276 unsigned step = 0; … … 306 306 { 307 307 ASSERT(key); 308 ASSERT(key->isAtomic() || key->is EmptyUnique());308 ASSERT(key->isAtomic() || key->isUnique()); 309 309 310 310 if (!m_keyCount) -
trunk/Source/JavaScriptCore/runtime/PropertyName.h
r178928 r179429 94 94 { 95 95 ASSERT(m_impl); 96 ASSERT(m_impl->is EmptyUnique());96 ASSERT(m_impl->isUnique()); 97 97 ASSERT(m_impl->isAtomic()); 98 98 } … … 105 105 AtomicStringImpl* publicName() const 106 106 { 107 return m_impl->is EmptyUnique() ? nullptr : m_impl;107 return m_impl->isUnique() ? nullptr : m_impl; 108 108 } 109 109 -
trunk/Source/JavaScriptCore/runtime/SmallStrings.h
r178984 r179429 39 39 macro(undefined) \ 40 40 macro(string) \ 41 macro(symbol) \ 41 42 macro(true) 42 43 -
trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp
r171824 r179429 111 111 if (!exec->argumentCount()) 112 112 return JSValue::encode(jsEmptyString(exec)); 113 return JSValue::encode(exec->uncheckedArgument(0).toString(exec)); 113 JSValue argument = exec->uncheckedArgument(0); 114 if (argument.isSymbol()) 115 return JSValue::encode(jsString(exec, asSymbol(argument)->descriptiveString())); 116 return JSValue::encode(argument.toString(exec)); 114 117 } 115 118 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r178928 r179429 948 948 for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter) { 949 949 ASSERT(hasNonEnumerableProperties() || !(iter->attributes & DontEnum)); 950 if (!iter->key->is EmptyUnique() && (!(iter->attributes & DontEnum) || shouldIncludeDontEnumProperties(mode))) {950 if (!iter->key->isUnique() && (!(iter->attributes & DontEnum) || shouldIncludeDontEnumProperties(mode))) { 951 951 if (knownUnique) 952 952 propertyNames.addKnownUnique(iter->key); -
trunk/Source/JavaScriptCore/runtime/StructureInlines.h
r176583 r179429 169 169 if (isObject()) 170 170 return m_prototype.get(); 171 if (typeInfo().type() == SymbolType) 172 return globalObject->symbolPrototype(); 171 173 172 174 ASSERT(typeInfo().type() == StringType); -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.cpp
r179427 r179429 1 1 /* 2 2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 25 26 26 27 #include "config.h" 27 #include " NameConstructor.h"28 #include "SymbolConstructor.h" 28 29 30 #include "Error.h" 31 #include "JSCInlines.h" 29 32 #include "JSGlobalObject.h" 30 #include "NamePrototype.h" 31 #include "JSCInlines.h" 33 #include "SymbolPrototype.h" 32 34 33 35 namespace JSC { 34 36 35 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE( NameConstructor);37 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(SymbolConstructor); 36 38 37 const ClassInfo NameConstructor::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(NameConstructor) };39 const ClassInfo SymbolConstructor::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(SymbolConstructor) }; 38 40 39 NameConstructor::NameConstructor(VM& vm, Structure* structure)41 SymbolConstructor::SymbolConstructor(VM& vm, Structure* structure) 40 42 : InternalFunction(vm, structure) 41 43 { 42 44 } 43 45 44 void NameConstructor::finishCreation(VM& vm, NamePrototype* prototype) 46 #define INITIALIZE_WELL_KNOWN_SYMBOLS(name) \ 47 putDirectWithoutTransition(vm, Identifier(&vm, #name), Symbol::create(vm, vm.propertyNames->name##PrivateName.impl()), DontEnum | DontDelete | ReadOnly); 48 49 void SymbolConstructor::finishCreation(VM& vm, SymbolPrototype* prototype) 45 50 { 46 51 Base::finishCreation(vm, prototype->classInfo()->className); 47 52 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 48 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum); 53 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontDelete | ReadOnly | DontEnum); 54 55 JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALIZE_WELL_KNOWN_SYMBOLS) 49 56 } 50 57 51 static EncodedJSValue JSC_HOST_CALL c onstructPrivateName(ExecState* exec)58 static EncodedJSValue JSC_HOST_CALL callSymbol(ExecState* exec) 52 59 { 53 JSValue publicName = exec->argument(0); 54 return JSValue::encode(NameInstance::create(exec->vm(), exec->lexicalGlobalObject()->privateNameStructure(), publicName.toString(exec))); 60 JSValue description = exec->argument(0); 61 if (description.isUndefined()) 62 return JSValue::encode(Symbol::create(exec->vm())); 63 return JSValue::encode(Symbol::create(exec, description.toString(exec))); 55 64 } 56 65 57 ConstructType NameConstructor::getConstructData(JSCell*, ConstructData& constructData)66 ConstructType SymbolConstructor::getConstructData(JSCell*, ConstructData&) 58 67 { 59 constructData.native.function = constructPrivateName; 60 return ConstructTypeHost; 68 return ConstructTypeNone; 61 69 } 62 70 63 CallType NameConstructor::getCallData(JSCell*, CallData& callData)71 CallType SymbolConstructor::getCallData(JSCell*, CallData& callData) 64 72 { 65 callData.native.function = c onstructPrivateName;73 callData.native.function = callSymbol; 66 74 return CallTypeHost; 67 75 } -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.h
r179427 r179429 1 1 /* 2 2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 24 25 */ 25 26 26 #ifndef NameConstructor_h27 #define NameConstructor_h27 #ifndef SymbolConstructor_h 28 #define SymbolConstructor_h 28 29 29 30 #include "InternalFunction.h" 30 #include " NameInstance.h"31 #include "Symbol.h" 31 32 32 33 namespace JSC { 33 34 34 class NamePrototype;35 class SymbolPrototype; 35 36 36 class NameConstructor : public InternalFunction {37 class SymbolConstructor : public InternalFunction { 37 38 public: 38 39 typedef InternalFunction Base; 39 40 40 static NameConstructor* create(VM& vm, Structure* structure, NamePrototype* prototype)41 static SymbolConstructor* create(VM& vm, Structure* structure, SymbolPrototype* prototype) 41 42 { 42 NameConstructor* constructor = new (NotNull, allocateCell<NameConstructor>(vm.heap)) NameConstructor(vm, structure);43 SymbolConstructor* constructor = new (NotNull, allocateCell<SymbolConstructor>(vm.heap)) SymbolConstructor(vm, structure); 43 44 constructor->finishCreation(vm, prototype); 44 45 return constructor; … … 47 48 DECLARE_INFO; 48 49 49 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 50 { 51 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 50 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 51 { 52 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 52 53 } 53 54 54 55 protected: 55 void finishCreation(VM&, NamePrototype*);56 56 void finishCreation(VM&, SymbolPrototype*); 57 57 58 private: 58 NameConstructor(VM&, Structure*);59 SymbolConstructor(VM&, Structure*); 59 60 static ConstructType getConstructData(JSCell*, ConstructData&); 60 61 static CallType getCallData(JSCell*, CallData&); … … 63 64 } // namespace JSC 64 65 65 #endif // NameConstructor_h66 #endif // SymbolConstructor_h -
trunk/Source/JavaScriptCore/runtime/SymbolObject.cpp
r179427 r179429 1 1 /* 2 2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 25 26 26 27 #include "config.h" 27 #include " NameInstance.h"28 #include "SymbolObject.h" 28 29 29 #include "JSScope.h"30 30 #include "JSCInlines.h" 31 31 32 32 namespace JSC { 33 33 34 const ClassInfo NameInstance::s_info = { "Name", &Base::s_info, 0, CREATE_METHOD_TABLE(NameInstance) };34 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(SymbolObject); 35 35 36 NameInstance::NameInstance(VM& vm, Structure* structure, JSString* nameString) 37 : Base(vm, structure) 36 const ClassInfo SymbolObject::s_info = { "Symbol", &JSWrapperObject::s_info, nullptr, CREATE_METHOD_TABLE(SymbolObject) }; 37 38 SymbolObject::SymbolObject(VM& vm, Structure* structure) 39 : JSWrapperObject(vm, structure) 38 40 { 39 m_nameString.set(vm, this, nameString);40 41 } 41 42 42 void NameInstance::destroy(JSCell* cell)43 void SymbolObject::finishCreation(VM& vm, Symbol* symbol) 43 44 { 44 static_cast<NameInstance*>(cell)->NameInstance::~NameInstance(); 45 Base::finishCreation(vm); 46 ASSERT(inherits(info())); 47 setInternalValue(vm, symbol); 48 } 49 50 JSValue SymbolObject::defaultValue(const JSObject* object, ExecState*, PreferredPrimitiveType) 51 { 52 const SymbolObject* symbolObject = jsCast<const SymbolObject*>(object); 53 return symbolObject->internalValue(); 45 54 } 46 55 -
trunk/Source/JavaScriptCore/runtime/SymbolPrototype.h
r179427 r179429 1 1 /* 2 2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 24 25 */ 25 26 26 #ifndef NamePrototype_h27 #define NamePrototype_h27 #ifndef SymbolPrototype_h 28 #define SymbolPrototype_h 28 29 29 #include "NameInstance.h" 30 #include "Symbol.h" 31 #include "SymbolObject.h" 30 32 31 33 namespace JSC { 32 34 33 class NamePrototype : public NameInstance { 35 // In the ES6 spec, Symbol.prototype object is an ordinary JS object, not one of the symbol wrapper object instance. 36 class SymbolPrototype : public JSDestructibleObject { 34 37 public: 35 typedef NameInstanceBase;38 typedef JSDestructibleObject Base; 36 39 37 static NamePrototype* create(ExecState* exec, Structure* structure)40 static SymbolPrototype* create(VM& vm, JSGlobalObject*, Structure* structure) 38 41 { 39 VM& vm = exec->vm(); 40 NamePrototype* prototype = new (NotNull, allocateCell<NamePrototype>(vm.heap)) NamePrototype(exec, structure); 42 SymbolPrototype* prototype = new (NotNull, allocateCell<SymbolPrototype>(vm.heap)) SymbolPrototype(vm, structure); 41 43 prototype->finishCreation(vm); 42 44 return prototype; 43 45 } 44 46 45 47 DECLARE_INFO; 46 48 47 49 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 48 50 { 49 return Structure::create(vm, globalObject, prototype, TypeInfo( NameInstanceType, StructureFlags), info());51 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 50 52 } 51 53 52 54 protected: 53 NamePrototype(ExecState*, Structure*);55 SymbolPrototype(VM&, Structure*); 54 56 void finishCreation(VM&); 55 57 56 static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NameInstance::StructureFlags;58 static const unsigned StructureFlags = OverridesGetOwnPropertySlot | Base::StructureFlags; 57 59 58 60 private: … … 62 64 } // namespace JSC 63 65 64 #endif // NamePrototype_h66 #endif // SymbolPrototype_h -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r179392 r179429 221 221 functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, 0, jsNull())); 222 222 regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull())); 223 symbolStructure.set(*this, Symbol::createStructure(*this, 0, jsNull())); 223 224 symbolTableStructure.set(*this, SymbolTable::createStructure(*this, 0, jsNull())); 224 225 structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull())); -
trunk/Source/JavaScriptCore/runtime/VM.h
r179392 r179429 265 265 Strong<Structure> functionExecutableStructure; 266 266 Strong<Structure> regExpStructure; 267 Strong<Structure> symbolStructure; 267 268 Strong<Structure> symbolTableStructure; 268 269 Strong<Structure> structureChainStructure; -
trunk/Source/WTF/ChangeLog
r179426 r179429 1 2015-01-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Implement ES6 Symbol 4 https://bugs.webkit.org/show_bug.cgi?id=140435 5 6 Reviewed by Geoffrey Garen. 7 8 Introduce new unique string mechanizm into StringImpl. 9 It is used for implementing Symbol which holds a [[Description]] value. 10 11 * wtf/text/AtomicString.h: 12 (WTF::AtomicString::add): 13 (WTF::AtomicString::addWithStringTableProvider): 14 15 Previously, we checked `isAtomic()` or `!length()`. This guard can filter out EmptyUnique. 16 But now, we introduced new unique StringImpl. Since it has an actual string value, we need to check `isUnique()`. 17 18 * wtf/text/StringImpl.cpp: 19 (WTF::StringImpl::~StringImpl): 20 (WTF::StringImpl::createUnique): 21 22 In createUnique, we leverage Substring mechanizm to produce a new unique 23 string from an existing string. 24 25 * wtf/text/StringImpl.h: 26 (WTF::StringImpl::StringImpl): 27 (WTF::StringImpl::createUniqueEmpty): 28 (WTF::StringImpl::flagIsUnique): 29 (WTF::StringImpl::isUnique): 30 (WTF::StringImpl::setIsAtomic): 31 (WTF::StringImpl::createEmptyUnique): Deleted. 32 (WTF::StringImpl::isEmptyUnique): Deleted. 33 34 Instead of EmptyUnique, we introduced new flag to StringImpl, `isUnique`. 35 While EmptyUnique cannot hold any string values except for empty string, 36 the unique StringImpl can hold any String values. 37 We fold the Symbol's descriptiveString value here. 38 39 * wtf/text/StringStatics.cpp: 40 (WTF::StringImpl::hashAndFlagsForUnique): 41 (WTF::StringImpl::hashAndFlagsForEmptyUnique): Deleted. 42 1 43 2015-01-30 Geoffrey Garen <ggaren@apple.com> 2 44 -
trunk/Source/WTF/wtf/text/AtomicString.h
r177259 r179429 185 185 { 186 186 if (!string || string->isAtomic()) { 187 ASSERT_WITH_MESSAGE(!string || !string->length() || isInAtomicStringTable(string), "The atomic string comes from an other thread!");187 ASSERT_WITH_MESSAGE(!string || !string->length() || string->isUnique() || isInAtomicStringTable(string), "The atomic string comes from an other thread!"); 188 188 return string; 189 189 } … … 199 199 { 200 200 if (!string || string->isAtomic()) { 201 ASSERT_WITH_MESSAGE(!string || !string->length() || isInAtomicStringTable(string), "The atomic string comes from an other thread!");201 ASSERT_WITH_MESSAGE(!string || !string->length() || string->isUnique() || isInAtomicStringTable(string), "The atomic string comes from an other thread!"); 202 202 return string; 203 203 } -
trunk/Source/WTF/wtf/text/StringImpl.cpp
r177860 r179429 110 110 STRING_STATS_REMOVE_STRING(*this); 111 111 112 if (isAtomic() && m_length)112 if (isAtomic() && length() && !isUnique()) 113 113 AtomicString::remove(this); 114 114 … … 285 285 CRASH(); 286 286 return create(string, length); 287 } 288 289 Ref<StringImpl> StringImpl::createUnique(PassRefPtr<StringImpl> rep) 290 { 291 unsigned length = rep->length(); 292 if (!length) 293 return createUniqueEmpty(); 294 Ref<StringImpl> string = createSubstringSharingImpl(rep, 0, length); 295 string->m_hashAndFlags = hashAndFlagsForUnique(string->m_hashAndFlags); 296 return string; 287 297 } 288 298 -
trunk/Source/WTF/wtf/text/StringImpl.h
r177860 r179429 281 281 // to represent a null terminated buffer. 282 282 , m_data8(reinterpret_cast<const LChar*>(&m_length)) 283 , m_hashAndFlags(hashAndFlagsFor EmptyUnique())283 , m_hashAndFlags(hashAndFlagsForUnique(s_hashFlag8BitBuffer | BufferInternal)) 284 284 { 285 285 ASSERT(m_data8); … … 379 379 } 380 380 381 static Ref<StringImpl> createEmptyUnique()381 ALWAYS_INLINE static Ref<StringImpl> createUniqueEmpty() 382 382 { 383 383 return adoptRef(*new StringImpl(CreateEmptyUnique)); 384 384 } 385 386 WTF_EXPORT_STRING_API static Ref<StringImpl> createUnique(PassRefPtr<StringImpl> rep); 385 387 386 388 // Reallocate the StringImpl. The originalString must be only owned by the PassRefPtr, … … 393 395 static unsigned flagIs8Bit() { return s_hashFlag8BitBuffer; } 394 396 static unsigned flagIsAtomic() { return s_hashFlagIsAtomic; } 397 static unsigned flagIsUnique() { return s_hashFlagIsUnique; } 395 398 static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data8); } 396 399 … … 452 455 WTF_EXPORT_STRING_API size_t sizeInBytes() const; 453 456 454 bool isEmptyUnique() const 455 { 456 return !length() && !isStatic(); 457 } 457 bool isUnique() const { return m_hashAndFlags & s_hashFlagIsUnique; } 458 458 459 459 bool isAtomic() const { return m_hashAndFlags & s_hashFlagIsAtomic; } … … 461 461 { 462 462 ASSERT(!isStatic()); 463 ASSERT(!is EmptyUnique());463 ASSERT(!isUnique()); 464 464 if (isAtomic) 465 465 m_hashAndFlags |= s_hashFlagIsAtomic; … … 773 773 template <typename CharType> static Ref<StringImpl> createInternal(const CharType*, unsigned); 774 774 WTF_EXPORT_PRIVATE NEVER_INLINE unsigned hashSlowCase() const; 775 WTF_EXPORT_PRIVATE unsigned hashAndFlagsForEmptyUnique();775 WTF_EXPORT_PRIVATE static unsigned hashAndFlagsForUnique(unsigned flags); 776 776 777 777 // The bottom bit in the ref count indicates a static (immortal) string. … … 779 779 static const unsigned s_refCountIncrement = 0x2; // This allows us to ref / deref without disturbing the static string flag. 780 780 781 // The bottom 6bits in the hash are flags.782 static const unsigned s_flagCount = 6;781 // The bottom 7 bits in the hash are flags. 782 static const unsigned s_flagCount = 7; 783 783 static const unsigned s_flagMask = (1u << s_flagCount) - 1; 784 784 COMPILE_ASSERT(s_flagCount <= StringHasher::flagCount, StringHasher_reserves_enough_bits_for_StringImpl_flags); 785 785 786 static const unsigned s_hashFlagIsUnique = 1u << 6; 786 787 static const unsigned s_hashFlag8BitBuffer = 1u << 5; 787 788 static const unsigned s_hashFlagIsAtomic = 1u << 4; -
trunk/Source/WTF/wtf/text/StringStatics.cpp
r167508 r179429 48 48 } 49 49 50 // Set the hash early, so that all emptyunique StringImpls have a hash,50 // Set the hash early, so that all unique StringImpls have a hash, 51 51 // and don't use the normal hashing algorithm - the unique nature of these 52 52 // keys means that we don't need them to match any other string (in fact, 53 53 // that's exactly the oposite of what we want!), and the normal hash would 54 54 // lead to lots of conflicts. 55 unsigned StringImpl::hashAndFlagsFor EmptyUnique()55 unsigned StringImpl::hashAndFlagsForUnique(unsigned flags) 56 56 { 57 static unsigned s_nextHashAndFlagsForEmptyUnique = BufferInternal | s_hashFlag8BitBuffer | s_hashFlagIsAtomic; 58 s_nextHashAndFlagsForEmptyUnique += 1 << s_flagCount; 59 s_nextHashAndFlagsForEmptyUnique |= 1 << 31; 60 return s_nextHashAndFlagsForEmptyUnique; 57 static unsigned s_nextHashAndFlagsForUnique = 0; 58 s_nextHashAndFlagsForUnique += 1 << s_flagCount; 59 s_nextHashAndFlagsForUnique |= 1 << 31; 60 unsigned flagsForUnique = (flags & s_flagMask) | s_hashFlagIsAtomic | s_hashFlagIsUnique; 61 return s_nextHashAndFlagsForUnique | flagsForUnique; 61 62 } 62 63
Note: See TracChangeset
for help on using the changeset viewer.