| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_A64_MACRO_ASSEMBLER_A64_H_ | 28 #ifndef V8_A64_MACRO_ASSEMBLER_A64_H_ |
| 29 #define V8_A64_MACRO_ASSEMBLER_A64_H_ | 29 #define V8_A64_MACRO_ASSEMBLER_A64_H_ |
| 30 | 30 |
| 31 #include <vector> | |
| 32 | |
| 33 #include "v8globals.h" | 31 #include "v8globals.h" |
| 34 #include "globals.h" | 32 #include "globals.h" |
| 35 | 33 |
| 36 #include "a64/assembler-a64-inl.h" | 34 #include "a64/assembler-a64-inl.h" |
| 37 | 35 |
| 38 namespace v8 { | 36 namespace v8 { |
| 39 namespace internal { | 37 namespace internal { |
| 40 | 38 |
| 41 #define LS_MACRO_LIST(V) \ | 39 #define LS_MACRO_LIST(V) \ |
| 42 V(Ldrb, Register&, rt, LDRB_w) \ | 40 V(Ldrb, Register&, rt, LDRB_w) \ |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 PopSizeRegList(regs, kDRegSize, CPURegister::kFPRegister); | 510 PopSizeRegList(regs, kDRegSize, CPURegister::kFPRegister); |
| 513 } | 511 } |
| 514 inline void PushSRegList(RegList regs) { | 512 inline void PushSRegList(RegList regs) { |
| 515 PushSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); | 513 PushSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); |
| 516 } | 514 } |
| 517 inline void PopSRegList(RegList regs) { | 515 inline void PopSRegList(RegList regs) { |
| 518 PopSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); | 516 PopSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); |
| 519 } | 517 } |
| 520 | 518 |
| 521 // Push the specified register 'count' times. | 519 // Push the specified register 'count' times. |
| 522 void PushMultipleTimes(CPURegister src, Register count); | 520 void PushMultipleTimes(int count, Register src); |
| 523 void PushMultipleTimes(CPURegister src, int count); | |
| 524 | 521 |
| 525 // This is a convenience method for pushing a single Handle<Object>. | 522 // This is a convenience method for pushing a single Handle<Object>. |
| 526 inline void Push(Handle<Object> handle); | 523 inline void Push(Handle<Object> handle); |
| 527 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); } | 524 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); } |
| 528 | 525 |
| 529 // Aliases of Push and Pop, required for V8 compatibility. | 526 // Aliases of Push and Pop, required for V8 compatibility. |
| 530 inline void push(Register src) { | 527 inline void push(Register src) { |
| 531 Push(src); | 528 Push(src); |
| 532 } | 529 } |
| 533 inline void pop(Register dst) { | 530 inline void pop(Register dst) { |
| 534 Pop(dst); | 531 Pop(dst); |
| 535 } | 532 } |
| 536 | 533 |
| 537 // Sometimes callers need to push or pop multiple registers in a way that is | |
| 538 // difficult to structure efficiently for fixed Push or Pop calls. This scope | |
| 539 // allows push requests to be queued up, then flushed at once. The | |
| 540 // MacroAssembler will try to generate the most efficient sequence required. | |
| 541 // | |
| 542 // Unlike the other Push and Pop macros, PushPopQueue can handle mixed sets of | |
| 543 // register sizes and types. | |
| 544 class PushPopQueue { | |
| 545 public: | |
| 546 explicit PushPopQueue(MacroAssembler* masm) : masm_(masm), size_(0) { } | |
| 547 | |
| 548 ~PushPopQueue() { | |
| 549 ASSERT(queued_.empty()); | |
| 550 } | |
| 551 | |
| 552 void Queue(const CPURegister& rt) { | |
| 553 size_ += rt.SizeInBytes(); | |
| 554 queued_.push_back(rt); | |
| 555 } | |
| 556 | |
| 557 void PushQueued(); | |
| 558 void PopQueued(); | |
| 559 | |
| 560 private: | |
| 561 MacroAssembler* masm_; | |
| 562 int size_; | |
| 563 std::vector<CPURegister> queued_; | |
| 564 }; | |
| 565 | |
| 566 // Poke 'src' onto the stack. The offset is in bytes. | 534 // Poke 'src' onto the stack. The offset is in bytes. |
| 567 // | 535 // |
| 568 // If the current stack pointer (according to StackPointer()) is csp, then | 536 // If the current stack pointer (according to StackPointer()) is csp, then |
| 569 // csp must be aligned to 16 bytes. | 537 // csp must be aligned to 16 bytes. |
| 570 void Poke(const CPURegister& src, const Operand& offset); | 538 void Poke(const CPURegister& src, const Operand& offset); |
| 571 | 539 |
| 572 // Peek at a value on the stack, and put it in 'dst'. The offset is in bytes. | 540 // Peek at a value on the stack, and put it in 'dst'. The offset is in bytes. |
| 573 // | 541 // |
| 574 // If the current stack pointer (according to StackPointer()) is csp, then | 542 // If the current stack pointer (according to StackPointer()) is csp, then |
| 575 // csp must be aligned to 16 bytes. | 543 // csp must be aligned to 16 bytes. |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 // Note that size is per register, and is specified in bytes. | 1996 // Note that size is per register, and is specified in bytes. |
| 2029 void PushHelper(int count, int size, | 1997 void PushHelper(int count, int size, |
| 2030 const CPURegister& src0, const CPURegister& src1, | 1998 const CPURegister& src0, const CPURegister& src1, |
| 2031 const CPURegister& src2, const CPURegister& src3); | 1999 const CPURegister& src2, const CPURegister& src3); |
| 2032 void PopHelper(int count, int size, | 2000 void PopHelper(int count, int size, |
| 2033 const CPURegister& dst0, const CPURegister& dst1, | 2001 const CPURegister& dst0, const CPURegister& dst1, |
| 2034 const CPURegister& dst2, const CPURegister& dst3); | 2002 const CPURegister& dst2, const CPURegister& dst3); |
| 2035 | 2003 |
| 2036 // Perform necessary maintenance operations before a push or pop. | 2004 // Perform necessary maintenance operations before a push or pop. |
| 2037 // | 2005 // |
| 2038 // Note that size is specified in bytes. | 2006 // Note that size is per register, and is specified in bytes. |
| 2039 void PrepareForPush(Operand total_size); | 2007 void PrepareForPush(int count, int size); |
| 2040 void PrepareForPop(Operand total_size); | 2008 void PrepareForPop(int count, int size); |
| 2041 | |
| 2042 void PrepareForPush(int count, int size) { PrepareForPush(count * size); } | |
| 2043 void PrepareForPop(int count, int size) { PrepareForPop(count * size); } | |
| 2044 | 2009 |
| 2045 // Call Printf. On a native build, a simple call will be generated, but if the | 2010 // Call Printf. On a native build, a simple call will be generated, but if the |
| 2046 // simulator is being used then a suitable pseudo-instruction is used. The | 2011 // simulator is being used then a suitable pseudo-instruction is used. The |
| 2047 // arguments and stack (csp) must be prepared by the caller as for a normal | 2012 // arguments and stack (csp) must be prepared by the caller as for a normal |
| 2048 // AAPCS64 call to 'printf'. | 2013 // AAPCS64 call to 'printf'. |
| 2049 // | 2014 // |
| 2050 // The 'type' argument specifies the type of the optional arguments. | 2015 // The 'type' argument specifies the type of the optional arguments. |
| 2051 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); | 2016 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); |
| 2052 | 2017 |
| 2053 // Helper for throwing exceptions. Compute a handler address and jump to | 2018 // Helper for throwing exceptions. Compute a handler address and jump to |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 #error "Unsupported option" | 2185 #error "Unsupported option" |
| 2221 #define CODE_COVERAGE_STRINGIFY(x) #x | 2186 #define CODE_COVERAGE_STRINGIFY(x) #x |
| 2222 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 2187 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 2223 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 2188 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 2224 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 2189 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 2225 #else | 2190 #else |
| 2226 #define ACCESS_MASM(masm) masm-> | 2191 #define ACCESS_MASM(masm) masm-> |
| 2227 #endif | 2192 #endif |
| 2228 | 2193 |
| 2229 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ | 2194 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ |
| OLD | NEW |