Chromium Code Reviews| 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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1347 break; | 1347 break; |
| 1348 case TRBinaryOpIC::SMI: | 1348 case TRBinaryOpIC::SMI: |
| 1349 GenerateSmiStub(masm); | 1349 GenerateSmiStub(masm); |
| 1350 break; | 1350 break; |
| 1351 case TRBinaryOpIC::INT32: | 1351 case TRBinaryOpIC::INT32: |
| 1352 GenerateInt32Stub(masm); | 1352 GenerateInt32Stub(masm); |
| 1353 break; | 1353 break; |
| 1354 case TRBinaryOpIC::HEAP_NUMBER: | 1354 case TRBinaryOpIC::HEAP_NUMBER: |
| 1355 GenerateHeapNumberStub(masm); | 1355 GenerateHeapNumberStub(masm); |
| 1356 break; | 1356 break; |
| 1357 case TRBinaryOpIC::ODDBALL: | |
| 1358 GenerateOddballStub(masm); | |
| 1359 break; | |
| 1357 case TRBinaryOpIC::STRING: | 1360 case TRBinaryOpIC::STRING: |
| 1358 GenerateStringStub(masm); | 1361 GenerateStringStub(masm); |
| 1359 break; | 1362 break; |
| 1360 case TRBinaryOpIC::GENERIC: | 1363 case TRBinaryOpIC::GENERIC: |
| 1361 GenerateGeneric(masm); | 1364 GenerateGeneric(masm); |
| 1362 break; | 1365 break; |
| 1363 default: | 1366 default: |
| 1364 UNREACHABLE(); | 1367 UNREACHABLE(); |
| 1365 } | 1368 } |
| 1366 } | 1369 } |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2012 break; | 2015 break; |
| 2013 case Token::SHR: | 2016 case Token::SHR: |
| 2014 __ InvokeBuiltin(Builtins::SHR, JUMP_FUNCTION); | 2017 __ InvokeBuiltin(Builtins::SHR, JUMP_FUNCTION); |
| 2015 break; | 2018 break; |
| 2016 default: | 2019 default: |
| 2017 UNREACHABLE(); | 2020 UNREACHABLE(); |
| 2018 } | 2021 } |
| 2019 } | 2022 } |
| 2020 | 2023 |
| 2021 | 2024 |
| 2025 void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { | |
| 2026 Label call_runtime; | |
| 2027 | |
| 2028 if (op_ == Token::ADD) { | |
| 2029 GenerateAddStrings(masm); | |
|
Erik Corry
2011/03/25 14:21:18
Please add comment that we need this because add i
fschneider
2011/03/28 08:00:54
Done.
| |
| 2030 } | |
| 2031 | |
| 2032 // Convert odd ball arguments to numbers. | |
| 2033 NearLabel check, done; | |
| 2034 __ cmp(edx, FACTORY->undefined_value()); | |
| 2035 __ j(not_equal, &check); | |
| 2036 if (Token::IsBitOp(op_)) { | |
| 2037 __ xor_(edx, Operand(edx)); | |
| 2038 } else { | |
| 2039 __ mov(edx, Immediate(FACTORY->nan_value())); | |
| 2040 } | |
| 2041 __ jmp(&done); | |
| 2042 __ bind(&check); | |
| 2043 __ cmp(eax, FACTORY->undefined_value()); | |
| 2044 __ j(not_equal, &done); | |
| 2045 if (Token::IsBitOp(op_)) { | |
| 2046 __ xor_(eax, Operand(eax)); | |
| 2047 } else { | |
| 2048 __ mov(eax, Immediate(FACTORY->nan_value())); | |
| 2049 } | |
| 2050 __ bind(&done); | |
| 2051 | |
| 2052 GenerateHeapNumberStub(masm); | |
| 2053 } | |
| 2054 | |
| 2055 | |
| 2022 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { | 2056 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { |
| 2023 Label call_runtime; | 2057 Label call_runtime; |
| 2024 ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER); | |
| 2025 | 2058 |
| 2026 // Floating point case. | 2059 // Floating point case. |
| 2027 switch (op_) { | 2060 switch (op_) { |
| 2028 case Token::ADD: | 2061 case Token::ADD: |
| 2029 case Token::SUB: | 2062 case Token::SUB: |
| 2030 case Token::MUL: | 2063 case Token::MUL: |
| 2031 case Token::DIV: { | 2064 case Token::DIV: { |
| 2032 Label not_floats; | 2065 Label not_floats; |
| 2033 if (masm->isolate()->cpu_features()->IsSupported(SSE2)) { | 2066 if (masm->isolate()->cpu_features()->IsSupported(SSE2)) { |
| 2034 CpuFeatures::Scope use_sse2(SSE2); | 2067 CpuFeatures::Scope use_sse2(SSE2); |
| (...skipping 4454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6489 // Do a tail call to the rewritten stub. | 6522 // Do a tail call to the rewritten stub. |
| 6490 __ jmp(Operand(edi)); | 6523 __ jmp(Operand(edi)); |
| 6491 } | 6524 } |
| 6492 | 6525 |
| 6493 | 6526 |
| 6494 #undef __ | 6527 #undef __ |
| 6495 | 6528 |
| 6496 } } // namespace v8::internal | 6529 } } // namespace v8::internal |
| 6497 | 6530 |
| 6498 #endif // V8_TARGET_ARCH_IA32 | 6531 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |