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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 GenerateSmiStub(masm); | 1046 GenerateSmiStub(masm); |
1047 break; | 1047 break; |
1048 case TRBinaryOpIC::INT32: | 1048 case TRBinaryOpIC::INT32: |
1049 UNREACHABLE(); | 1049 UNREACHABLE(); |
1050 // The int32 case is identical to the Smi case. We avoid creating this | 1050 // The int32 case is identical to the Smi case. We avoid creating this |
1051 // ic state on x64. | 1051 // ic state on x64. |
1052 break; | 1052 break; |
1053 case TRBinaryOpIC::HEAP_NUMBER: | 1053 case TRBinaryOpIC::HEAP_NUMBER: |
1054 GenerateHeapNumberStub(masm); | 1054 GenerateHeapNumberStub(masm); |
1055 break; | 1055 break; |
| 1056 case TRBinaryOpIC::ODDBALL: |
| 1057 GenerateOddballStub(masm); |
| 1058 break; |
1056 case TRBinaryOpIC::STRING: | 1059 case TRBinaryOpIC::STRING: |
1057 GenerateStringStub(masm); | 1060 GenerateStringStub(masm); |
1058 break; | 1061 break; |
1059 case TRBinaryOpIC::GENERIC: | 1062 case TRBinaryOpIC::GENERIC: |
1060 GenerateGeneric(masm); | 1063 GenerateGeneric(masm); |
1061 break; | 1064 break; |
1062 default: | 1065 default: |
1063 UNREACHABLE(); | 1066 UNREACHABLE(); |
1064 } | 1067 } |
1065 } | 1068 } |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) { | 1424 void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) { |
1422 ASSERT(operands_type_ == TRBinaryOpIC::STRING); | 1425 ASSERT(operands_type_ == TRBinaryOpIC::STRING); |
1423 ASSERT(op_ == Token::ADD); | 1426 ASSERT(op_ == Token::ADD); |
1424 GenerateStringAddCode(masm); | 1427 GenerateStringAddCode(masm); |
1425 // Try to add arguments as strings, otherwise, transition to the generic | 1428 // Try to add arguments as strings, otherwise, transition to the generic |
1426 // TRBinaryOpIC type. | 1429 // TRBinaryOpIC type. |
1427 GenerateTypeTransition(masm); | 1430 GenerateTypeTransition(masm); |
1428 } | 1431 } |
1429 | 1432 |
1430 | 1433 |
| 1434 void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { |
| 1435 Label call_runtime; |
| 1436 |
| 1437 if (op_ == Token::ADD) { |
| 1438 // Handle string addition here, because it is the only operation |
| 1439 // that does not do a ToNumber conversion on the operands. |
| 1440 GenerateStringAddCode(masm); |
| 1441 } |
| 1442 |
| 1443 // Convert oddball arguments to numbers. |
| 1444 NearLabel check, done; |
| 1445 __ CompareRoot(rdx, Heap::kUndefinedValueRootIndex); |
| 1446 __ j(not_equal, &check); |
| 1447 if (Token::IsBitOp(op_)) { |
| 1448 __ xor_(rdx, rdx); |
| 1449 } else { |
| 1450 __ LoadRoot(rdx, Heap::kNanValueRootIndex); |
| 1451 } |
| 1452 __ jmp(&done); |
| 1453 __ bind(&check); |
| 1454 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
| 1455 __ j(not_equal, &done); |
| 1456 if (Token::IsBitOp(op_)) { |
| 1457 __ xor_(rax, rax); |
| 1458 } else { |
| 1459 __ LoadRoot(rax, Heap::kNanValueRootIndex); |
| 1460 } |
| 1461 __ bind(&done); |
| 1462 |
| 1463 GenerateHeapNumberStub(masm); |
| 1464 } |
| 1465 |
| 1466 |
1431 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { | 1467 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { |
1432 Label gc_required, not_number; | 1468 Label gc_required, not_number; |
1433 GenerateFloatingPointCode(masm, &gc_required, ¬_number); | 1469 GenerateFloatingPointCode(masm, &gc_required, ¬_number); |
1434 | 1470 |
1435 __ bind(¬_number); | 1471 __ bind(¬_number); |
1436 GenerateTypeTransition(masm); | 1472 GenerateTypeTransition(masm); |
1437 | 1473 |
1438 __ bind(&gc_required); | 1474 __ bind(&gc_required); |
1439 GenerateCallRuntimeCode(masm); | 1475 GenerateCallRuntimeCode(masm); |
1440 } | 1476 } |
(...skipping 3700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5141 FieldOperand(elements, PixelArray::kExternalPointerOffset)); | 5177 FieldOperand(elements, PixelArray::kExternalPointerOffset)); |
5142 __ movb(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); | 5178 __ movb(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); |
5143 __ ret(0); // Return value in eax. | 5179 __ ret(0); // Return value in eax. |
5144 } | 5180 } |
5145 | 5181 |
5146 #undef __ | 5182 #undef __ |
5147 | 5183 |
5148 } } // namespace v8::internal | 5184 } } // namespace v8::internal |
5149 | 5185 |
5150 #endif // V8_TARGET_ARCH_X64 | 5186 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |