Ignore:
Timestamp:
Apr 27, 2013, 4:14:04 PM (12 years ago)
Author:
[email protected]
Message:

Cleaned up pre/post inc/dec in bytecode
https://bugs.webkit.org/show_bug.cgi?id=115222

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

A few related changes here:

(*) Removed post_inc and post_dec. The two-result form was awkward to
reason about. Being explicit about the intermediate mov and to_number
reduces DFG overhead, removes some fragile ASSERTs from the DFG, and
fixes a const bug. Plus, we get to blow away 262 lines of code.

(*) Renamed pre_inc and pre_dec to inc and dec, since there's only one
version now.

(*) Renamed to_jsnumber to to_number, to match the ECMA name.

(*) Tightened up the codegen and runtime support for to_number.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):

  • bytecode/Opcode.h:

(JSC::padOpcodeName):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitInc):
(JSC::BytecodeGenerator::emitDec):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::emitToNumber):
(BytecodeGenerator): Removed post_inc and post_dec.

  • bytecompiler/NodesCodegen.cpp:

(JSC::emitPreIncOrDec): Updated for rename.

(JSC::emitPostIncOrDec): Issue an explicit mov and to_number when needed.
These are rare, and they boil away in the DFG.

(JSC::PostfixNode::emitResolve):
(JSC::PrefixNode::emitResolve): For const, use an explicit mov instead
of any special forms. This fixes a bug where we would do string
add/subtract instead of number.

  • dfg/DFGByteCodeParser.cpp:

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

  • dfg/DFGCapabilities.h:

(JSC::DFG::canCompileOpcode):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_inc):
(JSC::JIT::emitSlow_op_inc):
(JSC::JIT::emit_op_dec):
(JSC::JIT::emitSlow_op_dec):

  • jit/JITArithmetic32_64.cpp:

(JSC::JIT::emit_op_inc):
(JSC::JIT::emitSlow_op_inc):
(JSC::JIT::emit_op_dec):
(JSC::JIT::emitSlow_op_dec): Removed post_inc/dec, and updated for renames.

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_to_number):
(JSC::JIT::emitSlow_op_to_number): Removed a test for number cells. There's
no such thing!

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_to_number): Use LowestTag to avoid making assumptions
about the lowest valued tag.

(JSC::JIT::emitSlow_op_to_number): Updated for renames.

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LLIntSlowPaths.h:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • parser/NodeConstructors.h:

(JSC::UnaryPlusNode::UnaryPlusNode): Removed post_inc/dec, and updated for renames.

  • runtime/Operations.cpp:

(JSC::jsIsObjectType): Removed a test for number cells. There's
no such thing!

LayoutTests:

  • fast/js/const-expected.txt:
  • fast/js/resources/const.js: Added tests for some const cases we used

to get wrong.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r148893 r149247  
    291291        DEFINE_OP(op_nstricteq)
    292292        DEFINE_OP(op_pop_scope)
    293         DEFINE_OP(op_post_dec)
    294         DEFINE_OP(op_post_inc)
    295         DEFINE_OP(op_pre_dec)
    296         DEFINE_OP(op_pre_inc)
     293        DEFINE_OP(op_dec)
     294        DEFINE_OP(op_inc)
    297295        DEFINE_OP(op_profile_did_call)
    298296        DEFINE_OP(op_profile_will_call)
     
    347345        DEFINE_OP(op_throw)
    348346        DEFINE_OP(op_throw_static_error)
    349         DEFINE_OP(op_to_jsnumber)
     347        DEFINE_OP(op_to_number)
    350348        DEFINE_OP(op_to_primitive)
    351349
     
    471469        DEFINE_SLOWCASE_OP(op_not)
    472470        DEFINE_SLOWCASE_OP(op_nstricteq)
    473         DEFINE_SLOWCASE_OP(op_post_dec)
    474         DEFINE_SLOWCASE_OP(op_post_inc)
    475         DEFINE_SLOWCASE_OP(op_pre_dec)
    476         DEFINE_SLOWCASE_OP(op_pre_inc)
     471        DEFINE_SLOWCASE_OP(op_dec)
     472        DEFINE_SLOWCASE_OP(op_inc)
    477473        case op_put_by_id_out_of_line:
    478474        case op_put_by_id_transition_direct:
     
    487483        DEFINE_SLOWCASE_OP(op_stricteq)
    488484        DEFINE_SLOWCASE_OP(op_sub)
    489         DEFINE_SLOWCASE_OP(op_to_jsnumber)
     485        DEFINE_SLOWCASE_OP(op_to_number)
    490486        DEFINE_SLOWCASE_OP(op_to_primitive)
    491487
Note: See TracChangeset for help on using the changeset viewer.