| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 UNREACHABLE(); | 365 UNREACHABLE(); |
| 366 // The int32 case is identical to the Smi case. We avoid creating this | 366 // The int32 case is identical to the Smi case. We avoid creating this |
| 367 // ic state on x64. | 367 // ic state on x64. |
| 368 break; | 368 break; |
| 369 case TRBinaryOpIC::HEAP_NUMBER: | 369 case TRBinaryOpIC::HEAP_NUMBER: |
| 370 GenerateHeapNumberStub(masm); | 370 GenerateHeapNumberStub(masm); |
| 371 break; | 371 break; |
| 372 case TRBinaryOpIC::ODDBALL: | 372 case TRBinaryOpIC::ODDBALL: |
| 373 GenerateOddballStub(masm); | 373 GenerateOddballStub(masm); |
| 374 break; | 374 break; |
| 375 case TRBinaryOpIC::BOTH_STRING: |
| 376 GenerateBothStringStub(masm); |
| 377 break; |
| 375 case TRBinaryOpIC::STRING: | 378 case TRBinaryOpIC::STRING: |
| 376 GenerateStringStub(masm); | 379 GenerateStringStub(masm); |
| 377 break; | 380 break; |
| 378 case TRBinaryOpIC::GENERIC: | 381 case TRBinaryOpIC::GENERIC: |
| 379 GenerateGeneric(masm); | 382 GenerateGeneric(masm); |
| 380 break; | 383 break; |
| 381 default: | 384 default: |
| 382 UNREACHABLE(); | 385 UNREACHABLE(); |
| 383 } | 386 } |
| 384 } | 387 } |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) { | 767 void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) { |
| 765 ASSERT(operands_type_ == TRBinaryOpIC::STRING); | 768 ASSERT(operands_type_ == TRBinaryOpIC::STRING); |
| 766 ASSERT(op_ == Token::ADD); | 769 ASSERT(op_ == Token::ADD); |
| 767 GenerateStringAddCode(masm); | 770 GenerateStringAddCode(masm); |
| 768 // Try to add arguments as strings, otherwise, transition to the generic | 771 // Try to add arguments as strings, otherwise, transition to the generic |
| 769 // TRBinaryOpIC type. | 772 // TRBinaryOpIC type. |
| 770 GenerateTypeTransition(masm); | 773 GenerateTypeTransition(masm); |
| 771 } | 774 } |
| 772 | 775 |
| 773 | 776 |
| 777 void TypeRecordingBinaryOpStub::GenerateBothStringStub(MacroAssembler* masm) { |
| 778 Label call_runtime; |
| 779 ASSERT(operands_type_ == TRBinaryOpIC::BOTH_STRING); |
| 780 ASSERT(op_ == Token::ADD); |
| 781 // If both arguments are strings, call the string add stub. |
| 782 // Otherwise, do a transition. |
| 783 |
| 784 // Registers containing left and right operands respectively. |
| 785 Register left = rdx; |
| 786 Register right = rax; |
| 787 |
| 788 // Test if left operand is a string. |
| 789 __ JumpIfSmi(left, &call_runtime); |
| 790 __ CmpObjectType(left, FIRST_NONSTRING_TYPE, rcx); |
| 791 __ j(above_equal, &call_runtime); |
| 792 |
| 793 // Test if right operand is a string. |
| 794 __ JumpIfSmi(right, &call_runtime); |
| 795 __ CmpObjectType(right, FIRST_NONSTRING_TYPE, rcx); |
| 796 __ j(above_equal, &call_runtime); |
| 797 |
| 798 StringAddStub string_add_stub(NO_STRING_CHECK_IN_STUB); |
| 799 GenerateRegisterArgsPush(masm); |
| 800 __ TailCallStub(&string_add_stub); |
| 801 |
| 802 __ bind(&call_runtime); |
| 803 GenerateTypeTransition(masm); |
| 804 } |
| 805 |
| 806 |
| 774 void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { | 807 void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { |
| 775 Label call_runtime; | 808 Label call_runtime; |
| 776 | 809 |
| 777 if (op_ == Token::ADD) { | 810 if (op_ == Token::ADD) { |
| 778 // Handle string addition here, because it is the only operation | 811 // Handle string addition here, because it is the only operation |
| 779 // that does not do a ToNumber conversion on the operands. | 812 // that does not do a ToNumber conversion on the operands. |
| 780 GenerateStringAddCode(masm); | 813 GenerateStringAddCode(masm); |
| 781 } | 814 } |
| 782 | 815 |
| 783 // Convert oddball arguments to numbers. | 816 // Convert oddball arguments to numbers. |
| (...skipping 3727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4511 // Do a tail call to the rewritten stub. | 4544 // Do a tail call to the rewritten stub. |
| 4512 __ jmp(rdi); | 4545 __ jmp(rdi); |
| 4513 } | 4546 } |
| 4514 | 4547 |
| 4515 | 4548 |
| 4516 #undef __ | 4549 #undef __ |
| 4517 | 4550 |
| 4518 } } // namespace v8::internal | 4551 } } // namespace v8::internal |
| 4519 | 4552 |
| 4520 #endif // V8_TARGET_ARCH_X64 | 4553 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |