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

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

Issue 144313017: Make LeakSanitizer happy, part 2. Fixed register usage on the way. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | test/cctest/test-global-handles.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 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TEST(AssemblerX64XchglOperations) { 172 TEST(AssemblerX64XchglOperations) {
173 // Allocate an executable page of memory. 173 // Allocate an executable page of memory.
174 size_t actual_size; 174 size_t actual_size;
175 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 175 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
176 &actual_size, 176 &actual_size,
177 true)); 177 true));
178 CHECK(buffer); 178 CHECK(buffer);
179 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); 179 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size));
180 180
181 __ movq(rax, Operand(arg1, 0)); 181 __ movq(rax, Operand(arg1, 0));
182 __ movq(rbx, Operand(arg2, 0)); 182 __ movq(rdx, Operand(arg2, 0));
183 __ xchgl(rax, rbx); 183 __ xchgl(rax, rdx);
184 __ movq(Operand(arg1, 0), rax); 184 __ movq(Operand(arg1, 0), rax);
185 __ movq(Operand(arg2, 0), rbx); 185 __ movq(Operand(arg2, 0), rdx);
186 __ ret(0); 186 __ ret(0);
187 187
188 CodeDesc desc; 188 CodeDesc desc;
189 assm.GetCode(&desc); 189 assm.GetCode(&desc);
190 // Call the function from C++. 190 // Call the function from C++.
191 int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000); 191 int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
192 int64_t right = V8_2PART_UINT64_C(0x30000000, 40000000); 192 int64_t right = V8_2PART_UINT64_C(0x30000000, 40000000);
193 int64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right); 193 int64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
194 CHECK_EQ(V8_2PART_UINT64_C(0x00000000, 40000000), left); 194 CHECK_EQ(V8_2PART_UINT64_C(0x00000000, 40000000), left);
195 CHECK_EQ(V8_2PART_UINT64_C(0x00000000, 20000000), right); 195 CHECK_EQ(V8_2PART_UINT64_C(0x00000000, 20000000), right);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 size_t actual_size; 272 size_t actual_size;
273 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 273 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
274 &actual_size, 274 &actual_size,
275 true)); 275 true));
276 CHECK(buffer); 276 CHECK(buffer);
277 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size)); 277 Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size));
278 278
279 // Set rax with the ZF flag of the testl instruction. 279 // Set rax with the ZF flag of the testl instruction.
280 Label done; 280 Label done;
281 __ movq(rax, Immediate(1)); 281 __ movq(rax, Immediate(1));
282 __ movq(rbx, Operand(arg2, 0)); 282 __ movq(rdx, Operand(arg2, 0));
283 __ testl(Operand(arg1, 0), rbx); 283 __ testl(Operand(arg1, 0), rdx);
284 __ j(zero, &done, Label::kNear); 284 __ j(zero, &done, Label::kNear);
285 __ movq(rax, Immediate(0)); 285 __ movq(rax, Immediate(0));
286 __ bind(&done); 286 __ bind(&done);
287 __ ret(0); 287 __ ret(0);
288 288
289 CodeDesc desc; 289 CodeDesc desc;
290 assm.GetCode(&desc); 290 assm.GetCode(&desc);
291 // Call the function from C++. 291 // Call the function from C++.
292 int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000); 292 int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
293 int64_t right = V8_2PART_UINT64_C(0x30000000, 00000000); 293 int64_t right = V8_2PART_UINT64_C(0x30000000, 00000000);
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 Handle<Code>())->ToObjectChecked()); 706 Handle<Code>())->ToObjectChecked());
707 CHECK(code->IsCode()); 707 CHECK(code->IsCode());
708 #ifdef OBJECT_PRINT 708 #ifdef OBJECT_PRINT
709 Code::cast(code)->Print(); 709 Code::cast(code)->Print();
710 #endif 710 #endif
711 711
712 F6 f = FUNCTION_CAST<F6>(Code::cast(code)->entry()); 712 F6 f = FUNCTION_CAST<F6>(Code::cast(code)->entry());
713 CHECK_EQ(2, f(1.0, 2.0)); 713 CHECK_EQ(2, f(1.0, 2.0));
714 } 714 }
715 #undef __ 715 #undef __
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698