Ignore:
Timestamp:
Oct 11, 2016, 12:28:08 AM (9 years ago)
Author:
[email protected]
Message:

ValueAdd should be constant folded if the operands are constant String,Primitive or Primitive,String
https://bugs.webkit.org/show_bug.cgi?id=163182

Reviewed by Filip Pizlo.

JSTests:

  • microbenchmarks/string-add-constant-folding.js: Added.

(assert):
(runTests):
(add):
(test):

Source/JavaScriptCore:

This code pattern shows up in Dromaeo, so it's worth optimizing for.
This might also show up in real world JS code due to inlining and other
types of constant folding.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGLazyJSValue.cpp:

(JSC::DFG::LazyJSValue::getValue):

  • dfg/DFGStrengthReductionPhase.cpp:

(JSC::DFG::StrengthReductionPhase::handleNode):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp

    r201470 r207060  
    5252        return jsSingleCharacterString(&vm, u.character);
    5353    case KnownStringImpl:
    54     case NewStringImpl:
    5554        return jsString(&vm, u.stringImpl);
     55    case NewStringImpl:
     56        return jsString(&vm, AtomicStringImpl::add(u.stringImpl));
    5657    }
    5758    RELEASE_ASSERT_NOT_REACHED();
Note: See TracChangeset for help on using the changeset viewer.