| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 // Check that both operands are smis using the answer register as a | 1361 // Check that both operands are smis using the answer register as a |
| 1362 // temporary. | 1362 // temporary. |
| 1363 DeferredInlineBinaryOperation* deferred = | 1363 DeferredInlineBinaryOperation* deferred = |
| 1364 new DeferredInlineBinaryOperation(op, | 1364 new DeferredInlineBinaryOperation(op, |
| 1365 answer.reg(), | 1365 answer.reg(), |
| 1366 left->reg(), | 1366 left->reg(), |
| 1367 rcx, | 1367 rcx, |
| 1368 overwrite_mode); | 1368 overwrite_mode); |
| 1369 | 1369 |
| 1370 Label do_op; | 1370 Label do_op; |
| 1371 // Left operand must be unchanged in left->reg() for deferred code. |
| 1372 // Left operand is in answer.reg(), possibly converted to int32, for |
| 1373 // inline code. |
| 1374 __ movq(answer.reg(), left->reg()); |
| 1371 if (right_type_info.IsSmi()) { | 1375 if (right_type_info.IsSmi()) { |
| 1372 if (FLAG_debug_code) { | 1376 if (FLAG_debug_code) { |
| 1373 __ AbortIfNotSmi(right->reg()); | 1377 __ AbortIfNotSmi(right->reg()); |
| 1374 } | 1378 } |
| 1375 __ movq(answer.reg(), left->reg()); | |
| 1376 // If left is not known to be a smi, check if it is. | 1379 // If left is not known to be a smi, check if it is. |
| 1377 // If left is not known to be a number, and it isn't a smi, check if | 1380 // If left is not known to be a number, and it isn't a smi, check if |
| 1378 // it is a HeapNumber. | 1381 // it is a HeapNumber. |
| 1379 if (!left_type_info.IsSmi()) { | 1382 if (!left_type_info.IsSmi()) { |
| 1380 __ JumpIfSmi(answer.reg(), &do_op); | 1383 __ JumpIfSmi(answer.reg(), &do_op); |
| 1381 if (!left_type_info.IsNumber()) { | 1384 if (!left_type_info.IsNumber()) { |
| 1382 // Branch if not a heapnumber. | 1385 // Branch if not a heapnumber. |
| 1383 __ Cmp(FieldOperand(answer.reg(), HeapObject::kMapOffset), | 1386 __ Cmp(FieldOperand(answer.reg(), HeapObject::kMapOffset), |
| 1384 Factory::heap_number_map()); | 1387 Factory::heap_number_map()); |
| 1385 deferred->Branch(not_equal); | 1388 deferred->Branch(not_equal); |
| 1386 } | 1389 } |
| 1387 // Load integer value into answer register using truncation. | 1390 // Load integer value into answer register using truncation. |
| 1388 __ cvttsd2si(answer.reg(), | 1391 __ cvttsd2si(answer.reg(), |
| 1389 FieldOperand(answer.reg(), HeapNumber::kValueOffset)); | 1392 FieldOperand(answer.reg(), HeapNumber::kValueOffset)); |
| 1390 // Branch if we might have overflowed. | 1393 // Branch if we might have overflowed. |
| 1391 // (False negative for Smi::kMinValue) | 1394 // (False negative for Smi::kMinValue) |
| 1392 __ cmpq(answer.reg(), Immediate(0x80000000)); | 1395 __ cmpl(answer.reg(), Immediate(0x80000000)); |
| 1393 deferred->Branch(equal); | 1396 deferred->Branch(equal); |
| 1394 // TODO(lrn): Inline shifts on int32 here instead of first smi-tagging. | 1397 // TODO(lrn): Inline shifts on int32 here instead of first smi-tagging. |
| 1395 __ Integer32ToSmi(answer.reg(), answer.reg()); | 1398 __ Integer32ToSmi(answer.reg(), answer.reg()); |
| 1396 } else { | 1399 } else { |
| 1397 // Fast case - both are actually smis. | 1400 // Fast case - both are actually smis. |
| 1398 if (FLAG_debug_code) { | 1401 if (FLAG_debug_code) { |
| 1399 __ AbortIfNotSmi(left->reg()); | 1402 __ AbortIfNotSmi(left->reg()); |
| 1400 } | 1403 } |
| 1401 } | 1404 } |
| 1402 } else { | 1405 } else { |
| 1403 JumpIfNotBothSmiUsingTypeInfo(left->reg(), rcx, | 1406 JumpIfNotBothSmiUsingTypeInfo(left->reg(), rcx, |
| 1404 left_type_info, right_type_info, deferred); | 1407 left_type_info, right_type_info, deferred); |
| 1405 } | 1408 } |
| 1406 __ bind(&do_op); | 1409 __ bind(&do_op); |
| 1407 | 1410 |
| 1408 // Perform the operation. | 1411 // Perform the operation. |
| 1409 switch (op) { | 1412 switch (op) { |
| 1410 case Token::SAR: | 1413 case Token::SAR: |
| 1411 __ SmiShiftArithmeticRight(answer.reg(), left->reg(), rcx); | 1414 __ SmiShiftArithmeticRight(answer.reg(), answer.reg(), rcx); |
| 1412 break; | 1415 break; |
| 1413 case Token::SHR: { | 1416 case Token::SHR: { |
| 1414 __ SmiShiftLogicalRight(answer.reg(), | 1417 __ SmiShiftLogicalRight(answer.reg(), |
| 1415 left->reg(), | 1418 answer.reg(), |
| 1416 rcx, | 1419 rcx, |
| 1417 deferred->entry_label()); | 1420 deferred->entry_label()); |
| 1418 break; | 1421 break; |
| 1419 } | 1422 } |
| 1420 case Token::SHL: { | 1423 case Token::SHL: { |
| 1421 __ SmiShiftLeft(answer.reg(), | 1424 __ SmiShiftLeft(answer.reg(), |
| 1422 left->reg(), | 1425 answer.reg(), |
| 1423 rcx); | 1426 rcx); |
| 1424 break; | 1427 break; |
| 1425 } | 1428 } |
| 1426 default: | 1429 default: |
| 1427 UNREACHABLE(); | 1430 UNREACHABLE(); |
| 1428 } | 1431 } |
| 1429 deferred->BindExit(); | 1432 deferred->BindExit(); |
| 1430 left->Unuse(); | 1433 left->Unuse(); |
| 1431 right->Unuse(); | 1434 right->Unuse(); |
| 1432 ASSERT(answer.is_valid()); | 1435 ASSERT(answer.is_valid()); |
| (...skipping 10643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12076 #undef __ | 12079 #undef __ |
| 12077 | 12080 |
| 12078 void RecordWriteStub::Generate(MacroAssembler* masm) { | 12081 void RecordWriteStub::Generate(MacroAssembler* masm) { |
| 12079 masm->RecordWriteHelper(object_, addr_, scratch_); | 12082 masm->RecordWriteHelper(object_, addr_, scratch_); |
| 12080 masm->ret(0); | 12083 masm->ret(0); |
| 12081 } | 12084 } |
| 12082 | 12085 |
| 12083 } } // namespace v8::internal | 12086 } } // namespace v8::internal |
| 12084 | 12087 |
| 12085 #endif // V8_TARGET_ARCH_X64 | 12088 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |