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

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

Issue 486007: Use int64_t to keep 64 MacOS happy. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // the XMM registers. The return value is in RAX. 84 // the XMM registers. The return value is in RAX.
85 // This calling convention is used on Linux, with GCC, and on Mac OS, 85 // This calling convention is used on Linux, with GCC, and on Mac OS,
86 // with GCC. A different convention is used on 64-bit windows. 86 // with GCC. A different convention is used on 64-bit windows.
87 87
88 typedef int (*F0)(); 88 typedef int (*F0)();
89 89
90 #define __ masm-> 90 #define __ masm->
91 91
92 TEST(Smi) { 92 TEST(Smi) {
93 // Check that C++ Smi operations work as expected. 93 // Check that C++ Smi operations work as expected.
94 intptr_t test_numbers[] = { 94 int64_t test_numbers[] = {
95 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257, 95 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257,
96 Smi::kMaxValue, static_cast<intptr_t>(Smi::kMaxValue) + 1, 96 Smi::kMaxValue, static_cast<int64_t>(Smi::kMaxValue) + 1,
97 Smi::kMinValue, static_cast<intptr_t>(Smi::kMinValue) - 1 97 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1
98 }; 98 };
99 int test_number_count = 15; 99 int test_number_count = 15;
100 for (int i = 0; i < test_number_count; i++) { 100 for (int i = 0; i < test_number_count; i++) {
101 intptr_t number = test_numbers[i]; 101 int64_t number = test_numbers[i];
102 bool is_valid = Smi::IsValid(number); 102 bool is_valid = Smi::IsValid(number);
103 bool is_in_range = number >= Smi::kMinValue && number <= Smi::kMaxValue; 103 bool is_in_range = number >= Smi::kMinValue && number <= Smi::kMaxValue;
104 CHECK_EQ(is_in_range, is_valid); 104 CHECK_EQ(is_in_range, is_valid);
105 if (is_valid) { 105 if (is_valid) {
106 Smi* smi_from_intptr = Smi::FromIntptr(number); 106 Smi* smi_from_intptr = Smi::FromIntptr(number);
107 if (static_cast<int>(number) == number) { // Is a 32-bit int. 107 if (static_cast<int>(number) == number) { // Is a 32-bit int.
108 Smi* smi_from_int = Smi::FromInt(static_cast<int32_t>(number)); 108 Smi* smi_from_int = Smi::FromInt(static_cast<int32_t>(number));
109 CHECK_EQ(smi_from_int, smi_from_intptr); 109 CHECK_EQ(smi_from_int, smi_from_intptr);
110 } 110 }
111 int smi_value = smi_from_intptr->value(); 111 int64_t smi_value = smi_from_intptr->value();
112 CHECK_EQ(number, static_cast<intptr_t>(smi_value)); 112 CHECK_EQ(number, smi_value);
113 } 113 }
114 } 114 }
115 } 115 }
116 116
117 117
118 static void TestMoveSmi(MacroAssembler* masm, Label* exit, int id, Smi* value) { 118 static void TestMoveSmi(MacroAssembler* masm, Label* exit, int id, Smi* value) {
119 __ movl(rax, Immediate(id)); 119 __ movl(rax, Immediate(id));
120 __ Move(rcx, Smi::FromInt(0)); 120 __ Move(rcx, Smi::FromInt(0));
121 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); 121 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
122 __ cmpq(rcx, rdx); 122 __ cmpq(rcx, rdx);
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 2095
2096 CodeDesc desc; 2096 CodeDesc desc;
2097 masm->GetCode(&desc); 2097 masm->GetCode(&desc);
2098 // Call the function from C++. 2098 // Call the function from C++.
2099 int result = FUNCTION_CAST<F0>(buffer)(); 2099 int result = FUNCTION_CAST<F0>(buffer)();
2100 CHECK_EQ(0, result); 2100 CHECK_EQ(0, result);
2101 } 2101 }
2102 2102
2103 2103
2104 #undef __ 2104 #undef __
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698