Changeset 209295 in webkit


Ignore:
Timestamp:
Dec 2, 2016 10:40:37 PM (7 years ago)
Author:
keith_miller@apple.com
Message:

[JSC] add additional bit to JSTokenType bitfield
https://bugs.webkit.org/show_bug.cgi?id=165091

Patch by Caitlin Potter <caitp@igalia.com> on 2016-12-02
Reviewed by Geoffrey Garen.

JSTests:

  • stress/bug-165091.js: Added.

(shouldThrowSyntaxError):

Source/JavaScriptCore:

Avoid overflow which causes keyword tokens to be treated as unary
tokens now that "async" is tokenized as a keyword, by granting an
additional 64 bits to be occupied by token IDs.

  • parser/ParserTokens.h:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r209293 r209295  
    2424        "Unreviewed, forgot to change instruction after renaming."
    2525        http://trac.webkit.org/changeset/209276
     26
     272016-12-02  Keith Miller  <keith_miller@apple.com>
     28
     29        Add Wasm floating point nearest and trunc
     30        https://bugs.webkit.org/show_bug.cgi?id=165339
     31
     32        Reviewed by Saam Barati.
     33
     34        * wasm/function-tests/nearest.js: Added.
     35        * wasm/function-tests/trunc.js: Added.
    2636
    27372016-12-02  Keith Miller  <keith_miller@apple.com>
  • trunk/Source/JavaScriptCore/ChangeLog

    r209293 r209295  
    4848        "Unreviewed, forgot to change instruction after renaming."
    4949        http://trac.webkit.org/changeset/209276
     50
     512016-12-02  Keith Miller  <keith_miller@apple.com>
     52
     53        Add Wasm floating point nearest and trunc
     54        https://bugs.webkit.org/show_bug.cgi?id=165339
     55
     56        Reviewed by Saam Barati.
     57
     58        This patch also allows any wasm primitive type to be passed as a
     59        string.
     60
     61        * assembler/MacroAssemblerARM64.h:
     62        (JSC::MacroAssemblerARM64::nearestIntDouble):
     63        (JSC::MacroAssemblerARM64::nearestIntFloat):
     64        (JSC::MacroAssemblerARM64::truncDouble):
     65        (JSC::MacroAssemblerARM64::truncFloat):
     66        * assembler/MacroAssemblerX86Common.h:
     67        (JSC::MacroAssemblerX86Common::nearestIntDouble):
     68        (JSC::MacroAssemblerX86Common::nearestIntFloat):
     69        * jsc.cpp:
     70        (box):
     71        * wasm/WasmB3IRGenerator.cpp:
     72        (JSC::Wasm::B3IRGenerator::addOp<F64ConvertUI64>):
     73        (JSC::Wasm::B3IRGenerator::addOp<OpType::F32ConvertUI64>):
     74        (JSC::Wasm::B3IRGenerator::addOp<OpType::F64Nearest>):
     75        (JSC::Wasm::B3IRGenerator::addOp<OpType::F32Nearest>):
     76        (JSC::Wasm::B3IRGenerator::addOp<OpType::F64Trunc>):
     77        (JSC::Wasm::B3IRGenerator::addOp<OpType::F32Trunc>):
     78        * wasm/WasmFunctionParser.h:
     79        (JSC::Wasm::FunctionParser<Context>::parseExpression):
    5080
    51812016-12-02  Keith Miller  <keith_miller@apple.com>
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h

    r209283 r209295  
    15611561    }
    15621562
     1563    void roundTowardNearestIntDouble(FPRegisterID src, FPRegisterID dest)
     1564    {
     1565        m_assembler.frintn<64>(dest, src);
     1566    }
     1567
     1568    void roundTowardNearestIntFloat(FPRegisterID src, FPRegisterID dest)
     1569    {
     1570        m_assembler.frintn<32>(dest, src);
     1571    }
     1572
    15631573    void roundTowardZeroDouble(FPRegisterID src, FPRegisterID dest)
    15641574    {
     
    15701580        m_assembler.frintz<32>(dest, src);
    15711581    }
     1582
    15721583
    15731584    // Convert 'src' to an integer, and places the resulting 'dest'.
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h

    r209283 r209295  
    796796    {
    797797        m_assembler.roundss_mr(src.offset, src.base, dst, X86Assembler::RoundingType::TowardNegativeInfiniti);
     798    }
     799
     800    void roundTowardNearestIntDouble(FPRegisterID src, FPRegisterID dst)
     801    {
     802        m_assembler.roundsd_rr(src, dst, X86Assembler::RoundingType::ToNearestWithTiesToEven);
     803    }
     804
     805    void roundTowardNearestIntFloat(FPRegisterID src, FPRegisterID dst)
     806    {
     807        m_assembler.roundss_rr(src, dst, X86Assembler::RoundingType::ToNearestWithTiesToEven);
    798808    }
    799809
  • trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp

    r209283 r209295  
    784784}
    785785
     786template<>
     787bool B3IRGenerator::addOp<OpType::F64Nearest>(ExpressionType arg, ExpressionType& result)
     788{
     789    PatchpointValue* patchpoint = m_currentBlock->appendNew<PatchpointValue>(m_proc, Double, Origin());
     790    patchpoint->append(arg, ValueRep::SomeRegister);
     791    patchpoint->setGenerator([=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
     792        jit.roundTowardNearestIntDouble(params[1].fpr(), params[0].fpr());
     793    });
     794    patchpoint->effects = Effects::none();
     795    result = patchpoint;
     796    return true;
     797}
     798
     799template<>
     800bool B3IRGenerator::addOp<OpType::F32Nearest>(ExpressionType arg, ExpressionType& result)
     801{
     802    PatchpointValue* patchpoint = m_currentBlock->appendNew<PatchpointValue>(m_proc, Float, Origin());
     803    patchpoint->append(arg, ValueRep::SomeRegister);
     804    patchpoint->setGenerator([=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
     805        jit.roundTowardNearestIntFloat(params[1].fpr(), params[0].fpr());
     806    });
     807    patchpoint->effects = Effects::none();
     808    result = patchpoint;
     809    return true;
     810}
     811
     812template<>
     813bool B3IRGenerator::addOp<OpType::F64Trunc>(ExpressionType arg, ExpressionType& result)
     814{
     815    PatchpointValue* patchpoint = m_currentBlock->appendNew<PatchpointValue>(m_proc, Double, Origin());
     816    patchpoint->append(arg, ValueRep::SomeRegister);
     817    patchpoint->setGenerator([=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
     818        jit.roundTowardZeroDouble(params[1].fpr(), params[0].fpr());
     819    });
     820    patchpoint->effects = Effects::none();
     821    result = patchpoint;
     822    return true;
     823}
     824
     825template<>
     826bool B3IRGenerator::addOp<OpType::F32Trunc>(ExpressionType arg, ExpressionType& result)
     827{
     828    PatchpointValue* patchpoint = m_currentBlock->appendNew<PatchpointValue>(m_proc, Float, Origin());
     829    patchpoint->append(arg, ValueRep::SomeRegister);
     830    patchpoint->setGenerator([=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
     831        jit.roundTowardZeroFloat(params[1].fpr(), params[0].fpr());
     832    });
     833    patchpoint->effects = Effects::none();
     834    result = patchpoint;
     835    return true;
     836}
     837
    786838} } // namespace JSC::Wasm
    787839
Note: See TracChangeset for help on using the changeset viewer.