OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 break; | 1335 break; |
1336 case TRBinaryOpIC::SMI: | 1336 case TRBinaryOpIC::SMI: |
1337 GenerateSmiStub(masm); | 1337 GenerateSmiStub(masm); |
1338 break; | 1338 break; |
1339 case TRBinaryOpIC::INT32: | 1339 case TRBinaryOpIC::INT32: |
1340 GenerateInt32Stub(masm); | 1340 GenerateInt32Stub(masm); |
1341 break; | 1341 break; |
1342 case TRBinaryOpIC::HEAP_NUMBER: | 1342 case TRBinaryOpIC::HEAP_NUMBER: |
1343 GenerateHeapNumberStub(masm); | 1343 GenerateHeapNumberStub(masm); |
1344 break; | 1344 break; |
| 1345 case TRBinaryOpIC::ODDBALL: |
| 1346 GenerateOddballStub(masm); |
| 1347 break; |
1345 case TRBinaryOpIC::STRING: | 1348 case TRBinaryOpIC::STRING: |
1346 GenerateStringStub(masm); | 1349 GenerateStringStub(masm); |
1347 break; | 1350 break; |
1348 case TRBinaryOpIC::GENERIC: | 1351 case TRBinaryOpIC::GENERIC: |
1349 GenerateGeneric(masm); | 1352 GenerateGeneric(masm); |
1350 break; | 1353 break; |
1351 default: | 1354 default: |
1352 UNREACHABLE(); | 1355 UNREACHABLE(); |
1353 } | 1356 } |
1354 } | 1357 } |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 break; | 2002 break; |
2000 case Token::SHR: | 2003 case Token::SHR: |
2001 __ InvokeBuiltin(Builtins::SHR, JUMP_FUNCTION); | 2004 __ InvokeBuiltin(Builtins::SHR, JUMP_FUNCTION); |
2002 break; | 2005 break; |
2003 default: | 2006 default: |
2004 UNREACHABLE(); | 2007 UNREACHABLE(); |
2005 } | 2008 } |
2006 } | 2009 } |
2007 | 2010 |
2008 | 2011 |
| 2012 void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { |
| 2013 Label call_runtime; |
| 2014 |
| 2015 if (op_ == Token::ADD) { |
| 2016 // Handle string addition here, because it is the only operation |
| 2017 // that does not do a ToNumber conversion on the operands. |
| 2018 GenerateAddStrings(masm); |
| 2019 } |
| 2020 |
| 2021 // Convert odd ball arguments to numbers. |
| 2022 NearLabel check, done; |
| 2023 __ cmp(edx, Factory::undefined_value()); |
| 2024 __ j(not_equal, &check); |
| 2025 if (Token::IsBitOp(op_)) { |
| 2026 __ xor_(edx, Operand(edx)); |
| 2027 } else { |
| 2028 __ mov(edx, Immediate(Factory::nan_value())); |
| 2029 } |
| 2030 __ jmp(&done); |
| 2031 __ bind(&check); |
| 2032 __ cmp(eax, Factory::undefined_value()); |
| 2033 __ j(not_equal, &done); |
| 2034 if (Token::IsBitOp(op_)) { |
| 2035 __ xor_(eax, Operand(eax)); |
| 2036 } else { |
| 2037 __ mov(eax, Immediate(Factory::nan_value())); |
| 2038 } |
| 2039 __ bind(&done); |
| 2040 |
| 2041 GenerateHeapNumberStub(masm); |
| 2042 } |
| 2043 |
| 2044 |
2009 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { | 2045 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { |
2010 Label call_runtime; | 2046 Label call_runtime; |
2011 ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER); | |
2012 | 2047 |
2013 // Floating point case. | 2048 // Floating point case. |
2014 switch (op_) { | 2049 switch (op_) { |
2015 case Token::ADD: | 2050 case Token::ADD: |
2016 case Token::SUB: | 2051 case Token::SUB: |
2017 case Token::MUL: | 2052 case Token::MUL: |
2018 case Token::DIV: { | 2053 case Token::DIV: { |
2019 Label not_floats; | 2054 Label not_floats; |
2020 if (CpuFeatures::IsSupported(SSE2)) { | 2055 if (CpuFeatures::IsSupported(SSE2)) { |
2021 CpuFeatures::Scope use_sse2(SSE2); | 2056 CpuFeatures::Scope use_sse2(SSE2); |
(...skipping 4593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6615 __ mov_b(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); | 6650 __ mov_b(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); |
6616 __ ret(0); // Return value in eax. | 6651 __ ret(0); // Return value in eax. |
6617 } | 6652 } |
6618 | 6653 |
6619 | 6654 |
6620 #undef __ | 6655 #undef __ |
6621 | 6656 |
6622 } } // namespace v8::internal | 6657 } } // namespace v8::internal |
6623 | 6658 |
6624 #endif // V8_TARGET_ARCH_IA32 | 6659 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |