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 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 return Operand(rsp, index * kPointerSize); | 1516 return Operand(rsp, index * kPointerSize); |
1517 #endif | 1517 #endif |
1518 } | 1518 } |
1519 | 1519 |
1520 | 1520 |
1521 inline Operand StackOperandForReturnAddress(int32_t disp) { | 1521 inline Operand StackOperandForReturnAddress(int32_t disp) { |
1522 return Operand(rsp, disp); | 1522 return Operand(rsp, disp); |
1523 } | 1523 } |
1524 | 1524 |
1525 | 1525 |
| 1526 // Computes the argument address from the argument 0 (might be receiver) |
| 1527 // at rsp + disp + kPCOnStackSize + (total - 1) * kPointerSize, disp is the |
| 1528 // displacement between the rsp and the return address. |
| 1529 inline Operand StackOperandForArgument(int index, int total, int disp = 0) { |
| 1530 return Operand(rsp, disp + kPCOnStackSize + |
| 1531 (total - 1 - index) * kPointerSize); |
| 1532 } |
| 1533 |
| 1534 |
| 1535 // Computes the argument address in reverse order, i.e., from the last argument |
| 1536 // at rsp + disp + kPCOnStackSize, disp is the displacement between the rsp |
| 1537 // and the return address. |
| 1538 inline Operand StackOperandForReversedArgument(int index, int disp = 0) { |
| 1539 return Operand(rsp, disp + kPCOnStackSize + index * kPointerSize); |
| 1540 } |
| 1541 |
| 1542 |
| 1543 inline Operand StackOperandForReversedArgument(Register index, |
| 1544 int offset, |
| 1545 int disp = 0) { |
| 1546 return Operand(rsp, index, times_pointer_size, |
| 1547 disp + kPCOnStackSize + offset * kPointerSize); |
| 1548 } |
| 1549 |
| 1550 |
| 1551 inline Operand StackOperandForReceiver(int index, int disp = 0) { |
| 1552 return StackOperandForReversedArgument(index, disp); |
| 1553 } |
| 1554 |
| 1555 |
| 1556 inline Operand StackOperandForReceiver(Register index, int disp = 0) { |
| 1557 return StackOperandForReversedArgument(index, 0, disp); |
| 1558 } |
| 1559 |
| 1560 |
1526 #ifdef GENERATED_CODE_COVERAGE | 1561 #ifdef GENERATED_CODE_COVERAGE |
1527 extern void LogGeneratedCodeCoverage(const char* file_line); | 1562 extern void LogGeneratedCodeCoverage(const char* file_line); |
1528 #define CODE_COVERAGE_STRINGIFY(x) #x | 1563 #define CODE_COVERAGE_STRINGIFY(x) #x |
1529 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1564 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1530 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1565 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1531 #define ACCESS_MASM(masm) { \ | 1566 #define ACCESS_MASM(masm) { \ |
1532 Address x64_coverage_function = FUNCTION_ADDR(LogGeneratedCodeCoverage); \ | 1567 Address x64_coverage_function = FUNCTION_ADDR(LogGeneratedCodeCoverage); \ |
1533 masm->pushfq(); \ | 1568 masm->pushfq(); \ |
1534 masm->Pushad(); \ | 1569 masm->Pushad(); \ |
1535 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ | 1570 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ |
1536 masm->Call(x64_coverage_function, RelocInfo::EXTERNAL_REFERENCE); \ | 1571 masm->Call(x64_coverage_function, RelocInfo::EXTERNAL_REFERENCE); \ |
1537 masm->pop(rax); \ | 1572 masm->pop(rax); \ |
1538 masm->Popad(); \ | 1573 masm->Popad(); \ |
1539 masm->popfq(); \ | 1574 masm->popfq(); \ |
1540 } \ | 1575 } \ |
1541 masm-> | 1576 masm-> |
1542 #else | 1577 #else |
1543 #define ACCESS_MASM(masm) masm-> | 1578 #define ACCESS_MASM(masm) masm-> |
1544 #endif | 1579 #endif |
1545 | 1580 |
1546 } } // namespace v8::internal | 1581 } } // namespace v8::internal |
1547 | 1582 |
1548 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1583 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |