Changeset 52051 in webkit
- Timestamp:
- Dec 12, 2009 9:52:21 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r52047 r52051 1 2009-12-11 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 Unify codegen for forward and backward variants of branches 6 https://bugs.webkit.org/show_bug.cgi?id=32463 7 8 * jit/JIT.h: 9 (JSC::JIT::emit_op_loop): Implemented in terms of forward variant. 10 (JSC::JIT::emit_op_loop_if_true): ditto 11 (JSC::JIT::emitSlow_op_loop_if_true): ditto 12 (JSC::JIT::emit_op_loop_if_false): ditto 13 (JSC::JIT::emitSlow_op_loop_if_false): ditto 14 (JSC::JIT::emit_op_loop_if_less): ditto 15 (JSC::JIT::emitSlow_op_loop_if_less): ditto 16 * jit/JITOpcodes.cpp: 17 1 18 2009-12-11 Sam Weinig <sam@webkit.org> 2 19 -
trunk/JavaScriptCore/jit/JIT.h
r51735 r52051 955 955 #endif 956 956 } JIT_CLASS_ALIGNMENT; 957 958 inline void JIT::emit_op_loop(Instruction* currentInstruction) 959 { 960 emitTimeoutCheck(); 961 emit_op_jmp(currentInstruction); 962 } 963 964 inline void JIT::emit_op_loop_if_true(Instruction* currentInstruction) 965 { 966 emitTimeoutCheck(); 967 emit_op_jtrue(currentInstruction); 968 } 969 970 inline void JIT::emitSlow_op_loop_if_true(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 971 { 972 emitSlow_op_jtrue(currentInstruction, iter); 973 } 974 975 inline void JIT::emit_op_loop_if_false(Instruction* currentInstruction) 976 { 977 emitTimeoutCheck(); 978 emit_op_jfalse(currentInstruction); 979 } 980 981 inline void JIT::emitSlow_op_loop_if_false(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 982 { 983 emitSlow_op_jfalse(currentInstruction, iter); 984 } 985 986 inline void JIT::emit_op_loop_if_less(Instruction* currentInstruction) 987 { 988 emitTimeoutCheck(); 989 emit_op_jless(currentInstruction); 990 } 991 992 inline void JIT::emitSlow_op_loop_if_less(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 993 { 994 emitSlow_op_jless(currentInstruction, iter); 995 } 996 957 997 } // namespace JSC 958 998 -
trunk/JavaScriptCore/jit/JITOpcodes.cpp
r51964 r52051 410 410 } 411 411 412 void JIT::emit_op_loop(Instruction* currentInstruction)413 {414 unsigned target = currentInstruction[1].u.operand;415 emitTimeoutCheck();416 addJump(jump(), target);417 }418 419 void JIT::emit_op_loop_if_less(Instruction* currentInstruction)420 {421 unsigned op1 = currentInstruction[1].u.operand;422 unsigned op2 = currentInstruction[2].u.operand;423 unsigned target = currentInstruction[3].u.operand;424 425 emitTimeoutCheck();426 427 if (isOperandConstantImmediateInt(op1)) {428 emitLoad(op2, regT1, regT0);429 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));430 addJump(branch32(GreaterThan, regT0, Imm32(getConstantOperand(op1).asInt32())), target);431 return;432 }433 434 if (isOperandConstantImmediateInt(op2)) {435 emitLoad(op1, regT1, regT0);436 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));437 addJump(branch32(LessThan, regT0, Imm32(getConstantOperand(op2).asInt32())), target);438 return;439 }440 441 emitLoad2(op1, regT1, regT0, op2, regT3, regT2);442 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));443 addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));444 addJump(branch32(LessThan, regT0, regT2), target);445 }446 447 void JIT::emitSlow_op_loop_if_less(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)448 {449 unsigned op1 = currentInstruction[1].u.operand;450 unsigned op2 = currentInstruction[2].u.operand;451 unsigned target = currentInstruction[3].u.operand;452 453 if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))454 linkSlowCase(iter); // int32 check455 linkSlowCase(iter); // int32 check456 457 JITStubCall stubCall(this, cti_op_jless);458 stubCall.addArgument(op1);459 stubCall.addArgument(op2);460 stubCall.call();461 emitJumpSlowToHot(branchTest32(NonZero, regT0), target);462 }463 464 412 void JIT::emit_op_loop_if_lesseq(Instruction* currentInstruction) 465 413 { … … 708 656 stubCall.addArgument(Imm32(currentInstruction[3].u.operand)); 709 657 stubCall.call(currentInstruction[1].u.operand); 710 }711 712 void JIT::emit_op_loop_if_true(Instruction* currentInstruction)713 {714 unsigned cond = currentInstruction[1].u.operand;715 unsigned target = currentInstruction[2].u.operand;716 717 emitTimeoutCheck();718 719 emitLoad(cond, regT1, regT0);720 721 Jump isNotInteger = branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag));722 addJump(branch32(NotEqual, regT0, Imm32(0)), target);723 Jump isNotZero = jump();724 725 isNotInteger.link(this);726 727 addJump(branch32(Equal, regT1, Imm32(JSValue::TrueTag)), target);728 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::FalseTag)));729 730 isNotZero.link(this);731 }732 733 void JIT::emitSlow_op_loop_if_true(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)734 {735 unsigned cond = currentInstruction[1].u.operand;736 unsigned target = currentInstruction[2].u.operand;737 738 linkSlowCase(iter);739 740 JITStubCall stubCall(this, cti_op_jtrue);741 stubCall.addArgument(cond);742 stubCall.call();743 emitJumpSlowToHot(branchTest32(NonZero, regT0), target);744 }745 746 void JIT::emit_op_loop_if_false(Instruction* currentInstruction)747 {748 unsigned cond = currentInstruction[1].u.operand;749 unsigned target = currentInstruction[2].u.operand;750 751 emitTimeoutCheck();752 753 emitLoad(cond, regT1, regT0);754 755 Jump isTrue = branch32(Equal, regT1, Imm32(JSValue::TrueTag));756 addJump(branch32(Equal, regT1, Imm32(JSValue::FalseTag)), target);757 758 Jump isNotInteger = branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag));759 Jump isTrue2 = branch32(NotEqual, regT0, Imm32(0));760 addJump(jump(), target);761 762 if (supportsFloatingPoint()) {763 isNotInteger.link(this);764 765 addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));766 767 zeroDouble(fpRegT0);768 emitLoadDouble(cond, fpRegT1);769 addJump(branchDouble(DoubleEqualOrUnordered, fpRegT0, fpRegT1), target);770 } else771 addSlowCase(isNotInteger);772 773 isTrue.link(this);774 isTrue2.link(this);775 }776 777 void JIT::emitSlow_op_loop_if_false(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)778 {779 unsigned cond = currentInstruction[1].u.operand;780 unsigned target = currentInstruction[2].u.operand;781 782 linkSlowCase(iter);783 784 JITStubCall stubCall(this, cti_op_jtrue);785 stubCall.addArgument(cond);786 stubCall.call();787 emitJumpSlowToHot(branchTest32(Zero, regT0), target);788 658 } 789 659 … … 2006 1876 } 2007 1877 2008 void JIT::emit_op_loop(Instruction* currentInstruction)2009 {2010 emitTimeoutCheck();2011 2012 unsigned target = currentInstruction[1].u.operand;2013 addJump(jump(), target);2014 }2015 2016 void JIT::emit_op_loop_if_less(Instruction* currentInstruction)2017 {2018 emitTimeoutCheck();2019 2020 unsigned op1 = currentInstruction[1].u.operand;2021 unsigned op2 = currentInstruction[2].u.operand;2022 unsigned target = currentInstruction[3].u.operand;2023 if (isOperandConstantImmediateInt(op2)) {2024 emitGetVirtualRegister(op1, regT0);2025 emitJumpSlowCaseIfNotImmediateInteger(regT0);2026 #if USE(JSVALUE64)2027 int32_t op2imm = getConstantOperandImmediateInt(op2);2028 #else2029 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));2030 #endif2031 addJump(branch32(LessThan, regT0, Imm32(op2imm)), target);2032 } else if (isOperandConstantImmediateInt(op1)) {2033 emitGetVirtualRegister(op2, regT0);2034 emitJumpSlowCaseIfNotImmediateInteger(regT0);2035 #if USE(JSVALUE64)2036 int32_t op1imm = getConstantOperandImmediateInt(op1);2037 #else2038 int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)));2039 #endif2040 addJump(branch32(GreaterThan, regT0, Imm32(op1imm)), target);2041 } else {2042 emitGetVirtualRegisters(op1, regT0, op2, regT1);2043 emitJumpSlowCaseIfNotImmediateInteger(regT0);2044 emitJumpSlowCaseIfNotImmediateInteger(regT1);2045 addJump(branch32(LessThan, regT0, regT1), target);2046 }2047 }2048 2049 1878 void JIT::emit_op_loop_if_lesseq(Instruction* currentInstruction) 2050 1879 { … … 2285 2114 } 2286 2115 2287 void JIT::emit_op_loop_if_true(Instruction* currentInstruction)2288 {2289 emitTimeoutCheck();2290 2291 unsigned target = currentInstruction[2].u.operand;2292 emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);2293 2294 Jump isZero = branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsNumber(m_globalData, 0))));2295 addJump(emitJumpIfImmediateInteger(regT0), target);2296 2297 addJump(branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsBoolean(true)))), target);2298 addSlowCase(branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(jsBoolean(false)))));2299 2300 isZero.link(this);2301 };2302 2303 void JIT::emit_op_loop_if_false(Instruction* currentInstruction)2304 {2305 emitTimeoutCheck();2306 2307 2308 unsigned target = currentInstruction[2].u.operand;2309 emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);2310 2311 addJump(branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsNumber(m_globalData, 0)))), target);2312 Jump isNonZero = emitJumpIfImmediateInteger(regT0);2313 2314 addJump(branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsBoolean(false)))), target);2315 addSlowCase(branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(jsBoolean(true)))));2316 2317 isNonZero.link(this);2318 RECORD_JUMP_TARGET(target);2319 };2320 2321 2116 void JIT::emit_op_resolve_base(Instruction* currentInstruction) 2322 2117 { … … 2996 2791 stubCall.addArgument(property, regT2); 2997 2792 stubCall.call(dst); 2998 }2999 3000 void JIT::emitSlow_op_loop_if_less(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)3001 {3002 unsigned op1 = currentInstruction[1].u.operand;3003 unsigned op2 = currentInstruction[2].u.operand;3004 unsigned target = currentInstruction[3].u.operand;3005 if (isOperandConstantImmediateInt(op2)) {3006 linkSlowCase(iter);3007 JITStubCall stubCall(this, cti_op_jless);3008 stubCall.addArgument(regT0);3009 stubCall.addArgument(op2, regT2);3010 stubCall.call();3011 emitJumpSlowToHot(branchTest32(NonZero, regT0), target);3012 } else if (isOperandConstantImmediateInt(op1)) {3013 linkSlowCase(iter);3014 JITStubCall stubCall(this, cti_op_jless);3015 stubCall.addArgument(op1, regT2);3016 stubCall.addArgument(regT0);3017 stubCall.call();3018 emitJumpSlowToHot(branchTest32(NonZero, regT0), target);3019 } else {3020 linkSlowCase(iter);3021 linkSlowCase(iter);3022 JITStubCall stubCall(this, cti_op_jless);3023 stubCall.addArgument(regT0);3024 stubCall.addArgument(regT1);3025 stubCall.call();3026 emitJumpSlowToHot(branchTest32(NonZero, regT0), target);3027 }3028 2793 } 3029 2794 … … 3068 2833 } 3069 2834 3070 void JIT::emitSlow_op_loop_if_true(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)3071 {3072 linkSlowCase(iter);3073 JITStubCall stubCall(this, cti_op_jtrue);3074 stubCall.addArgument(regT0);3075 stubCall.call();3076 emitJumpSlowToHot(branchTest32(NonZero, regT0), currentInstruction[2].u.operand);3077 }3078 3079 void JIT::emitSlow_op_loop_if_false(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)3080 {3081 linkSlowCase(iter);3082 JITStubCall stubCall(this, cti_op_jtrue);3083 stubCall.addArgument(regT0);3084 stubCall.call();3085 emitJumpSlowToHot(branchTest32(Zero, regT0), currentInstruction[2].u.operand); // inverted!3086 }3087 3088 2835 void JIT::emitSlow_op_not(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 3089 2836 { -
trunk/WebKitTools/Scripts/sunspider-compare-results
r49476 r52051 94 94 sub pathToSystemJSC() 95 95 { 96 my $path = "/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc";97 if (-f $path) {98 return $path;99 }96 # my $path = "/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc"; 97 # if (-f $path) { 98 # return $path; 99 # } 100 100 return undef; 101 101 }
Note: See TracChangeset
for help on using the changeset viewer.