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 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 break; | 1352 break; |
1353 case TRBinaryOpIC::SMI: | 1353 case TRBinaryOpIC::SMI: |
1354 GenerateSmiStub(masm); | 1354 GenerateSmiStub(masm); |
1355 break; | 1355 break; |
1356 case TRBinaryOpIC::INT32: | 1356 case TRBinaryOpIC::INT32: |
1357 GenerateInt32Stub(masm); | 1357 GenerateInt32Stub(masm); |
1358 break; | 1358 break; |
1359 case TRBinaryOpIC::HEAP_NUMBER: | 1359 case TRBinaryOpIC::HEAP_NUMBER: |
1360 GenerateHeapNumberStub(masm); | 1360 GenerateHeapNumberStub(masm); |
1361 break; | 1361 break; |
| 1362 case TRBinaryOpIC::ODDBALL: |
| 1363 GenerateOddballStub(masm); |
| 1364 break; |
1362 case TRBinaryOpIC::STRING: | 1365 case TRBinaryOpIC::STRING: |
1363 GenerateStringStub(masm); | 1366 GenerateStringStub(masm); |
1364 break; | 1367 break; |
1365 case TRBinaryOpIC::GENERIC: | 1368 case TRBinaryOpIC::GENERIC: |
1366 GenerateGeneric(masm); | 1369 GenerateGeneric(masm); |
1367 break; | 1370 break; |
1368 default: | 1371 default: |
1369 UNREACHABLE(); | 1372 UNREACHABLE(); |
1370 } | 1373 } |
1371 } | 1374 } |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 break; | 2020 break; |
2018 case Token::SHR: | 2021 case Token::SHR: |
2019 __ InvokeBuiltin(Builtins::SHR, JUMP_FUNCTION); | 2022 __ InvokeBuiltin(Builtins::SHR, JUMP_FUNCTION); |
2020 break; | 2023 break; |
2021 default: | 2024 default: |
2022 UNREACHABLE(); | 2025 UNREACHABLE(); |
2023 } | 2026 } |
2024 } | 2027 } |
2025 | 2028 |
2026 | 2029 |
| 2030 void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { |
| 2031 Label call_runtime; |
| 2032 |
| 2033 if (op_ == Token::ADD) { |
| 2034 // Handle string addition here, because it is the only operation |
| 2035 // that does not do a ToNumber conversion on the operands. |
| 2036 GenerateAddStrings(masm); |
| 2037 } |
| 2038 |
| 2039 // Convert odd ball arguments to numbers. |
| 2040 NearLabel check, done; |
| 2041 __ cmp(edx, FACTORY->undefined_value()); |
| 2042 __ j(not_equal, &check); |
| 2043 if (Token::IsBitOp(op_)) { |
| 2044 __ xor_(edx, Operand(edx)); |
| 2045 } else { |
| 2046 __ mov(edx, Immediate(FACTORY->nan_value())); |
| 2047 } |
| 2048 __ jmp(&done); |
| 2049 __ bind(&check); |
| 2050 __ cmp(eax, FACTORY->undefined_value()); |
| 2051 __ j(not_equal, &done); |
| 2052 if (Token::IsBitOp(op_)) { |
| 2053 __ xor_(eax, Operand(eax)); |
| 2054 } else { |
| 2055 __ mov(eax, Immediate(FACTORY->nan_value())); |
| 2056 } |
| 2057 __ bind(&done); |
| 2058 |
| 2059 GenerateHeapNumberStub(masm); |
| 2060 } |
| 2061 |
| 2062 |
2027 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { | 2063 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { |
2028 Label call_runtime; | 2064 Label call_runtime; |
2029 ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER); | |
2030 | 2065 |
2031 // Floating point case. | 2066 // Floating point case. |
2032 switch (op_) { | 2067 switch (op_) { |
2033 case Token::ADD: | 2068 case Token::ADD: |
2034 case Token::SUB: | 2069 case Token::SUB: |
2035 case Token::MUL: | 2070 case Token::MUL: |
2036 case Token::DIV: { | 2071 case Token::DIV: { |
2037 Label not_floats; | 2072 Label not_floats; |
2038 if (masm->isolate()->cpu_features()->IsSupported(SSE2)) { | 2073 if (masm->isolate()->cpu_features()->IsSupported(SSE2)) { |
2039 CpuFeatures::Scope use_sse2(SSE2); | 2074 CpuFeatures::Scope use_sse2(SSE2); |
(...skipping 4467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6507 // Do a tail call to the rewritten stub. | 6542 // Do a tail call to the rewritten stub. |
6508 __ jmp(Operand(edi)); | 6543 __ jmp(Operand(edi)); |
6509 } | 6544 } |
6510 | 6545 |
6511 | 6546 |
6512 #undef __ | 6547 #undef __ |
6513 | 6548 |
6514 } } // namespace v8::internal | 6549 } } // namespace v8::internal |
6515 | 6550 |
6516 #endif // V8_TARGET_ARCH_IA32 | 6551 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |