Ignore:
Timestamp:
Mar 8, 2010, 2:45:22 PM (15 years ago)
Author:
[email protected]
Message:

2010-03-07 Oliver Hunt <[email protected]>

Reviewed by Darin Adler.

TypeInfo is unnecessarily large
https://bugs.webkit.org/show_bug.cgi?id=35850

Reduce the size of the type and flags members to a single
byte each, reducing the size of Structure by 8 bytes.

  • assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::branch8): (JSC::MacroAssemblerX86Common::branchTest8): (JSC::MacroAssemblerX86Common::setTest8): Add single byte branches, and correct setTest8 to do a single byte read from memory, and actually store the result
  • assembler/X86Assembler.h: (JSC::X86Assembler::): (JSC::X86Assembler::cmpb_im): (JSC::X86Assembler::testb_im):
  • jit/JITCall.cpp: (JSC::JIT::emit_op_construct_verify):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_get_pnames): (JSC::JIT::emit_op_convert_this): (JSC::JIT::emit_op_construct_verify): (JSC::JIT::emit_op_to_jsnumber): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null):
  • runtime/JSTypeInfo.h: (JSC::TypeInfo::TypeInfo): (JSC::TypeInfo::type):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JITOpcodes.cpp

    r55615 r55684  
    517517    // Check that baseVal 'ImplementsDefaultHasInstance'.
    518518    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0);
    519     addSlowCase(branchTest32(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsDefaultHasInstance)));
     519    addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsDefaultHasInstance)));
    520520
    521521    // Optimistically load the result true, and start looping.
     
    870870    // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
    871871    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    872     addJump(branchTest32(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
     872    addJump(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
    873873
    874874    Jump wasNotImmediate = jump();
     
    897897    // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
    898898    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    899     addJump(branchTest32(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
     899    addJump(branchTest8(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
    900900
    901901    Jump wasNotImmediate = jump();
     
    12101210    if (base != m_codeBlock->thisRegister()) {
    12111211        loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    1212         isNotObject.append(branch32(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
     1212        isNotObject.append(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
    12131213    }
    12141214
     
    14891489
    14901490    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    1491     addSlowCase(branchTest32(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
     1491    addSlowCase(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
    14921492
    14931493    map(m_bytecodeIndex + OPCODE_LENGTH(op_convert_this), thisRegister, regT1, regT0);
     
    19931993    // Check that baseVal 'ImplementsDefaultHasInstance'.
    19941994    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0);
    1995     addSlowCase(branchTest32(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsDefaultHasInstance)));
     1995    addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsDefaultHasInstance)));
    19961996
    19971997    // Optimistically load the result true, and start looping.
     
    21542154    emitJumpSlowCaseIfNotJSCell(regT0);
    21552155    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    2156     addSlowCase(branch32(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType)));
     2156    addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
    21572157
    21582158}
     
    22632263    // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
    22642264    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    2265     addJump(branchTest32(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
     2265    addJump(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
    22662266    Jump wasNotImmediate = jump();
    22672267
     
    22842284    // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
    22852285    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    2286     addJump(branchTest32(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
     2286    addJump(branchTest8(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
    22872287    Jump wasNotImmediate = jump();
    22882288
     
    24402440    if (base != m_codeBlock->thisRegister()) {
    24412441        loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    2442         isNotObject.append(branch32(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
     2442        isNotObject.append(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
    24432443    }
    24442444
     
    25912591    emitJumpSlowCaseIfNotJSCell(regT0, srcVReg);
    25922592    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    2593     addSlowCase(branch32(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(NumberType)));
     2593    addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(NumberType)));
    25942594   
    25952595    wasImmediate.link(this);
     
    27022702
    27032703    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    2704     setTest32(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT0);
     2704    setTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT0);
    27052705
    27062706    Jump wasNotImmediate = jump();
     
    27272727
    27282728    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
    2729     setTest32(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT0);
     2729    setTest8(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT0);
    27302730
    27312731    Jump wasNotImmediate = jump();
     
    27872787    emitJumpSlowCaseIfNotJSCell(regT0);
    27882788    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT1);
    2789     addSlowCase(branchTest32(NonZero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
     2789    addSlowCase(branchTest8(NonZero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
    27902790
    27912791}
Note: See TracChangeset for help on using the changeset viewer.