Ignore:
Timestamp:
Oct 24, 2017, 1:48:03 PM (8 years ago)
Author:
Yusuke Suzuki
Message:

[FTL] Support NewStringObject
https://bugs.webkit.org/show_bug.cgi?id=178737

Reviewed by Saam Barati.

JSTests:

  • stress/new-string-object.js: Added.

(shouldBe):
(test):

Source/JavaScriptCore:

FTL should support NewStringObject and encourage use of NewStringObject in DFG pipeline.
After this change, we can convert CallObjectConstructor(String) to NewStringObject(String).

  • ftl/FTLAbstractHeapRepository.h:
  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileNewStringObject):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r223738 r223919  
    801801            compileNewObject();
    802802            break;
     803        case NewStringObject:
     804            compileNewStringObject();
     805            break;
    803806        case NewArray:
    804807            compileNewArray();
     
    49034906        setJSValue(allocateObject(m_node->structure()));
    49044907        mutatorFence();
     4908    }
     4909
     4910    void compileNewStringObject()
     4911    {
     4912        RegisteredStructure structure = m_node->structure();
     4913        LValue string = lowString(m_node->child1());
     4914
     4915        LBasicBlock slowCase = m_out.newBlock();
     4916        LBasicBlock continuation = m_out.newBlock();
     4917
     4918        LBasicBlock lastNext = m_out.insertNewBlocksBefore(slowCase);
     4919
     4920        LValue fastResultValue = allocateObject<StringObject>(structure, m_out.intPtrZero, slowCase);
     4921        m_out.storePtr(m_out.constIntPtr(StringObject::info()), fastResultValue, m_heaps.JSDestructibleObject_classInfo);
     4922        m_out.store64(string, fastResultValue, m_heaps.JSWrapperObject_internalValue);
     4923        mutatorFence();
     4924        ValueFromBlock fastResult = m_out.anchor(fastResultValue);
     4925        m_out.jump(continuation);
     4926
     4927        m_out.appendTo(slowCase, continuation);
     4928        VM& vm = this->vm();
     4929        LValue slowResultValue = lazySlowPath(
     4930            [=, &vm] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> {
     4931                return createLazyCallGenerator(vm,
     4932                    operationNewStringObject, locations[0].directGPR(), locations[1].directGPR(),
     4933                    CCallHelpers::TrustedImmPtr(structure.get()));
     4934            },
     4935            string);
     4936        ValueFromBlock slowResult = m_out.anchor(slowResultValue);
     4937        m_out.jump(continuation);
     4938
     4939        m_out.appendTo(continuation, lastNext);
     4940        setJSValue(m_out.phi(pointerType(), fastResult, slowResult));
    49054941    }
    49064942   
Note: See TracChangeset for help on using the changeset viewer.