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

Side by Side Diff: src/a64/macro-assembler-a64.h

Issue 169533002: A64: Tidy up Push and Pop TODOs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase after Abort code-size optimizations. Created 6 years, 10 months 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/a64/full-codegen-a64.cc ('k') | src/a64/macro-assembler-a64.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 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
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 PopSizeRegList(regs, kDRegSize, CPURegister::kFPRegister); 511 PopSizeRegList(regs, kDRegSize, CPURegister::kFPRegister);
510 } 512 }
511 inline void PushSRegList(RegList regs) { 513 inline void PushSRegList(RegList regs) {
512 PushSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); 514 PushSizeRegList(regs, kSRegSize, CPURegister::kFPRegister);
513 } 515 }
514 inline void PopSRegList(RegList regs) { 516 inline void PopSRegList(RegList regs) {
515 PopSizeRegList(regs, kSRegSize, CPURegister::kFPRegister); 517 PopSizeRegList(regs, kSRegSize, CPURegister::kFPRegister);
516 } 518 }
517 519
518 // Push the specified register 'count' times. 520 // Push the specified register 'count' times.
519 void PushMultipleTimes(int count, Register src); 521 void PushMultipleTimes(CPURegister src, Register count);
522 void PushMultipleTimes(CPURegister src, int count);
520 523
521 // This is a convenience method for pushing a single Handle<Object>. 524 // This is a convenience method for pushing a single Handle<Object>.
522 inline void Push(Handle<Object> handle); 525 inline void Push(Handle<Object> handle);
523 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); } 526 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); }
524 527
525 // Aliases of Push and Pop, required for V8 compatibility. 528 // Aliases of Push and Pop, required for V8 compatibility.
526 inline void push(Register src) { 529 inline void push(Register src) {
527 Push(src); 530 Push(src);
528 } 531 }
529 inline void pop(Register dst) { 532 inline void pop(Register dst) {
530 Pop(dst); 533 Pop(dst);
531 } 534 }
532 535
536 // Sometimes callers need to push or pop multiple registers in a way that is
537 // difficult to structure efficiently for fixed Push or Pop calls. This scope
538 // allows push requests to be queued up, then flushed at once. The
539 // MacroAssembler will try to generate the most efficient sequence required.
540 //
541 // Unlike the other Push and Pop macros, PushPopQueue can handle mixed sets of
542 // register sizes and types.
543 class PushPopQueue {
544 public:
545 explicit PushPopQueue(MacroAssembler* masm) : masm_(masm), size_(0) { }
546
547 ~PushPopQueue() {
548 ASSERT(queued_.empty());
549 }
550
551 void Queue(const CPURegister& rt) {
552 size_ += rt.SizeInBytes();
553 queued_.push_back(rt);
554 }
555
556 void PushQueued();
557 void PopQueued();
558
559 private:
560 MacroAssembler* masm_;
561 int size_;
562 std::vector<CPURegister> queued_;
563 };
564
533 // Poke 'src' onto the stack. The offset is in bytes. 565 // Poke 'src' onto the stack. The offset is in bytes.
534 // 566 //
535 // If the current stack pointer (according to StackPointer()) is csp, then 567 // If the current stack pointer (according to StackPointer()) is csp, then
536 // csp must be aligned to 16 bytes. 568 // csp must be aligned to 16 bytes.
537 void Poke(const CPURegister& src, const Operand& offset); 569 void Poke(const CPURegister& src, const Operand& offset);
538 570
539 // Peek at a value on the stack, and put it in 'dst'. The offset is in bytes. 571 // Peek at a value on the stack, and put it in 'dst'. The offset is in bytes.
540 // 572 //
541 // If the current stack pointer (according to StackPointer()) is csp, then 573 // If the current stack pointer (according to StackPointer()) is csp, then
542 // csp must be aligned to 16 bytes. 574 // csp must be aligned to 16 bytes.
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 // Note that size is per register, and is specified in bytes. 2027 // Note that size is per register, and is specified in bytes.
1996 void PushHelper(int count, int size, 2028 void PushHelper(int count, int size,
1997 const CPURegister& src0, const CPURegister& src1, 2029 const CPURegister& src0, const CPURegister& src1,
1998 const CPURegister& src2, const CPURegister& src3); 2030 const CPURegister& src2, const CPURegister& src3);
1999 void PopHelper(int count, int size, 2031 void PopHelper(int count, int size,
2000 const CPURegister& dst0, const CPURegister& dst1, 2032 const CPURegister& dst0, const CPURegister& dst1,
2001 const CPURegister& dst2, const CPURegister& dst3); 2033 const CPURegister& dst2, const CPURegister& dst3);
2002 2034
2003 // Perform necessary maintenance operations before a push or pop. 2035 // Perform necessary maintenance operations before a push or pop.
2004 // 2036 //
2005 // Note that size is per register, and is specified in bytes. 2037 // Note that size is specified in bytes.
2006 void PrepareForPush(int count, int size); 2038 void PrepareForPush(Operand total_size);
2007 void PrepareForPop(int count, int size); 2039 void PrepareForPop(Operand total_size);
2040
2041 void PrepareForPush(int count, int size) { PrepareForPush(count * size); }
2042 void PrepareForPop(int count, int size) { PrepareForPop(count * size); }
2008 2043
2009 // Call Printf. On a native build, a simple call will be generated, but if the 2044 // Call Printf. On a native build, a simple call will be generated, but if the
2010 // simulator is being used then a suitable pseudo-instruction is used. The 2045 // simulator is being used then a suitable pseudo-instruction is used. The
2011 // arguments and stack (csp) must be prepared by the caller as for a normal 2046 // arguments and stack (csp) must be prepared by the caller as for a normal
2012 // AAPCS64 call to 'printf'. 2047 // AAPCS64 call to 'printf'.
2013 // 2048 //
2014 // The 'type' argument specifies the type of the optional arguments. 2049 // The 'type' argument specifies the type of the optional arguments.
2015 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); 2050 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister);
2016 2051
2017 // Helper for throwing exceptions. Compute a handler address and jump to 2052 // Helper for throwing exceptions. Compute a handler address and jump to
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 #error "Unsupported option" 2264 #error "Unsupported option"
2230 #define CODE_COVERAGE_STRINGIFY(x) #x 2265 #define CODE_COVERAGE_STRINGIFY(x) #x
2231 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 2266 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
2232 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 2267 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
2233 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 2268 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
2234 #else 2269 #else
2235 #define ACCESS_MASM(masm) masm-> 2270 #define ACCESS_MASM(masm) masm->
2236 #endif 2271 #endif
2237 2272
2238 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ 2273 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_
OLDNEW
« no previous file with comments | « src/a64/full-codegen-a64.cc ('k') | src/a64/macro-assembler-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698