Changeset 207060 in webkit
- Timestamp:
- Oct 11, 2016 12:28:08 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r206948 r207060 1 2016-10-11 Saam Barati <sbarati@apple.com> 2 3 ValueAdd should be constant folded if the operands are constant String,Primitive or Primitive,String 4 https://bugs.webkit.org/show_bug.cgi?id=163182 5 6 Reviewed by Filip Pizlo. 7 8 * microbenchmarks/string-add-constant-folding.js: Added. 9 (assert): 10 (runTests): 11 (add): 12 (test): 13 1 14 2016-10-07 Mark Lam <mark.lam@apple.com> 2 15 -
trunk/Source/JavaScriptCore/ChangeLog
r207054 r207060 1 2016-10-11 Saam Barati <sbarati@apple.com> 2 3 ValueAdd should be constant folded if the operands are constant String,Primitive or Primitive,String 4 https://bugs.webkit.org/show_bug.cgi?id=163182 5 6 Reviewed by Filip Pizlo. 7 8 This code pattern shows up in Dromaeo, so it's worth optimizing for. 9 This might also show up in real world JS code due to inlining and other 10 types of constant folding. 11 12 * dfg/DFGByteCodeParser.cpp: 13 (JSC::DFG::ByteCodeParser::parseBlock): 14 * dfg/DFGLazyJSValue.cpp: 15 (JSC::DFG::LazyJSValue::getValue): 16 * dfg/DFGStrengthReductionPhase.cpp: 17 (JSC::DFG::StrengthReductionPhase::handleNode): 18 1 19 2016-10-10 Zan Dobersek <zdobersek@igalia.com> 2 20 -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r206870 r207060 4240 4240 // FIXME: When the bytecode is not compiled in the baseline JIT, byValInfo becomes null. 4241 4241 // At that time, there is no information. 4242 if (byValInfo && byValInfo->stubInfo && !byValInfo->tookSlowPath && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadIdent) && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCell)) { 4242 if (byValInfo 4243 && byValInfo->stubInfo 4244 && !byValInfo->tookSlowPath 4245 && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadIdent) 4246 && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType) 4247 && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCell)) { 4243 4248 compiledAsPutById = true; 4244 4249 unsigned identifierNumber = m_graph.identifiers().ensure(byValInfo->cachedId.impl()); -
trunk/Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp
r201470 r207060 52 52 return jsSingleCharacterString(&vm, u.character); 53 53 case KnownStringImpl: 54 case NewStringImpl:55 54 return jsString(&vm, u.stringImpl); 55 case NewStringImpl: 56 return jsString(&vm, AtomicStringImpl::add(u.stringImpl)); 56 57 } 57 58 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
r205462 r207060 323 323 // https://bugs.webkit.org/show_bug.cgi?id=155204 324 324 325 case ValueAdd: { 326 if (m_node->child1()->isConstant() 327 && m_node->child2()->isConstant() 328 && (!!m_node->child1()->tryGetString(m_graph) || !!m_node->child2()->tryGetString(m_graph))) { 329 auto tryGetConstantString = [&] (Node* node) -> String { 330 String string = node->tryGetString(m_graph); 331 if (!string.isEmpty()) 332 return string; 333 JSValue value = node->constant()->value(); 334 if (!value) 335 return String(); 336 if (value.isInt32()) 337 return String::number(value.asInt32()); 338 if (value.isNumber()) 339 return String::numberToStringECMAScript(value.asNumber()); 340 if (value.isBoolean()) 341 return value.asBoolean() ? ASCIILiteral("true") : ASCIILiteral("false"); 342 if (value.isNull()) 343 return ASCIILiteral("null"); 344 if (value.isUndefined()) 345 return ASCIILiteral("undefined"); 346 return String(); 347 }; 348 349 String leftString = tryGetConstantString(m_node->child1().node()); 350 if (!leftString) 351 break; 352 String rightString = tryGetConstantString(m_node->child2().node()); 353 if (!rightString) 354 break; 355 356 StringBuilder builder; 357 builder.append(leftString); 358 builder.append(rightString); 359 m_node->convertToLazyJSConstant( 360 m_graph, LazyJSValue::newString(m_graph, builder.toString())); 361 m_changed = true; 362 } 363 break; 364 } 365 325 366 case MakeRope: 326 case ValueAdd:327 367 case StrCat: { 328 368 String leftString = m_node->child1()->tryGetString(m_graph);
Note: See TracChangeset
for help on using the changeset viewer.