Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 42973002: Refine CountOperation of FullCodeGen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased with bleeding_edge Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 void MacroAssembler::SmiAddConstant(const Operand& dst, Smi* constant) { 1509 void MacroAssembler::SmiAddConstant(const Operand& dst, Smi* constant) {
1510 if (constant->value() != 0) { 1510 if (constant->value() != 0) {
1511 addl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(constant->value())); 1511 addl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(constant->value()));
1512 } 1512 }
1513 } 1513 }
1514 1514
1515 1515
1516 void MacroAssembler::SmiAddConstant(Register dst, 1516 void MacroAssembler::SmiAddConstant(Register dst,
1517 Register src, 1517 Register src,
1518 Smi* constant, 1518 Smi* constant,
1519 Label* on_not_smi_result, 1519 SmiOperationExecutionMode mode,
1520 Label* bailout_label,
1520 Label::Distance near_jump) { 1521 Label::Distance near_jump) {
1521 if (constant->value() == 0) { 1522 if (constant->value() == 0) {
1522 if (!dst.is(src)) { 1523 if (!dst.is(src)) {
1523 movq(dst, src); 1524 movq(dst, src);
1524 } 1525 }
1525 } else if (dst.is(src)) { 1526 } else if (dst.is(src)) {
1526 ASSERT(!dst.is(kScratchRegister)); 1527 ASSERT(!dst.is(kScratchRegister));
1527
1528 Label done;
1529 LoadSmiConstant(kScratchRegister, constant); 1528 LoadSmiConstant(kScratchRegister, constant);
1530 addq(dst, kScratchRegister); 1529 addq(dst, kScratchRegister);
1531 j(no_overflow, &done, Label::kNear); 1530 if (mode.Contains(BAILOUT_ON_NO_OVERFLOW)) {
1532 // Restore src. 1531 j(no_overflow, bailout_label, near_jump);
1533 subq(dst, kScratchRegister); 1532 ASSERT(mode.Contains(PRESERVE_SOURCE_REGISTER));
1534 jmp(on_not_smi_result, near_jump); 1533 subq(dst, kScratchRegister);
1535 bind(&done); 1534 } else if (mode.Contains(BAILOUT_ON_OVERFLOW)) {
1535 if (mode.Contains(PRESERVE_SOURCE_REGISTER)) {
1536 Label done;
1537 j(no_overflow, &done, Label::kNear);
1538 subq(dst, kScratchRegister);
1539 jmp(bailout_label, near_jump);
1540 bind(&done);
1541 } else {
1542 // Bailout if overflow without reserving src.
1543 j(overflow, bailout_label, near_jump);
1544 }
1545 } else {
1546 CHECK(mode.IsEmpty());
1547 }
1536 } else { 1548 } else {
1549 ASSERT(mode.Contains(PRESERVE_SOURCE_REGISTER));
1550 ASSERT(mode.Contains(BAILOUT_ON_OVERFLOW));
1537 LoadSmiConstant(dst, constant); 1551 LoadSmiConstant(dst, constant);
1538 addq(dst, src); 1552 addq(dst, src);
1539 j(overflow, on_not_smi_result, near_jump); 1553 j(overflow, bailout_label, near_jump);
1540 } 1554 }
1541 } 1555 }
1542 1556
1543 1557
1544 void MacroAssembler::SmiSubConstant(Register dst, Register src, Smi* constant) { 1558 void MacroAssembler::SmiSubConstant(Register dst, Register src, Smi* constant) {
1545 if (constant->value() == 0) { 1559 if (constant->value() == 0) {
1546 if (!dst.is(src)) { 1560 if (!dst.is(src)) {
1547 movq(dst, src); 1561 movq(dst, src);
1548 } 1562 }
1549 } else if (dst.is(src)) { 1563 } else if (dst.is(src)) {
(...skipping 11 matching lines...) Expand all
1561 LoadSmiConstant(dst, Smi::FromInt(-constant->value())); 1575 LoadSmiConstant(dst, Smi::FromInt(-constant->value()));
1562 addq(dst, src); 1576 addq(dst, src);
1563 } 1577 }
1564 } 1578 }
1565 } 1579 }
1566 1580
1567 1581
1568 void MacroAssembler::SmiSubConstant(Register dst, 1582 void MacroAssembler::SmiSubConstant(Register dst,
1569 Register src, 1583 Register src,
1570 Smi* constant, 1584 Smi* constant,
1571 Label* on_not_smi_result, 1585 SmiOperationExecutionMode mode,
1586 Label* bailout_label,
1572 Label::Distance near_jump) { 1587 Label::Distance near_jump) {
1573 if (constant->value() == 0) { 1588 if (constant->value() == 0) {
1574 if (!dst.is(src)) { 1589 if (!dst.is(src)) {
1575 movq(dst, src); 1590 movq(dst, src);
1576 } 1591 }
1577 } else if (dst.is(src)) { 1592 } else if (dst.is(src)) {
1578 ASSERT(!dst.is(kScratchRegister)); 1593 ASSERT(!dst.is(kScratchRegister));
1594 LoadSmiConstant(kScratchRegister, constant);
1595 subq(dst, kScratchRegister);
1596 if (mode.Contains(BAILOUT_ON_NO_OVERFLOW)) {
1597 j(no_overflow, bailout_label, near_jump);
1598 ASSERT(mode.Contains(PRESERVE_SOURCE_REGISTER));
1599 addq(dst, kScratchRegister);
1600 } else if (mode.Contains(BAILOUT_ON_OVERFLOW)) {
1601 if (mode.Contains(PRESERVE_SOURCE_REGISTER)) {
1602 Label done;
1603 j(no_overflow, &done, Label::kNear);
1604 addq(dst, kScratchRegister);
1605 jmp(bailout_label, near_jump);
1606 bind(&done);
1607 } else {
1608 // Bailout if overflow without reserving src.
1609 j(overflow, bailout_label, near_jump);
1610 }
1611 } else {
1612 CHECK(mode.IsEmpty());
1613 }
1614 } else {
1615 ASSERT(mode.Contains(PRESERVE_SOURCE_REGISTER));
1616 ASSERT(mode.Contains(BAILOUT_ON_OVERFLOW));
1579 if (constant->value() == Smi::kMinValue) { 1617 if (constant->value() == Smi::kMinValue) {
1580 // Subtracting min-value from any non-negative value will overflow. 1618 ASSERT(!dst.is(kScratchRegister));
1581 // We test the non-negativeness before doing the subtraction. 1619 movq(dst, src);
1582 testq(src, src);
1583 j(not_sign, on_not_smi_result, near_jump);
1584 LoadSmiConstant(kScratchRegister, constant); 1620 LoadSmiConstant(kScratchRegister, constant);
1585 subq(dst, kScratchRegister); 1621 subq(dst, kScratchRegister);
1586 } else { 1622 j(overflow, bailout_label, near_jump);
1587 // Subtract by adding the negation.
1588 LoadSmiConstant(kScratchRegister, Smi::FromInt(-constant->value()));
1589 addq(kScratchRegister, dst);
1590 j(overflow, on_not_smi_result, near_jump);
1591 movq(dst, kScratchRegister);
1592 }
1593 } else {
1594 if (constant->value() == Smi::kMinValue) {
1595 // Subtracting min-value from any non-negative value will overflow.
1596 // We test the non-negativeness before doing the subtraction.
1597 testq(src, src);
1598 j(not_sign, on_not_smi_result, near_jump);
1599 LoadSmiConstant(dst, constant);
1600 // Adding and subtracting the min-value gives the same result, it only
1601 // differs on the overflow bit, which we don't check here.
1602 addq(dst, src);
1603 } else { 1623 } else {
1604 // Subtract by adding the negation. 1624 // Subtract by adding the negation.
1605 LoadSmiConstant(dst, Smi::FromInt(-(constant->value()))); 1625 LoadSmiConstant(dst, Smi::FromInt(-(constant->value())));
1606 addq(dst, src); 1626 addq(dst, src);
1607 j(overflow, on_not_smi_result, near_jump); 1627 j(overflow, bailout_label, near_jump);
1608 } 1628 }
1609 } 1629 }
1610 } 1630 }
1611 1631
1612 1632
1613 void MacroAssembler::SmiNeg(Register dst, 1633 void MacroAssembler::SmiNeg(Register dst,
1614 Register src, 1634 Register src,
1615 Label* on_smi_result, 1635 Label* on_smi_result,
1616 Label::Distance near_jump) { 1636 Label::Distance near_jump) {
1617 if (dst.is(src)) { 1637 if (dst.is(src)) {
(...skipping 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after
4987 j(equal, found); 5007 j(equal, found);
4988 movq(current, FieldOperand(current, Map::kPrototypeOffset)); 5008 movq(current, FieldOperand(current, Map::kPrototypeOffset));
4989 CompareRoot(current, Heap::kNullValueRootIndex); 5009 CompareRoot(current, Heap::kNullValueRootIndex);
4990 j(not_equal, &loop_again); 5010 j(not_equal, &loop_again);
4991 } 5011 }
4992 5012
4993 5013
4994 } } // namespace v8::internal 5014 } } // namespace v8::internal
4995 5015
4996 #endif // V8_TARGET_ARCH_X64 5016 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698