Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2022 if (allow_heapnumber_results == BinaryOpStub::ALLOW_HEAPNUMBER_RESULTS) { | 2022 if (allow_heapnumber_results == BinaryOpStub::ALLOW_HEAPNUMBER_RESULTS) { |
| 2023 BinaryOpStub_GenerateFPOperation( | 2023 BinaryOpStub_GenerateFPOperation( |
| 2024 masm, BinaryOpIC::UNINITIALIZED, BinaryOpIC::UNINITIALIZED, true, | 2024 masm, BinaryOpIC::UNINITIALIZED, BinaryOpIC::UNINITIALIZED, true, |
| 2025 use_runtime, gc_required, ¬_smis, op, mode); | 2025 use_runtime, gc_required, ¬_smis, op, mode); |
| 2026 } | 2026 } |
| 2027 __ bind(¬_smis); | 2027 __ bind(¬_smis); |
| 2028 } | 2028 } |
| 2029 | 2029 |
| 2030 | 2030 |
| 2031 void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { | 2031 void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { |
| 2032 Label not_smis, call_runtime; | 2032 Label right_arg_changed, call_runtime; |
| 2033 | |
| 2034 if (op_ == Token::MOD && has_fixed_right_arg_) { | |
| 2035 // It is guaranteed that the value will fit into a Smi, because if it | |
| 2036 // didn't, we wouldn't be here, see BinaryOp_Patch. | |
| 2037 __ cmp(r0, Operand(Smi::FromInt(fixed_right_arg_value()))); | |
| 2038 __ b(ne, &right_arg_changed); | |
| 2039 } | |
| 2033 | 2040 |
| 2034 if (result_type_ == BinaryOpIC::UNINITIALIZED || | 2041 if (result_type_ == BinaryOpIC::UNINITIALIZED || |
| 2035 result_type_ == BinaryOpIC::SMI) { | 2042 result_type_ == BinaryOpIC::SMI) { |
| 2036 // Only allow smi results. | 2043 // Only allow smi results. |
| 2037 BinaryOpStub_GenerateSmiCode( | 2044 BinaryOpStub_GenerateSmiCode( |
| 2038 masm, &call_runtime, NULL, op_, NO_HEAPNUMBER_RESULTS, mode_); | 2045 masm, &call_runtime, NULL, op_, NO_HEAPNUMBER_RESULTS, mode_); |
| 2039 } else { | 2046 } else { |
| 2040 // Allow heap number result and don't make a transition if a heap number | 2047 // Allow heap number result and don't make a transition if a heap number |
| 2041 // cannot be allocated. | 2048 // cannot be allocated. |
| 2042 BinaryOpStub_GenerateSmiCode( | 2049 BinaryOpStub_GenerateSmiCode( |
| 2043 masm, &call_runtime, &call_runtime, op_, ALLOW_HEAPNUMBER_RESULTS, | 2050 masm, &call_runtime, &call_runtime, op_, ALLOW_HEAPNUMBER_RESULTS, |
| 2044 mode_); | 2051 mode_); |
| 2045 } | 2052 } |
| 2046 | 2053 |
| 2047 // Code falls through if the result is not returned as either a smi or heap | 2054 // Code falls through if the result is not returned as either a smi or heap |
| 2048 // number. | 2055 // number. |
| 2056 __ bind(&right_arg_changed); | |
| 2049 GenerateTypeTransition(masm); | 2057 GenerateTypeTransition(masm); |
| 2050 | 2058 |
| 2051 __ bind(&call_runtime); | 2059 __ bind(&call_runtime); |
| 2052 { | 2060 { |
| 2053 FrameScope scope(masm, StackFrame::INTERNAL); | 2061 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2054 GenerateRegisterArgsPush(masm); | 2062 GenerateRegisterArgsPush(masm); |
| 2055 GenerateCallRuntime(masm); | 2063 GenerateCallRuntime(masm); |
| 2056 } | 2064 } |
| 2057 __ Ret(); | 2065 __ Ret(); |
| 2058 } | 2066 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2210 mode_); | 2218 mode_); |
| 2211 __ sub(r0, heap_number_result, Operand(kHeapObjectTag)); | 2219 __ sub(r0, heap_number_result, Operand(kHeapObjectTag)); |
| 2212 __ vstr(d5, r0, HeapNumber::kValueOffset); | 2220 __ vstr(d5, r0, HeapNumber::kValueOffset); |
| 2213 __ mov(r0, heap_number_result); | 2221 __ mov(r0, heap_number_result); |
| 2214 __ Ret(); | 2222 __ Ret(); |
| 2215 | 2223 |
| 2216 // A DIV operation expecting an integer result falls through | 2224 // A DIV operation expecting an integer result falls through |
| 2217 // to type transition. | 2225 // to type transition. |
| 2218 | 2226 |
| 2219 } else { | 2227 } else { |
| 2228 if (has_fixed_right_arg_) { | |
| 2229 __ Vmov(d8, fixed_right_arg_value(), scratch1); | |
| 2230 __ VFPCompareAndSetFlags(d1, d8); | |
|
Rodolph Perfetta
2013/06/03 16:33:17
Wouldn't it be possible to compare to the already
Sven Panne
2013/06/04 07:48:09
Hmmm, unless I misunderstood things, 'right' doesn
| |
| 2231 __ b(ne, &transition); | |
| 2232 } | |
| 2233 | |
| 2220 // We preserved r0 and r1 to be able to call runtime. | 2234 // We preserved r0 and r1 to be able to call runtime. |
| 2221 // Save the left value on the stack. | 2235 // Save the left value on the stack. |
| 2222 __ Push(r5, r4); | 2236 __ Push(r5, r4); |
| 2223 | 2237 |
| 2224 Label pop_and_call_runtime; | 2238 Label pop_and_call_runtime; |
| 2225 | 2239 |
| 2226 // Allocate a heap number to store the result. | 2240 // Allocate a heap number to store the result. |
| 2227 heap_number_result = r5; | 2241 heap_number_result = r5; |
| 2228 BinaryOpStub_GenerateHeapResultAllocation(masm, | 2242 BinaryOpStub_GenerateHeapResultAllocation(masm, |
| 2229 heap_number_result, | 2243 heap_number_result, |
| (...skipping 5103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7333 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 7347 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 7334 } | 7348 } |
| 7335 } | 7349 } |
| 7336 | 7350 |
| 7337 | 7351 |
| 7338 #undef __ | 7352 #undef __ |
| 7339 | 7353 |
| 7340 } } // namespace v8::internal | 7354 } } // namespace v8::internal |
| 7341 | 7355 |
| 7342 #endif // V8_TARGET_ARCH_ARM | 7356 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |