Ignore:
Timestamp:
Oct 19, 2017, 3:23:58 PM (8 years ago)
Author:
[email protected]
Message:

We should hard code the poly proto offset
https://bugs.webkit.org/show_bug.cgi?id=178531

Reviewed by Filip Pizlo.

This patch embraces that the poly proto offset is always zero. It's already
the case that we would always get the inline offset zero for poly proto just
by construction. This just hardcodes this assumption throughout the codebase.
This appears to be a 1% speedometer progression in my testing.

The downside of this patch is that it may require changing how we do
things when we implement poly proto when inheriting from builtin
types. I think we can face this problem when we decide to implement
that.

  • bytecode/AccessCase.cpp:

(JSC::AccessCase::generateWithGuard):

  • dfg/DFGOperations.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileInstanceOfForObject):
(JSC::DFG::SpeculativeJIT::compileGetPrototypeOf):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileGetPrototypeOf):
(JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_instanceof):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_instanceof):

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/JSObject.cpp:

(JSC::JSObject::setPrototypeDirect):

  • runtime/JSObject.h:

(JSC::JSObject::locationForOffset const):
(JSC::JSObject::locationForOffset):
(JSC::JSObject::getDirect const):

  • runtime/PropertyOffset.h:
  • runtime/Structure.cpp:

(JSC::Structure::create):
(JSC::Structure::dump const):

  • runtime/Structure.h:
  • runtime/StructureInlines.h:

(JSC::Structure::storedPrototype const):
(JSC::Structure::storedPrototypeObject const):

File:
1 edited

Legend:

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

    r223614 r223715  
    34753475
    34763476                if (hasPolyProto && !hasMonoProto) {
    3477                     LValue prototypeBits = m_out.load64(structure, m_heaps.Structure_prototype);
    3478                     LValue index = m_out.bitAnd(prototypeBits, m_out.constInt64(UINT_MAX));
    3479                     setJSValue(m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), object, index, ScaleEight, JSObject::offsetOfInlineStorage())));
     3477                    setJSValue(m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), object, m_out.constInt64(knownPolyProtoOffset), ScaleEight, JSObject::offsetOfInlineStorage())));
    34803478                    return;
    34813479                }
     
    34873485            LValue prototypeBits = m_out.load64(structure, m_heaps.Structure_prototype);
    34883486            ValueFromBlock directPrototype = m_out.anchor(prototypeBits);
    3489             m_out.branch(isInt32(prototypeBits), unsure(loadPolyProto), unsure(continuation));
     3487            m_out.branch(m_out.isZero64(prototypeBits), unsure(loadPolyProto), unsure(continuation));
    34903488
    34913489            LBasicBlock lastNext = m_out.appendTo(loadPolyProto, continuation);
    3492             LValue index = m_out.bitAnd(prototypeBits, m_out.constInt64(UINT_MAX));
    34933490            ValueFromBlock polyProto = m_out.anchor(
    3494                 m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), object, index, ScaleEight, JSObject::offsetOfInlineStorage())));
     3491                m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), object, m_out.constInt64(knownPolyProtoOffset), ScaleEight, JSObject::offsetOfInlineStorage())));
    34953492            m_out.jump(continuation);
    34963493
     
    90849081        LValue prototypeBits = m_out.load64(structure, m_heaps.Structure_prototype);
    90859082        ValueFromBlock directPrototype = m_out.anchor(prototypeBits);
    9086         m_out.branch(isInt32(prototypeBits), unsure(loadPolyProto), unsure(comparePrototype));
     9083        m_out.branch(m_out.isZero64(prototypeBits), unsure(loadPolyProto), unsure(comparePrototype));
    90879084
    90889085        m_out.appendTo(loadPolyProto, comparePrototype);
    9089         LValue index = m_out.bitAnd(prototypeBits, m_out.constInt64(UINT_MAX));
    90909086        ValueFromBlock polyProto = m_out.anchor(
    9091             m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), value, index, ScaleEight, JSObject::offsetOfInlineStorage())));
     9087            m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), value, m_out.constInt64(knownPolyProtoOffset), ScaleEight, JSObject::offsetOfInlineStorage())));
    90929088        m_out.jump(comparePrototype);
    90939089
Note: See TracChangeset for help on using the changeset viewer.