Chromium Code Reviews| 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 | |
| 31 #include "v8globals.h" | 33 #include "v8globals.h" |
| 32 #include "globals.h" | 34 #include "globals.h" |
| 33 | 35 |
| 34 #include "a64/assembler-a64-inl.h" | 36 #include "a64/assembler-a64-inl.h" |
| 35 | 37 |
| 36 namespace v8 { | 38 namespace v8 { |
| 37 namespace internal { | 39 namespace internal { |
| 38 | 40 |
| 39 #define LS_MACRO_LIST(V) \ | 41 #define LS_MACRO_LIST(V) \ |
| 40 V(Ldrb, Register&, rt, LDRB_w) \ | 42 V(Ldrb, Register&, rt, LDRB_w) \ |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 PopSizeRegList(regs, kDRegSize, CPURegister::kFPRegister); | 512 PopSizeRegList(regs, kDRegSize, CPURegister::kFPRegister); |
| 511 } | 513 } |
| 512 inline void PushSRegList(RegList regs) { | 514 inline void PushSRegList(RegList regs) { |
| 513 PushSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); | 515 PushSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); |
| 514 } | 516 } |
| 515 inline void PopSRegList(RegList regs) { | 517 inline void PopSRegList(RegList regs) { |
| 516 PopSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); | 518 PopSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); |
| 517 } | 519 } |
| 518 | 520 |
| 519 // Push the specified register 'count' times. | 521 // Push the specified register 'count' times. |
| 520 void PushMultipleTimes(int count, Register src); | 522 void PushMultipleTimes(CPURegister src, Register count); |
| 523 void PushMultipleTimes(CPURegister src, int count); | |
| 521 | 524 |
| 522 // This is a convenience method for pushing a single Handle<Object>. | 525 // This is a convenience method for pushing a single Handle<Object>. |
| 523 inline void Push(Handle<Object> handle); | 526 inline void Push(Handle<Object> handle); |
| 524 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); } | 527 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); } |
| 525 | 528 |
| 526 // Aliases of Push and Pop, required for V8 compatibility. | 529 // Aliases of Push and Pop, required for V8 compatibility. |
| 527 inline void push(Register src) { | 530 inline void push(Register src) { |
| 528 Push(src); | 531 Push(src); |
| 529 } | 532 } |
| 530 inline void pop(Register dst) { | 533 inline void pop(Register dst) { |
| 531 Pop(dst); | 534 Pop(dst); |
| 532 } | 535 } |
| 533 | 536 |
| 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 | |
| 534 // Poke 'src' onto the stack. The offset is in bytes. | 566 // Poke 'src' onto the stack. The offset is in bytes. |
| 535 // | 567 // |
| 536 // If the current stack pointer (according to StackPointer()) is csp, then | 568 // If the current stack pointer (according to StackPointer()) is csp, then |
| 537 // csp must be aligned to 16 bytes. | 569 // csp must be aligned to 16 bytes. |
| 538 void Poke(const CPURegister& src, const Operand& offset); | 570 void Poke(const CPURegister& src, const Operand& offset); |
| 539 | 571 |
| 540 // Peek at a value on the stack, and put it in 'dst'. The offset is in bytes. | 572 // Peek at a value on the stack, and put it in 'dst'. The offset is in bytes. |
| 541 // | 573 // |
| 542 // If the current stack pointer (according to StackPointer()) is csp, then | 574 // If the current stack pointer (according to StackPointer()) is csp, then |
| 543 // csp must be aligned to 16 bytes. | 575 // csp must be aligned to 16 bytes. |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1994 // Note that size is per register, and is specified in bytes. | 2026 // Note that size is per register, and is specified in bytes. |
| 1995 void PushHelper(int count, int size, | 2027 void PushHelper(int count, int size, |
| 1996 const CPURegister& src0, const CPURegister& src1, | 2028 const CPURegister& src0, const CPURegister& src1, |
| 1997 const CPURegister& src2, const CPURegister& src3); | 2029 const CPURegister& src2, const CPURegister& src3); |
| 1998 void PopHelper(int count, int size, | 2030 void PopHelper(int count, int size, |
| 1999 const CPURegister& dst0, const CPURegister& dst1, | 2031 const CPURegister& dst0, const CPURegister& dst1, |
| 2000 const CPURegister& dst2, const CPURegister& dst3); | 2032 const CPURegister& dst2, const CPURegister& dst3); |
| 2001 | 2033 |
| 2002 // Perform necessary maintenance operations before a push or pop. | 2034 // Perform necessary maintenance operations before a push or pop. |
| 2003 // | 2035 // |
| 2004 // Note that size is per register, and is specified in bytes. | 2036 // Note that size is specified in bytes. |
| 2005 void PrepareForPush(int count, int size); | 2037 void PrepareForPush(Operand total_size); |
| 2006 void PrepareForPop(int count, int size); | 2038 void PrepareForPop(Operand total_size); |
| 2039 | |
| 2040 void PrepareForPush(int count, int size) { PrepareForPush(count * size); } | |
|
rmcilroy
2014/02/17 12:31:06
nit - restore the comment for these methods that:
| |
| 2041 void PrepareForPop(int count, int size) { PrepareForPop(count * size); } | |
| 2007 | 2042 |
| 2008 // Call Printf. On a native build, a simple call will be generated, but if the | 2043 // Call Printf. On a native build, a simple call will be generated, but if the |
| 2009 // simulator is being used then a suitable pseudo-instruction is used. The | 2044 // simulator is being used then a suitable pseudo-instruction is used. The |
| 2010 // arguments and stack (csp) must be prepared by the caller as for a normal | 2045 // arguments and stack (csp) must be prepared by the caller as for a normal |
| 2011 // AAPCS64 call to 'printf'. | 2046 // AAPCS64 call to 'printf'. |
| 2012 // | 2047 // |
| 2013 // The 'type' argument specifies the type of the optional arguments. | 2048 // The 'type' argument specifies the type of the optional arguments. |
| 2014 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); | 2049 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); |
| 2015 | 2050 |
| 2016 // Helper for throwing exceptions. Compute a handler address and jump to | 2051 // Helper for throwing exceptions. Compute a handler address and jump to |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2183 #error "Unsupported option" | 2218 #error "Unsupported option" |
| 2184 #define CODE_COVERAGE_STRINGIFY(x) #x | 2219 #define CODE_COVERAGE_STRINGIFY(x) #x |
| 2185 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 2220 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 2186 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 2221 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 2187 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 2222 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 2188 #else | 2223 #else |
| 2189 #define ACCESS_MASM(masm) masm-> | 2224 #define ACCESS_MASM(masm) masm-> |
| 2190 #endif | 2225 #endif |
| 2191 | 2226 |
| 2192 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ | 2227 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ |
| OLD | NEW |