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 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 __ cmp(right, Operand::Zero()); | 1402 __ cmp(right, Operand::Zero()); |
1403 } | 1403 } |
1404 __ b(pl, &positive); | 1404 __ b(pl, &positive); |
1405 __ cmp(left, Operand::Zero()); | 1405 __ cmp(left, Operand::Zero()); |
1406 DeoptimizeIf(eq, instr->environment()); | 1406 DeoptimizeIf(eq, instr->environment()); |
1407 __ bind(&positive); | 1407 __ bind(&positive); |
1408 } | 1408 } |
1409 | 1409 |
1410 // Check for (kMinInt / -1). | 1410 // Check for (kMinInt / -1). |
1411 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1411 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
1412 Label left_not_min_int; | |
1413 __ cmp(left, Operand(kMinInt)); | 1412 __ cmp(left, Operand(kMinInt)); |
1414 __ b(ne, &left_not_min_int); | 1413 __ cmp(right, Operand(-1), eq); |
1415 __ cmp(right, Operand(-1)); | |
1416 DeoptimizeIf(eq, instr->environment()); | 1414 DeoptimizeIf(eq, instr->environment()); |
1417 __ bind(&left_not_min_int); | |
1418 } | 1415 } |
1419 | 1416 |
1420 if (CpuFeatures::IsSupported(SUDIV)) { | 1417 if (CpuFeatures::IsSupported(SUDIV)) { |
1421 CpuFeatureScope scope(masm(), SUDIV); | 1418 CpuFeatureScope scope(masm(), SUDIV); |
1422 __ sdiv(result, left, right); | 1419 __ sdiv(result, left, right); |
1423 | 1420 |
1424 if (!instr->hydrogen()->CheckFlag( | 1421 if (!instr->hydrogen()->CheckFlag( |
1425 HInstruction::kAllUsesTruncatingToInt32)) { | 1422 HInstruction::kAllUsesTruncatingToInt32)) { |
1426 // Compute remainder and deopt if it's not zero. | 1423 // Compute remainder and deopt if it's not zero. |
1427 const Register remainder = scratch0(); | 1424 const Register remainder = scratch0(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 } else { | 1503 } else { |
1507 CpuFeatureScope scope(masm(), SUDIV); | 1504 CpuFeatureScope scope(masm(), SUDIV); |
1508 const Register right = ToRegister(instr->right()); | 1505 const Register right = ToRegister(instr->right()); |
1509 | 1506 |
1510 // Check for x / 0. | 1507 // Check for x / 0. |
1511 __ cmp(right, Operand::Zero()); | 1508 __ cmp(right, Operand::Zero()); |
1512 DeoptimizeIf(eq, instr->environment()); | 1509 DeoptimizeIf(eq, instr->environment()); |
1513 | 1510 |
1514 // Check for (kMinInt / -1). | 1511 // Check for (kMinInt / -1). |
1515 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1512 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
1516 Label left_not_min_int; | |
1517 __ cmp(left, Operand(kMinInt)); | 1513 __ cmp(left, Operand(kMinInt)); |
1518 __ b(ne, &left_not_min_int); | 1514 __ cmp(right, Operand(-1), eq); |
1519 __ cmp(right, Operand(-1)); | |
1520 DeoptimizeIf(eq, instr->environment()); | 1515 DeoptimizeIf(eq, instr->environment()); |
1521 __ bind(&left_not_min_int); | |
1522 } | 1516 } |
1523 | 1517 |
1524 // Check for (0 / -x) that will produce negative zero. | 1518 // Check for (0 / -x) that will produce negative zero. |
1525 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1519 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1526 __ cmp(right, Operand::Zero()); | 1520 __ cmp(right, Operand::Zero()); |
1527 __ cmp(left, Operand::Zero(), mi); | 1521 __ cmp(left, Operand::Zero(), mi); |
1528 // "right" can't be null because the code would have already been | 1522 // "right" can't be null because the code would have already been |
1529 // deoptimized. The Z flag is set only if (right < 0) and (left == 0). | 1523 // deoptimized. The Z flag is set only if (right < 0) and (left == 0). |
1530 // In this case we need to deoptimize to produce a -0. | 1524 // In this case we need to deoptimize to produce a -0. |
1531 DeoptimizeIf(eq, instr->environment()); | 1525 DeoptimizeIf(eq, instr->environment()); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 if (!instr->hydrogen()->value()->IsHeapObject()) { | 1874 if (!instr->hydrogen()->value()->IsHeapObject()) { |
1881 // If the object is a smi return the object. | 1875 // If the object is a smi return the object. |
1882 __ SmiTst(input); | 1876 __ SmiTst(input); |
1883 __ Move(result, input, eq); | 1877 __ Move(result, input, eq); |
1884 __ b(eq, &done); | 1878 __ b(eq, &done); |
1885 } | 1879 } |
1886 | 1880 |
1887 // If the object is not a value type, return the object. | 1881 // If the object is not a value type, return the object. |
1888 __ CompareObjectType(input, map, map, JS_VALUE_TYPE); | 1882 __ CompareObjectType(input, map, map, JS_VALUE_TYPE); |
1889 __ Move(result, input, ne); | 1883 __ Move(result, input, ne); |
1890 __ b(ne, &done); | 1884 __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset), eq); |
1891 __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset)); | |
1892 | 1885 |
1893 __ bind(&done); | 1886 __ bind(&done); |
1894 } | 1887 } |
1895 | 1888 |
1896 | 1889 |
1897 void LCodeGen::DoDateField(LDateField* instr) { | 1890 void LCodeGen::DoDateField(LDateField* instr) { |
1898 Register object = ToRegister(instr->date()); | 1891 Register object = ToRegister(instr->date()); |
1899 Register result = ToRegister(instr->result()); | 1892 Register result = ToRegister(instr->result()); |
1900 Register scratch = ToRegister(instr->temp()); | 1893 Register scratch = ToRegister(instr->temp()); |
1901 Smi* index = instr->index(); | 1894 Smi* index = instr->index(); |
(...skipping 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5573 EmitBranch(instr, eq); | 5566 EmitBranch(instr, eq); |
5574 } | 5567 } |
5575 | 5568 |
5576 | 5569 |
5577 void LCodeGen::EmitIsConstructCall(Register temp1, Register temp2) { | 5570 void LCodeGen::EmitIsConstructCall(Register temp1, Register temp2) { |
5578 ASSERT(!temp1.is(temp2)); | 5571 ASSERT(!temp1.is(temp2)); |
5579 // Get the frame pointer for the calling frame. | 5572 // Get the frame pointer for the calling frame. |
5580 __ ldr(temp1, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 5573 __ ldr(temp1, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
5581 | 5574 |
5582 // Skip the arguments adaptor frame if it exists. | 5575 // Skip the arguments adaptor frame if it exists. |
5583 Label check_frame_marker; | |
5584 __ ldr(temp2, MemOperand(temp1, StandardFrameConstants::kContextOffset)); | 5576 __ ldr(temp2, MemOperand(temp1, StandardFrameConstants::kContextOffset)); |
5585 __ cmp(temp2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5577 __ cmp(temp2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
5586 __ b(ne, &check_frame_marker); | 5578 __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kCallerFPOffset), eq); |
5587 __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kCallerFPOffset)); | |
5588 | 5579 |
5589 // Check the marker in the calling frame. | 5580 // Check the marker in the calling frame. |
5590 __ bind(&check_frame_marker); | |
5591 __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kMarkerOffset)); | 5581 __ ldr(temp1, MemOperand(temp1, StandardFrameConstants::kMarkerOffset)); |
5592 __ cmp(temp1, Operand(Smi::FromInt(StackFrame::CONSTRUCT))); | 5582 __ cmp(temp1, Operand(Smi::FromInt(StackFrame::CONSTRUCT))); |
5593 } | 5583 } |
5594 | 5584 |
5595 | 5585 |
5596 void LCodeGen::EnsureSpaceForLazyDeopt(int space_needed) { | 5586 void LCodeGen::EnsureSpaceForLazyDeopt(int space_needed) { |
5597 if (info()->IsStub()) return; | 5587 if (info()->IsStub()) return; |
5598 // Ensure that we have enough space after the previous lazy-bailout | 5588 // Ensure that we have enough space after the previous lazy-bailout |
5599 // instruction for patching the code here. | 5589 // instruction for patching the code here. |
5600 int current_pc = masm()->pc_offset(); | 5590 int current_pc = masm()->pc_offset(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5817 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5807 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5818 __ ldr(result, FieldMemOperand(scratch, | 5808 __ ldr(result, FieldMemOperand(scratch, |
5819 FixedArray::kHeaderSize - kPointerSize)); | 5809 FixedArray::kHeaderSize - kPointerSize)); |
5820 __ bind(&done); | 5810 __ bind(&done); |
5821 } | 5811 } |
5822 | 5812 |
5823 | 5813 |
5824 #undef __ | 5814 #undef __ |
5825 | 5815 |
5826 } } // namespace v8::internal | 5816 } } // namespace v8::internal |
OLD | NEW |