Changeset 55684 in webkit
- Timestamp:
- Mar 8, 2010 2:45:22 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r55679 r55684 1 2010-03-07 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Darin Adler. 4 5 TypeInfo is unnecessarily large 6 https://bugs.webkit.org/show_bug.cgi?id=35850 7 8 Reduce the size of the type and flags members to a single 9 byte each, reducing the size of Structure by 8 bytes. 10 11 * assembler/MacroAssemblerX86Common.h: 12 (JSC::MacroAssemblerX86Common::branch8): 13 (JSC::MacroAssemblerX86Common::branchTest8): 14 (JSC::MacroAssemblerX86Common::setTest8): 15 Add single byte branches, and correct setTest8 to do a 16 single byte read from memory, and actually store the result 17 * assembler/X86Assembler.h: 18 (JSC::X86Assembler::): 19 (JSC::X86Assembler::cmpb_im): 20 (JSC::X86Assembler::testb_im): 21 * jit/JITCall.cpp: 22 (JSC::JIT::emit_op_construct_verify): 23 * jit/JITOpcodes.cpp: 24 (JSC::JIT::emit_op_instanceof): 25 (JSC::JIT::emit_op_jeq_null): 26 (JSC::JIT::emit_op_jneq_null): 27 (JSC::JIT::emit_op_get_pnames): 28 (JSC::JIT::emit_op_convert_this): 29 (JSC::JIT::emit_op_construct_verify): 30 (JSC::JIT::emit_op_to_jsnumber): 31 (JSC::JIT::emit_op_eq_null): 32 (JSC::JIT::emit_op_neq_null): 33 * runtime/JSTypeInfo.h: 34 (JSC::TypeInfo::TypeInfo): 35 (JSC::TypeInfo::type): 36 1 37 2010-03-08 Gavin Barraclough <barraclough@apple.com> 2 38 -
trunk/JavaScriptCore/assembler/MacroAssemblerX86Common.h
r55633 r55684 619 619 620 620 public: 621 Jump branch8(Condition cond, Address left, Imm32 right) 622 { 623 m_assembler.cmpb_im(right.m_value, left.offset, left.base); 624 return Jump(m_assembler.jCC(x86Condition(cond))); 625 } 626 621 627 Jump branch32(Condition cond, RegisterID left, RegisterID right) 622 628 { … … 714 720 else 715 721 m_assembler.testl_i32m(mask.m_value, address.offset, address.base, address.index, address.scale); 722 return Jump(m_assembler.jCC(x86Condition(cond))); 723 } 724 725 Jump branchTest8(Condition cond, Address address, Imm32 mask = Imm32(-1)) 726 { 727 ASSERT((cond == Zero) || (cond == NonZero)); 728 if (mask.m_value == -1) 729 m_assembler.cmpb_im(0, address.offset, address.base); 730 else 731 m_assembler.testb_im(mask.m_value, address.offset, address.base); 716 732 return Jump(m_assembler.jCC(x86Condition(cond))); 717 733 } … … 916 932 { 917 933 if (mask.m_value == -1) 918 m_assembler.cmp l_im(0, address.offset, address.base);934 m_assembler.cmpb_im(0, address.offset, address.base); 919 935 else 920 m_assembler.test l_i32m(mask.m_value, address.offset, address.base);936 m_assembler.testb_im(mask.m_value, address.offset, address.base); 921 937 m_assembler.setCC_r(x86Condition(cond), dest); 938 m_assembler.movzbl_rr(dest, dest); 922 939 } 923 940 -
trunk/JavaScriptCore/assembler/X86Assembler.h
r55633 r55684 129 129 OP_PUSH_Iz = 0x68, 130 130 OP_IMUL_GvEvIz = 0x69, 131 OP_GROUP1_EbIb = 0x80, 131 132 OP_GROUP1_EvIz = 0x81, 132 133 OP_GROUP1_EvIb = 0x83, … … 759 760 m_formatter.immediate32(imm); 760 761 } 761 762 762 763 void cmpl_im(int imm, int offset, RegisterID base) 763 764 { … … 769 770 m_formatter.immediate32(imm); 770 771 } 772 } 773 774 void cmpb_im(int imm, int offset, RegisterID base) 775 { 776 m_formatter.oneByteOp(OP_GROUP1_EbIb, GROUP1_OP_CMP, base, offset); 777 m_formatter.immediate8(imm); 771 778 } 772 779 … … 888 895 m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, offset); 889 896 m_formatter.immediate32(imm); 897 } 898 899 void testb_im(int imm, int offset, RegisterID base) 900 { 901 m_formatter.oneByteOp(OP_GROUP3_EbIb, GROUP3_OP_TEST, base, offset); 902 m_formatter.immediate8(imm); 890 903 } 891 904 -
trunk/JavaScriptCore/jit/JITCall.cpp
r51067 r55684 160 160 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag))); 161 161 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 162 addSlowCase(branch 32(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType)));162 addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType))); 163 163 } 164 164 -
trunk/JavaScriptCore/jit/JITOpcodes.cpp
r55615 r55684 517 517 // Check that baseVal 'ImplementsDefaultHasInstance'. 518 518 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0); 519 addSlowCase(branchTest 32(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))); 520 520 521 521 // Optimistically load the result true, and start looping. … … 870 870 // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. 871 871 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 872 addJump(branchTest 32(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); 873 873 874 874 Jump wasNotImmediate = jump(); … … 897 897 // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. 898 898 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 899 addJump(branchTest 32(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); 900 900 901 901 Jump wasNotImmediate = jump(); … … 1210 1210 if (base != m_codeBlock->thisRegister()) { 1211 1211 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 1212 isNotObject.append(branch 32(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))); 1213 1213 } 1214 1214 … … 1489 1489 1490 1490 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 1491 addSlowCase(branchTest 32(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))); 1492 1492 1493 1493 map(m_bytecodeIndex + OPCODE_LENGTH(op_convert_this), thisRegister, regT1, regT0); … … 1993 1993 // Check that baseVal 'ImplementsDefaultHasInstance'. 1994 1994 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0); 1995 addSlowCase(branchTest 32(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))); 1996 1996 1997 1997 // Optimistically load the result true, and start looping. … … 2154 2154 emitJumpSlowCaseIfNotJSCell(regT0); 2155 2155 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 2156 addSlowCase(branch 32(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))); 2157 2157 2158 2158 } … … 2263 2263 // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. 2264 2264 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 2265 addJump(branchTest 32(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); 2266 2266 Jump wasNotImmediate = jump(); 2267 2267 … … 2284 2284 // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure. 2285 2285 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 2286 addJump(branchTest 32(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); 2287 2287 Jump wasNotImmediate = jump(); 2288 2288 … … 2440 2440 if (base != m_codeBlock->thisRegister()) { 2441 2441 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 2442 isNotObject.append(branch 32(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))); 2443 2443 } 2444 2444 … … 2591 2591 emitJumpSlowCaseIfNotJSCell(regT0, srcVReg); 2592 2592 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 2593 addSlowCase(branch 32(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))); 2594 2594 2595 2595 wasImmediate.link(this); … … 2702 2702 2703 2703 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 2704 setTest 32(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); 2705 2705 2706 2706 Jump wasNotImmediate = jump(); … … 2727 2727 2728 2728 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); 2729 setTest 32(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); 2730 2730 2731 2731 Jump wasNotImmediate = jump(); … … 2787 2787 emitJumpSlowCaseIfNotJSCell(regT0); 2788 2788 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT1); 2789 addSlowCase(branchTest 32(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))); 2790 2790 2791 2791 } -
trunk/JavaScriptCore/runtime/JSTypeInfo.h
r49694 r55684 51 51 : m_type(type) 52 52 { 53 ASSERT(flags <= 0xFF); 54 ASSERT(type <= 0xFF); 53 55 // ImplementsDefaultHasInstance means (ImplementsHasInstance & !OverridesHasInstance) 54 56 if ((flags & (ImplementsHasInstance | OverridesHasInstance)) == ImplementsHasInstance) … … 58 60 } 59 61 60 JSType type() const { return m_type; }62 JSType type() const { return (JSType)m_type; } 61 63 62 64 bool masqueradesAsUndefined() const { return m_flags & MasqueradesAsUndefined; } … … 70 72 71 73 private: 72 JSTypem_type;73 unsigned m_flags;74 unsigned char m_type; 75 unsigned char m_flags; 74 76 }; 75 77
Note: See TracChangeset
for help on using the changeset viewer.