OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 __ neg(left_reg); | 1392 __ neg(left_reg); |
1393 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1393 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1394 DeoptimizeIf(zero, instr->environment()); | 1394 DeoptimizeIf(zero, instr->environment()); |
1395 } | 1395 } |
1396 __ jmp(&done, Label::kNear); | 1396 __ jmp(&done, Label::kNear); |
1397 } | 1397 } |
1398 | 1398 |
1399 __ bind(&left_is_not_negative); | 1399 __ bind(&left_is_not_negative); |
1400 __ and_(left_reg, divisor - 1); | 1400 __ and_(left_reg, divisor - 1); |
1401 __ bind(&done); | 1401 __ bind(&done); |
1402 | |
1403 } else if (hmod->fixed_right_arg().has_value) { | |
1404 Register left_reg = ToRegister(instr->left()); | |
1405 ASSERT(left_reg.is(ToRegister(instr->result()))); | |
1406 Register right_reg = ToRegister(instr->right()); | |
1407 | |
1408 int32_t divisor = hmod->fixed_right_arg().value; | |
1409 ASSERT(IsPowerOf2(divisor)); | |
1410 | |
1411 // Check if our assumption of a fixed right operand still holds. | |
1412 __ cmp(right_reg, Immediate(divisor)); | |
1413 DeoptimizeIf(not_equal, instr->environment()); | |
1414 | |
1415 Label left_is_not_negative, done; | |
1416 if (left->CanBeNegative()) { | |
1417 __ test(left_reg, Operand(left_reg)); | |
1418 __ j(not_sign, &left_is_not_negative, Label::kNear); | |
1419 __ neg(left_reg); | |
1420 __ and_(left_reg, divisor - 1); | |
1421 __ neg(left_reg); | |
1422 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { | |
1423 DeoptimizeIf(zero, instr->environment()); | |
1424 } | |
1425 __ jmp(&done, Label::kNear); | |
1426 } | |
1427 | |
1428 __ bind(&left_is_not_negative); | |
1429 __ and_(left_reg, divisor - 1); | |
1430 __ bind(&done); | |
1431 | |
1432 } else { | 1402 } else { |
1433 Register left_reg = ToRegister(instr->left()); | 1403 Register left_reg = ToRegister(instr->left()); |
1434 ASSERT(left_reg.is(eax)); | 1404 ASSERT(left_reg.is(eax)); |
1435 Register right_reg = ToRegister(instr->right()); | 1405 Register right_reg = ToRegister(instr->right()); |
1436 ASSERT(!right_reg.is(eax)); | 1406 ASSERT(!right_reg.is(eax)); |
1437 ASSERT(!right_reg.is(edx)); | 1407 ASSERT(!right_reg.is(edx)); |
1438 Register result_reg = ToRegister(instr->result()); | 1408 Register result_reg = ToRegister(instr->result()); |
1439 ASSERT(result_reg.is(edx)); | 1409 ASSERT(result_reg.is(edx)); |
1440 | 1410 |
1441 Label done; | 1411 Label done; |
(...skipping 5064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6506 FixedArray::kHeaderSize - kPointerSize)); | 6476 FixedArray::kHeaderSize - kPointerSize)); |
6507 __ bind(&done); | 6477 __ bind(&done); |
6508 } | 6478 } |
6509 | 6479 |
6510 | 6480 |
6511 #undef __ | 6481 #undef __ |
6512 | 6482 |
6513 } } // namespace v8::internal | 6483 } } // namespace v8::internal |
6514 | 6484 |
6515 #endif // V8_TARGET_ARCH_IA32 | 6485 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |