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.h

    r148893 r149247  
    710710        void emit_op_nstricteq(Instruction*);
    711711        void emit_op_pop_scope(Instruction*);
    712         void emit_op_post_dec(Instruction*);
    713         void emit_op_post_inc(Instruction*);
    714         void emit_op_pre_dec(Instruction*);
    715         void emit_op_pre_inc(Instruction*);
     712        void emit_op_dec(Instruction*);
     713        void emit_op_inc(Instruction*);
    716714        void emit_op_profile_did_call(Instruction*);
    717715        void emit_op_profile_will_call(Instruction*);
     
    745743        void emit_op_throw(Instruction*);
    746744        void emit_op_throw_static_error(Instruction*);
    747         void emit_op_to_jsnumber(Instruction*);
     745        void emit_op_to_number(Instruction*);
    748746        void emit_op_to_primitive(Instruction*);
    749747        void emit_op_unexpected_load(Instruction*);
     
    790788        void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&);
    791789        void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
    792         void emitSlow_op_post_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
    793         void emitSlow_op_post_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
    794         void emitSlow_op_pre_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
    795         void emitSlow_op_pre_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
     790        void emitSlow_op_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
     791        void emitSlow_op_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
    796792        void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
    797793        void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
     
    800796        void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
    801797        void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
    802         void emitSlow_op_to_jsnumber(Instruction*, Vector<SlowCaseEntry>::iterator&);
     798        void emitSlow_op_to_number(Instruction*, Vector<SlowCaseEntry>::iterator&);
    803799        void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
    804800        void emitSlow_op_urshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
Note: See TracChangeset for help on using the changeset viewer.