Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index 25a833eebfd71ec05e49241b8cc29a55419816f2..2cd083be7dafbe50318e8020e8288d8d946c7f2c 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -2035,203 +2035,6 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
} |
-Handle<Code> CallStubCompiler::CompileMathFloorCall( |
- Handle<Object> object, |
- Handle<JSObject> holder, |
- Handle<Cell> cell, |
- Handle<JSFunction> function, |
- Handle<String> name, |
- Code::StubType type) { |
- if (!CpuFeatures::IsSupported(SSE2)) { |
- return Handle<Code>::null(); |
- } |
- |
- CpuFeatureScope use_sse2(masm(), SSE2); |
- |
- const int argc = arguments().immediate(); |
- |
- // If the object is not a JSObject or we got an unexpected number of |
- // arguments, bail out to the regular call. |
- if (!object->IsJSObject() || argc != 1) { |
- return Handle<Code>::null(); |
- } |
- |
- Label miss; |
- |
- HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
- if (!cell.is_null()) { |
- ASSERT(cell->value() == *function); |
- GenerateLoadFunctionFromCell(cell, function, &miss); |
- } |
- |
- // Load the (only) argument into eax. |
- __ mov(eax, Operand(esp, 1 * kPointerSize)); |
- |
- // Check if the argument is a smi. |
- Label smi; |
- STATIC_ASSERT(kSmiTag == 0); |
- __ JumpIfSmi(eax, &smi); |
- |
- // Check if the argument is a heap number and load its value into xmm0. |
- Label slow; |
- __ CheckMap(eax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
- __ movsd(xmm0, FieldOperand(eax, HeapNumber::kValueOffset)); |
- |
- // Check if the argument is strictly positive. Note this also |
- // discards NaN. |
- __ xorpd(xmm1, xmm1); |
- __ ucomisd(xmm0, xmm1); |
- __ j(below_equal, &slow); |
- |
- // Do a truncating conversion. |
- __ cvttsd2si(eax, Operand(xmm0)); |
- |
- // Check if the result fits into a smi. Note this also checks for |
- // 0x80000000 which signals a failed conversion. |
- Label wont_fit_into_smi; |
- __ test(eax, Immediate(0xc0000000)); |
- __ j(not_zero, &wont_fit_into_smi); |
- |
- // Smi tag and return. |
- __ SmiTag(eax); |
- __ bind(&smi); |
- __ ret(2 * kPointerSize); |
- |
- // Check if the argument is < 2^kMantissaBits. |
- Label already_round; |
- __ bind(&wont_fit_into_smi); |
- __ LoadPowerOf2(xmm1, ebx, HeapNumber::kMantissaBits); |
- __ ucomisd(xmm0, xmm1); |
- __ j(above_equal, &already_round); |
- |
- // Save a copy of the argument. |
- __ movaps(xmm2, xmm0); |
- |
- // Compute (argument + 2^kMantissaBits) - 2^kMantissaBits. |
- __ addsd(xmm0, xmm1); |
- __ subsd(xmm0, xmm1); |
- |
- // Compare the argument and the tentative result to get the right mask: |
- // if xmm2 < xmm0: |
- // xmm2 = 1...1 |
- // else: |
- // xmm2 = 0...0 |
- __ cmpltsd(xmm2, xmm0); |
- |
- // Subtract 1 if the argument was less than the tentative result. |
- __ LoadPowerOf2(xmm1, ebx, 0); |
- __ andpd(xmm1, xmm2); |
- __ subsd(xmm0, xmm1); |
- |
- // Return a new heap number. |
- __ AllocateHeapNumber(eax, ebx, edx, &slow); |
- __ movsd(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); |
- __ ret(2 * kPointerSize); |
- |
- // Return the argument (when it's an already round heap number). |
- __ bind(&already_round); |
- __ mov(eax, Operand(esp, 1 * kPointerSize)); |
- __ ret(2 * kPointerSize); |
- |
- __ bind(&slow); |
- // We do not have to patch the receiver because the function makes no use of |
- // it. |
- GenerateJumpFunctionIgnoreReceiver(function); |
- |
- HandlerFrontendFooter(&miss); |
- |
- // Return the generated code. |
- return GetCode(type, name); |
-} |
- |
- |
-Handle<Code> CallStubCompiler::CompileMathAbsCall( |
- Handle<Object> object, |
- Handle<JSObject> holder, |
- Handle<Cell> cell, |
- Handle<JSFunction> function, |
- Handle<String> name, |
- Code::StubType type) { |
- const int argc = arguments().immediate(); |
- |
- // If the object is not a JSObject or we got an unexpected number of |
- // arguments, bail out to the regular call. |
- if (!object->IsJSObject() || argc != 1) { |
- return Handle<Code>::null(); |
- } |
- |
- Label miss; |
- |
- HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
- if (!cell.is_null()) { |
- ASSERT(cell->value() == *function); |
- GenerateLoadFunctionFromCell(cell, function, &miss); |
- } |
- |
- // Load the (only) argument into eax. |
- __ mov(eax, Operand(esp, 1 * kPointerSize)); |
- |
- // Check if the argument is a smi. |
- Label not_smi; |
- STATIC_ASSERT(kSmiTag == 0); |
- __ JumpIfNotSmi(eax, ¬_smi); |
- |
- // Branchless abs implementation, refer to below: |
- // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs |
- // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 |
- // otherwise. |
- __ mov(ebx, eax); |
- __ sar(ebx, kBitsPerInt - 1); |
- |
- // Do bitwise not or do nothing depending on ebx. |
- __ xor_(eax, ebx); |
- |
- // Add 1 or do nothing depending on ebx. |
- __ sub(eax, ebx); |
- |
- // If the result is still negative, go to the slow case. |
- // This only happens for the most negative smi. |
- Label slow; |
- __ j(negative, &slow); |
- |
- // Smi case done. |
- __ ret(2 * kPointerSize); |
- |
- // Check if the argument is a heap number and load its exponent and |
- // sign into ebx. |
- __ bind(¬_smi); |
- __ CheckMap(eax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
- __ mov(ebx, FieldOperand(eax, HeapNumber::kExponentOffset)); |
- |
- // Check the sign of the argument. If the argument is positive, |
- // just return it. |
- Label negative_sign; |
- __ test(ebx, Immediate(HeapNumber::kSignMask)); |
- __ j(not_zero, &negative_sign); |
- __ ret(2 * kPointerSize); |
- |
- // If the argument is negative, clear the sign, and return a new |
- // number. |
- __ bind(&negative_sign); |
- __ and_(ebx, ~HeapNumber::kSignMask); |
- __ mov(ecx, FieldOperand(eax, HeapNumber::kMantissaOffset)); |
- __ AllocateHeapNumber(eax, edi, edx, &slow); |
- __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ebx); |
- __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx); |
- __ ret(2 * kPointerSize); |
- |
- __ bind(&slow); |
- // We do not have to patch the receiver because the function makes no use of |
- // it. |
- GenerateJumpFunctionIgnoreReceiver(function); |
- |
- HandlerFrontendFooter(&miss); |
- |
- // Return the generated code. |
- return GetCode(type, name); |
-} |
- |
- |
Handle<Code> CallStubCompiler::CompileFastApiCall( |
const CallOptimization& optimization, |
Handle<Object> object, |