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

Side by Side Diff: test/cctest/test-macro-assembler-x64.cc

Issue 419803009: [x64] Get rid of the stupid SmiConstantRegister. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // This calling convention is used on Linux, with GCC, and on Mac OS, 91 // This calling convention is used on Linux, with GCC, and on Mac OS,
92 // with GCC. A different convention is used on 64-bit windows. 92 // with GCC. A different convention is used on 64-bit windows.
93 93
94 typedef int (*F0)(); 94 typedef int (*F0)();
95 95
96 #define __ masm-> 96 #define __ masm->
97 97
98 98
99 static void EntryCode(MacroAssembler* masm) { 99 static void EntryCode(MacroAssembler* masm) {
100 // Smi constant register is callee save. 100 // Smi constant register is callee save.
101 __ pushq(i::kSmiConstantRegister);
102 __ pushq(i::kRootRegister); 101 __ pushq(i::kRootRegister);
103 __ InitializeSmiConstantRegister();
104 __ InitializeRootRegister(); 102 __ InitializeRootRegister();
105 } 103 }
106 104
107 105
108 static void ExitCode(MacroAssembler* masm) { 106 static void ExitCode(MacroAssembler* masm) {
109 // Return -1 if kSmiConstantRegister was clobbered during the test.
110 __ Move(rdx, Smi::FromInt(1));
111 __ cmpq(rdx, i::kSmiConstantRegister);
112 __ movq(rdx, Immediate(-1));
113 __ cmovq(not_equal, rax, rdx);
114 __ popq(i::kRootRegister); 107 __ popq(i::kRootRegister);
115 __ popq(i::kSmiConstantRegister);
116 } 108 }
117 109
118 110
119 TEST(Smi) { 111 TEST(Smi) {
120 // Check that C++ Smi operations work as expected. 112 // Check that C++ Smi operations work as expected.
121 int64_t test_numbers[] = { 113 int64_t test_numbers[] = {
122 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257, 114 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257,
123 Smi::kMaxValue, static_cast<int64_t>(Smi::kMaxValue) + 1, 115 Smi::kMaxValue, static_cast<int64_t>(Smi::kMaxValue) + 1,
124 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1 116 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1
125 }; 117 };
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 __ movq(rcx, Immediate(Smi::kMaxValue)); 546 __ movq(rcx, Immediate(Smi::kMaxValue));
555 __ Integer32ToSmi(rcx, rcx); 547 __ Integer32ToSmi(rcx, rcx);
556 cond = masm->CheckNonNegativeSmi(rcx); // Most positive smi is positive. 548 cond = masm->CheckNonNegativeSmi(rcx); // Most positive smi is positive.
557 __ j(NegateCondition(cond), &exit); 549 __ j(NegateCondition(cond), &exit);
558 550
559 __ incq(rax); 551 __ incq(rax);
560 __ xorq(rcx, Immediate(kSmiTagMask)); 552 __ xorq(rcx, Immediate(kSmiTagMask));
561 cond = masm->CheckNonNegativeSmi(rcx); // "Positive" non-smi. 553 cond = masm->CheckNonNegativeSmi(rcx); // "Positive" non-smi.
562 __ j(cond, &exit); 554 __ j(cond, &exit);
563 555
564 // CheckIsMinSmi
565
566 __ incq(rax);
567 __ movq(rcx, Immediate(Smi::kMaxValue));
568 __ Integer32ToSmi(rcx, rcx);
569 cond = masm->CheckIsMinSmi(rcx);
570 __ j(cond, &exit);
571
572 __ incq(rax);
573 __ movq(rcx, Immediate(0));
574 __ Integer32ToSmi(rcx, rcx);
575 cond = masm->CheckIsMinSmi(rcx);
576 __ j(cond, &exit);
577
578 __ incq(rax);
579 __ movq(rcx, Immediate(Smi::kMinValue));
580 __ Integer32ToSmi(rcx, rcx);
581 cond = masm->CheckIsMinSmi(rcx);
582 __ j(NegateCondition(cond), &exit);
583
584 __ incq(rax);
585 __ movq(rcx, Immediate(Smi::kMinValue + 1));
586 __ Integer32ToSmi(rcx, rcx);
587 cond = masm->CheckIsMinSmi(rcx);
588 __ j(cond, &exit);
589
590 // CheckBothSmi 556 // CheckBothSmi
591 557
592 __ incq(rax); 558 __ incq(rax);
593 __ movq(rcx, Immediate(Smi::kMaxValue)); 559 __ movq(rcx, Immediate(Smi::kMaxValue));
594 __ Integer32ToSmi(rcx, rcx); 560 __ Integer32ToSmi(rcx, rcx);
595 __ movq(rdx, Immediate(Smi::kMinValue)); 561 __ movq(rdx, Immediate(Smi::kMinValue));
596 __ Integer32ToSmi(rdx, rdx); 562 __ Integer32ToSmi(rdx, rdx);
597 cond = masm->CheckBothSmi(rcx, rdx); 563 cond = masm->CheckBothSmi(rcx, rdx);
598 __ j(NegateCondition(cond), &exit); 564 __ j(NegateCondition(cond), &exit);
599 565
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 2729
2764 CodeDesc desc; 2730 CodeDesc desc;
2765 masm->GetCode(&desc); 2731 masm->GetCode(&desc);
2766 // Call the function from C++. 2732 // Call the function from C++.
2767 int result = FUNCTION_CAST<F0>(buffer)(); 2733 int result = FUNCTION_CAST<F0>(buffer)();
2768 CHECK_EQ(0, result); 2734 CHECK_EQ(0, result);
2769 } 2735 }
2770 2736
2771 2737
2772 #undef __ 2738 #undef __
OLDNEW
« src/x64/macro-assembler-x64.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698