Changeset 190916 in webkit
- Timestamp:
- Oct 12, 2015 7:09:34 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r190905 r190916 1 2015-10-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Introduce Symbol type for property type inference 4 https://bugs.webkit.org/show_bug.cgi?id=149622 5 6 Reviewed by Geoffrey Garen. 7 8 This patch introduces Symbol type into property type inference. 9 One of the use cases of ES6 Symbol is enum value. In this case, 10 we may hold different symbols as the same property of the same structure. 11 Current property type inference does not support Symbol type, so in the 12 above case, the property will be inferred as Top type. 13 14 * bytecode/PutByIdFlags.h: 15 * dfg/DFGAbstractValue.cpp: 16 (JSC::DFG::AbstractValue::set): 17 * dfg/DFGInferredTypeCheck.cpp: 18 (JSC::DFG::insertInferredTypeCheck): 19 * ftl/FTLLowerDFGToLLVM.cpp: 20 (JSC::FTL::DFG::LowerDFGToLLVM::checkInferredType): 21 * jit/AssemblyHelpers.cpp: 22 (JSC::AssemblyHelpers::branchIfNotType): 23 * llint/LLIntData.cpp: 24 (JSC::LLInt::Data::performAssertions): 25 * llint/LowLevelInterpreter.asm: 26 * llint/LowLevelInterpreter32_64.asm: 27 * llint/LowLevelInterpreter64.asm: 28 * runtime/InferredType.cpp: 29 (JSC::InferredType::kindForFlags): 30 (JSC::InferredType::Descriptor::forValue): 31 (JSC::InferredType::Descriptor::putByIdFlags): 32 (JSC::InferredType::Descriptor::merge): 33 (WTF::printInternal): 34 * runtime/InferredType.h: 35 * tests/stress/prop-type-symbol-then-object.js: Added. 36 (foo): 37 (bar): 38 (toString): 39 * tests/stress/prop-type-symbol-then-string.js: Added. 40 (foo): 41 (bar): 42 1 43 2015-10-12 Joseph Pecoraro <pecoraro@apple.com> 2 44 -
trunk/Source/JavaScriptCore/bytecode/PutByIdFlags.h
r190076 r190916 66 66 PutByIdSecondaryTypeNumber = 0x20, 67 67 PutByIdSecondaryTypeString = 0x28, 68 PutByIdSecondaryTypeObject = 0x30, 69 PutByIdSecondaryTypeObjectOrOther = 0x38, 70 PutByIdSecondaryTypeTop = 0x40 68 PutByIdSecondaryTypeSymbol = 0x30, 69 PutByIdSecondaryTypeObject = 0x38, 70 PutByIdSecondaryTypeObjectOrOther = 0x40, 71 PutByIdSecondaryTypeTop = 0x48 71 72 }; 72 73 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp
r190076 r190916 139 139 set(graph, graph.m_vm.stringStructure.get()); 140 140 return; 141 case InferredType::Symbol: 142 set(graph, graph.m_vm.symbolStructure.get()); 143 return; 141 144 case InferredType::ObjectWithStructure: 142 145 set(graph, descriptor.structure()); -
trunk/Source/JavaScriptCore/dfg/DFGInferredTypeCheck.cpp
r190076 r190916 64 64 return; 65 65 66 case InferredType::Symbol: 67 insertionSet.insertNode(nodeIndex, SpecNone, Check, origin, Edge(baseNode, SymbolUse)); 68 return; 69 66 70 case InferredType::ObjectWithStructure: 67 71 insertionSet.insertNode( -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r190896 r190916 5898 5898 return; 5899 5899 5900 case InferredType::Symbol: 5901 speculate(BadType, jsValueValue(value), edge.node(), isNotCell(value, provenType(edge))); 5902 speculate(BadType, jsValueValue(value), edge.node(), isNotSymbol(value, provenType(edge))); 5903 return; 5904 5900 5905 case InferredType::ObjectWithStructure: 5901 5906 speculate(BadType, jsValueValue(value), edge.node(), isNotCell(value, provenType(edge))); -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp
r190827 r190916 87 87 break; 88 88 89 case InferredType::Symbol: 90 result.append(branchIfNotCell(regs, mode)); 91 result.append(branchIfNotSymbol(regs.payloadGPR())); 92 break; 93 89 94 case InferredType::ObjectWithStructure: 90 95 result.append(branchIfNotCell(regs, mode)); -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r189575 r190916 143 143 144 144 ASSERT(StringType == 6); 145 ASSERT(SymbolType == 7); 145 146 ASSERT(ObjectType == 21); 146 147 ASSERT(FinalObjectType == 22); … … 154 155 ASSERT(ModuleCode == 3); 155 156 157 static_assert(PutByIdPrimaryTypeMask == 0x6, "LLInt assumes PutByIdPrimaryTypeMask is == 0x6"); 158 static_assert(PutByIdPrimaryTypeSecondary == 0x0, "LLInt assumes PutByIdPrimaryTypeSecondary is == 0x0"); 159 static_assert(PutByIdPrimaryTypeObjectWithStructure == 0x2, "LLInt assumes PutByIdPrimaryTypeObjectWithStructure is == 0x2"); 160 static_assert(PutByIdPrimaryTypeObjectWithStructureOrOther == 0x4, "LLInt assumes PutByIdPrimaryTypeObjectWithStructureOrOther is == 0x4"); 161 static_assert(PutByIdSecondaryTypeMask == -0x8, "LLInt assumes PutByIdSecondaryTypeMask is == -0x8"); 162 static_assert(PutByIdSecondaryTypeBottom == 0x0, "LLInt assumes PutByIdSecondaryTypeBottom is == 0x0"); 163 static_assert(PutByIdSecondaryTypeBoolean == 0x8, "LLInt assumes PutByIdSecondaryTypeBoolean is == 0x8"); 164 static_assert(PutByIdSecondaryTypeOther == 0x10, "LLInt assumes PutByIdSecondaryTypeOther is == 0x10"); 165 static_assert(PutByIdSecondaryTypeInt32 == 0x18, "LLInt assumes PutByIdSecondaryTypeInt32 is == 0x18"); 166 static_assert(PutByIdSecondaryTypeNumber == 0x20, "LLInt assumes PutByIdSecondaryTypeNumber is == 0x20"); 167 static_assert(PutByIdSecondaryTypeString == 0x28, "LLInt assumes PutByIdSecondaryTypeString is == 0x28"); 168 static_assert(PutByIdSecondaryTypeSymbol == 0x30, "LLInt assumes PutByIdSecondaryTypeSymbol is == 0x30"); 169 static_assert(PutByIdSecondaryTypeObject == 0x38, "LLInt assumes PutByIdSecondaryTypeObject is == 0x38"); 170 static_assert(PutByIdSecondaryTypeObjectOrOther == 0x40, "LLInt assumes PutByIdSecondaryTypeObjectOrOther is == 0x40"); 171 static_assert(PutByIdSecondaryTypeTop == 0x48, "LLInt assumes PutByIdSecondaryTypeTop is == 0x48"); 172 156 173 static_assert(GlobalProperty == 0, "LLInt assumes GlobalProperty ResultType is == 0"); 157 174 static_assert(GlobalVar == 1, "LLInt assumes GlobalVar ResultType is == 1"); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r190896 r190916 217 217 const PutByIdSecondaryTypeNumber = 0x20 218 218 const PutByIdSecondaryTypeString = 0x28 219 const PutByIdSecondaryTypeObject = 0x30 220 const PutByIdSecondaryTypeObjectOrOther = 0x38 221 const PutByIdSecondaryTypeTop = 0x40 219 const PutByIdSecondaryTypeSymbol = 0x30 220 const PutByIdSecondaryTypeObject = 0x38 221 const PutByIdSecondaryTypeObjectOrOther = 0x40 222 const PutByIdSecondaryTypeTop = 0x48 222 223 223 224 const CopyBarrierSpaceBits = 3 … … 327 328 # Type constants. 328 329 const StringType = 6 330 const SymbolType = 7 329 331 const ObjectType = 21 330 332 const FinalObjectType = 22 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r190569 r190916 1404 1404 bilt t1, PutByIdSecondaryTypeString, .opPutByIdTypeCheckLessThanString 1405 1405 1406 # We are one of the following: String, Object, ObjectOrOther, Top1406 # We are one of the following: String, Symbol, Object, ObjectOrOther, Top 1407 1407 bilt t1, PutByIdSecondaryTypeObjectOrOther, .opPutByIdTypeCheckLessThanObjectOrOther 1408 1408 … … 1418 1418 1419 1419 .opPutByIdTypeCheckLessThanObjectOrOther: 1420 # We are either String or Object.1420 # We are either String, Symbol or Object. 1421 1421 bineq t2, CellTag, .opPutByIdSlow 1422 1422 bieq t1, PutByIdSecondaryTypeObject, .opPutByIdTypeCheckObject 1423 bieq t1, PutByIdSecondaryTypeSymbol, .opPutByIdTypeCheckSymbol 1423 1424 bbeq JSCell::m_type[t3], StringType, .opPutByIdDoneCheckingTypes 1424 1425 jmp .opPutByIdSlow 1425 1426 .opPutByIdTypeCheckObject: 1426 1427 bbaeq JSCell::m_type[t3], ObjectType, .opPutByIdDoneCheckingTypes 1428 jmp .opPutByIdSlow 1429 .opPutByIdTypeCheckSymbol: 1430 bbeq JSCell::m_type[t3], SymbolType, .opPutByIdDoneCheckingTypes 1427 1431 jmp .opPutByIdSlow 1428 1432 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r190896 r190916 1288 1288 bplt t1, PutByIdSecondaryTypeString, .opPutByIdTypeCheckLessThanString 1289 1289 1290 # We are one of the following: String, Object, ObjectOrOther, Top1290 # We are one of the following: String, Symbol, Object, ObjectOrOther, Top 1291 1291 bplt t1, PutByIdSecondaryTypeObjectOrOther, .opPutByIdTypeCheckLessThanObjectOrOther 1292 1292 … … 1302 1302 1303 1303 .opPutByIdTypeCheckLessThanObjectOrOther: 1304 # We are either String or Object.1304 # We are either String, Symbol or Object. 1305 1305 btqnz t3, tagMask, .opPutByIdSlow 1306 1306 bpeq t1, PutByIdSecondaryTypeObject, .opPutByIdTypeCheckObject 1307 bpeq t1, PutByIdSecondaryTypeSymbol, .opPutByIdTypeCheckSymbol 1307 1308 bbeq JSCell::m_type[t3], StringType, .opPutByIdDoneCheckingTypes 1308 1309 jmp .opPutByIdSlow 1309 1310 .opPutByIdTypeCheckObject: 1310 1311 bbaeq JSCell::m_type[t3], ObjectType, .opPutByIdDoneCheckingTypes 1312 jmp .opPutByIdSlow 1313 .opPutByIdTypeCheckSymbol: 1314 bbeq JSCell::m_type[t3], SymbolType, .opPutByIdDoneCheckingTypes 1311 1315 jmp .opPutByIdSlow 1312 1316 -
trunk/Source/JavaScriptCore/runtime/InferredType.cpp
r190076 r190916 112 112 case PutByIdSecondaryTypeString: 113 113 return String; 114 case PutByIdSecondaryTypeSymbol: 115 return Symbol; 114 116 case PutByIdSecondaryTypeObject: 115 117 return Object; … … 146 148 if (cell->isString()) 147 149 return String; 150 if (cell->isSymbol()) 151 return Symbol; 148 152 if (cell->isObject()) { 149 153 if (cell->structure()->transitionWatchpointSetIsStillValid()) … … 181 185 case String: 182 186 return static_cast<PutByIdFlags>(PutByIdPrimaryTypeSecondary | PutByIdSecondaryTypeString); 187 case Symbol: 188 return static_cast<PutByIdFlags>(PutByIdPrimaryTypeSecondary | PutByIdSecondaryTypeSymbol); 183 189 case Object: 184 190 return static_cast<PutByIdFlags>(PutByIdPrimaryTypeSecondary | PutByIdSecondaryTypeObject); … … 212 218 case Boolean: 213 219 case String: 220 case Symbol: 214 221 *this = Top; 215 222 return; … … 542 549 out.print("String"); 543 550 return; 551 case InferredType::Symbol: 552 out.print("Symbol"); 553 return; 544 554 case InferredType::ObjectWithStructure: 545 555 out.print("ObjectWithStructure"); -
trunk/Source/JavaScriptCore/runtime/InferredType.h
r190076 r190916 61 61 Number, 62 62 String, 63 Symbol, 63 64 ObjectWithStructure, 64 65 ObjectWithStructureOrOther, … … 126 127 case String: 127 128 return value.isString(); 129 case Symbol: 130 return value.isSymbol(); 128 131 case ObjectWithStructure: 129 132 return value.isCell() && value.asCell()->structure() == m_structure;
Note: See TracChangeset
for help on using the changeset viewer.