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

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

Issue 6794050: Revert "[Arguments] Merge (7442,7496] from bleeding_edge." (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Created 9 years, 8 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 | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-regexp.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 17 matching lines...) Expand all
28 #include <stdlib.h> 28 #include <stdlib.h>
29 29
30 #include "v8.h" 30 #include "v8.h"
31 31
32 #include "macro-assembler.h" 32 #include "macro-assembler.h"
33 #include "factory.h" 33 #include "factory.h"
34 #include "platform.h" 34 #include "platform.h"
35 #include "serialize.h" 35 #include "serialize.h"
36 #include "cctest.h" 36 #include "cctest.h"
37 37
38 using v8::internal::byte;
39 using v8::internal::OS;
38 using v8::internal::Assembler; 40 using v8::internal::Assembler;
39 using v8::internal::CodeDesc;
40 using v8::internal::Condition; 41 using v8::internal::Condition;
41 using v8::internal::FUNCTION_CAST; 42 using v8::internal::MacroAssembler;
42 using v8::internal::HandleScope; 43 using v8::internal::HandleScope;
44 using v8::internal::Operand;
43 using v8::internal::Immediate; 45 using v8::internal::Immediate;
44 using v8::internal::Isolate; 46 using v8::internal::SmiIndex;
45 using v8::internal::Label; 47 using v8::internal::Label;
46 using v8::internal::MacroAssembler;
47 using v8::internal::OS;
48 using v8::internal::Operand;
49 using v8::internal::RelocInfo; 48 using v8::internal::RelocInfo;
50 using v8::internal::Smi; 49 using v8::internal::rax;
51 using v8::internal::SmiIndex; 50 using v8::internal::rbx;
52 using v8::internal::byte; 51 using v8::internal::rsi;
53 using v8::internal::carry; 52 using v8::internal::rdi;
54 using v8::internal::greater; 53 using v8::internal::rcx;
55 using v8::internal::greater_equal; 54 using v8::internal::rdx;
56 using v8::internal::kIntSize; 55 using v8::internal::rbp;
57 using v8::internal::kPointerSize; 56 using v8::internal::rsp;
58 using v8::internal::kSmiTagMask; 57 using v8::internal::r8;
59 using v8::internal::kSmiValueSize; 58 using v8::internal::r9;
60 using v8::internal::less_equal;
61 using v8::internal::negative;
62 using v8::internal::not_carry;
63 using v8::internal::not_equal;
64 using v8::internal::not_zero;
65 using v8::internal::positive;
66 using v8::internal::r11; 59 using v8::internal::r11;
67 using v8::internal::r13; 60 using v8::internal::r13;
68 using v8::internal::r14; 61 using v8::internal::r14;
69 using v8::internal::r15; 62 using v8::internal::r15;
70 using v8::internal::r8;
71 using v8::internal::r9;
72 using v8::internal::rax;
73 using v8::internal::rbp;
74 using v8::internal::rbx;
75 using v8::internal::rcx;
76 using v8::internal::rdi;
77 using v8::internal::rdx;
78 using v8::internal::rsi;
79 using v8::internal::rsp;
80 using v8::internal::times_pointer_size; 63 using v8::internal::times_pointer_size;
64 using v8::internal::FUNCTION_CAST;
65 using v8::internal::CodeDesc;
66 using v8::internal::less_equal;
67 using v8::internal::not_equal;
68 using v8::internal::not_zero;
69 using v8::internal::greater;
70 using v8::internal::greater_equal;
71 using v8::internal::carry;
72 using v8::internal::not_carry;
73 using v8::internal::negative;
74 using v8::internal::positive;
75 using v8::internal::Smi;
76 using v8::internal::kSmiTagMask;
77 using v8::internal::kSmiValueSize;
78 using v8::internal::kPointerSize;
79 using v8::internal::kIntSize;
81 80
82 // Test the x64 assembler by compiling some simple functions into 81 // Test the x64 assembler by compiling some simple functions into
83 // a buffer and executing them. These tests do not initialize the 82 // a buffer and executing them. These tests do not initialize the
84 // V8 library, create a context, or use any V8 objects. 83 // V8 library, create a context, or use any V8 objects.
85 // The AMD64 calling convention is used, with the first five arguments 84 // The AMD64 calling convention is used, with the first five arguments
86 // in RSI, RDI, RDX, RCX, R8, and R9, and floating point arguments in 85 // in RSI, RDI, RDX, RCX, R8, and R9, and floating point arguments in
87 // the XMM registers. The return value is in RAX. 86 // the XMM registers. The return value is in RAX.
88 // This calling convention is used on Linux, with GCC, and on Mac OS, 87 // This calling convention is used on Linux, with GCC, and on Mac OS,
89 // with GCC. A different convention is used on 64-bit windows. 88 // with GCC. A different convention is used on 64-bit windows.
90 89
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Test that we can move a Smi value literally into a register. 150 // Test that we can move a Smi value literally into a register.
152 TEST(SmiMove) { 151 TEST(SmiMove) {
153 v8::internal::V8::Initialize(NULL); 152 v8::internal::V8::Initialize(NULL);
154 // Allocate an executable page of memory. 153 // Allocate an executable page of memory.
155 size_t actual_size; 154 size_t actual_size;
156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 155 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
157 &actual_size, 156 &actual_size,
158 true)); 157 true));
159 CHECK(buffer); 158 CHECK(buffer);
160 HandleScope handles; 159 HandleScope handles;
161 MacroAssembler assembler(Isolate::Current(), 160 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
162 buffer,
163 static_cast<int>(actual_size));
164 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 161 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
165 masm->set_allow_stub_calls(false); 162 masm->set_allow_stub_calls(false);
166 EntryCode(masm); 163 EntryCode(masm);
167 Label exit; 164 Label exit;
168 165
169 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); 166 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0));
170 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); 167 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127));
171 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); 168 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128));
172 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); 169 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255));
173 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); 170 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 TEST(SmiCompare) { 238 TEST(SmiCompare) {
242 v8::internal::V8::Initialize(NULL); 239 v8::internal::V8::Initialize(NULL);
243 // Allocate an executable page of memory. 240 // Allocate an executable page of memory.
244 size_t actual_size; 241 size_t actual_size;
245 byte* buffer = 242 byte* buffer =
246 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 243 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
247 &actual_size, 244 &actual_size,
248 true)); 245 true));
249 CHECK(buffer); 246 CHECK(buffer);
250 HandleScope handles; 247 HandleScope handles;
251 MacroAssembler assembler(Isolate::Current(), 248 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
252 buffer,
253 static_cast<int>(actual_size));
254 249
255 MacroAssembler* masm = &assembler; 250 MacroAssembler* masm = &assembler;
256 masm->set_allow_stub_calls(false); 251 masm->set_allow_stub_calls(false);
257 EntryCode(masm); 252 EntryCode(masm);
258 Label exit; 253 Label exit;
259 254
260 TestSmiCompare(masm, &exit, 0x10, 0, 0); 255 TestSmiCompare(masm, &exit, 0x10, 0, 0);
261 TestSmiCompare(masm, &exit, 0x20, 0, 1); 256 TestSmiCompare(masm, &exit, 0x20, 0, 1);
262 TestSmiCompare(masm, &exit, 0x30, 1, 0); 257 TestSmiCompare(masm, &exit, 0x30, 1, 0);
263 TestSmiCompare(masm, &exit, 0x40, 1, 1); 258 TestSmiCompare(masm, &exit, 0x40, 1, 1);
(...skipping 29 matching lines...) Expand all
293 288
294 TEST(Integer32ToSmi) { 289 TEST(Integer32ToSmi) {
295 v8::internal::V8::Initialize(NULL); 290 v8::internal::V8::Initialize(NULL);
296 // Allocate an executable page of memory. 291 // Allocate an executable page of memory.
297 size_t actual_size; 292 size_t actual_size;
298 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 293 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
299 &actual_size, 294 &actual_size,
300 true)); 295 true));
301 CHECK(buffer); 296 CHECK(buffer);
302 HandleScope handles; 297 HandleScope handles;
303 MacroAssembler assembler(Isolate::Current(), 298 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
304 buffer,
305 static_cast<int>(actual_size));
306 299
307 MacroAssembler* masm = &assembler; 300 MacroAssembler* masm = &assembler;
308 masm->set_allow_stub_calls(false); 301 masm->set_allow_stub_calls(false);
309 EntryCode(masm); 302 EntryCode(masm);
310 Label exit; 303 Label exit;
311 304
312 __ movq(rax, Immediate(1)); // Test number. 305 __ movq(rax, Immediate(1)); // Test number.
313 __ movl(rcx, Immediate(0)); 306 __ movl(rcx, Immediate(0));
314 __ Integer32ToSmi(rcx, rcx); 307 __ Integer32ToSmi(rcx, rcx);
315 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); 308 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 416
424 TEST(Integer64PlusConstantToSmi) { 417 TEST(Integer64PlusConstantToSmi) {
425 v8::internal::V8::Initialize(NULL); 418 v8::internal::V8::Initialize(NULL);
426 // Allocate an executable page of memory. 419 // Allocate an executable page of memory.
427 size_t actual_size; 420 size_t actual_size;
428 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 421 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
429 &actual_size, 422 &actual_size,
430 true)); 423 true));
431 CHECK(buffer); 424 CHECK(buffer);
432 HandleScope handles; 425 HandleScope handles;
433 MacroAssembler assembler(Isolate::Current(), 426 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
434 buffer,
435 static_cast<int>(actual_size));
436 427
437 MacroAssembler* masm = &assembler; 428 MacroAssembler* masm = &assembler;
438 masm->set_allow_stub_calls(false); 429 masm->set_allow_stub_calls(false);
439 EntryCode(masm); 430 EntryCode(masm);
440 Label exit; 431 Label exit;
441 432
442 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; 433 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2;
443 434
444 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0); 435 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0);
445 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1); 436 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1);
(...skipping 23 matching lines...) Expand all
469 460
470 TEST(SmiCheck) { 461 TEST(SmiCheck) {
471 v8::internal::V8::Initialize(NULL); 462 v8::internal::V8::Initialize(NULL);
472 // Allocate an executable page of memory. 463 // Allocate an executable page of memory.
473 size_t actual_size; 464 size_t actual_size;
474 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 465 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
475 &actual_size, 466 &actual_size,
476 true)); 467 true));
477 CHECK(buffer); 468 CHECK(buffer);
478 HandleScope handles; 469 HandleScope handles;
479 MacroAssembler assembler(Isolate::Current(), 470 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
480 buffer,
481 static_cast<int>(actual_size));
482 471
483 MacroAssembler* masm = &assembler; 472 MacroAssembler* masm = &assembler;
484 masm->set_allow_stub_calls(false); 473 masm->set_allow_stub_calls(false);
485 EntryCode(masm); 474 EntryCode(masm);
486 Label exit; 475 Label exit;
487 Condition cond; 476 Condition cond;
488 477
489 __ movl(rax, Immediate(1)); // Test number. 478 __ movl(rax, Immediate(1)); // Test number.
490 479
491 // CheckSmi 480 // CheckSmi
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 TEST(SmiNeg) { 708 TEST(SmiNeg) {
720 v8::internal::V8::Initialize(NULL); 709 v8::internal::V8::Initialize(NULL);
721 // Allocate an executable page of memory. 710 // Allocate an executable page of memory.
722 size_t actual_size; 711 size_t actual_size;
723 byte* buffer = 712 byte* buffer =
724 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 713 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
725 &actual_size, 714 &actual_size,
726 true)); 715 true));
727 CHECK(buffer); 716 CHECK(buffer);
728 HandleScope handles; 717 HandleScope handles;
729 MacroAssembler assembler(Isolate::Current(), 718 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
730 buffer,
731 static_cast<int>(actual_size));
732 719
733 MacroAssembler* masm = &assembler; 720 MacroAssembler* masm = &assembler;
734 masm->set_allow_stub_calls(false); 721 masm->set_allow_stub_calls(false);
735 EntryCode(masm); 722 EntryCode(masm);
736 Label exit; 723 Label exit;
737 724
738 TestSmiNeg(masm, &exit, 0x10, 0); 725 TestSmiNeg(masm, &exit, 0x10, 0);
739 TestSmiNeg(masm, &exit, 0x20, 1); 726 TestSmiNeg(masm, &exit, 0x20, 1);
740 TestSmiNeg(masm, &exit, 0x30, -1); 727 TestSmiNeg(masm, &exit, 0x30, -1);
741 TestSmiNeg(masm, &exit, 0x40, 127); 728 TestSmiNeg(masm, &exit, 0x40, 127);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 796
810 TEST(SmiAdd) { 797 TEST(SmiAdd) {
811 v8::internal::V8::Initialize(NULL); 798 v8::internal::V8::Initialize(NULL);
812 // Allocate an executable page of memory. 799 // Allocate an executable page of memory.
813 size_t actual_size; 800 size_t actual_size;
814 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 801 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
815 &actual_size, 802 &actual_size,
816 true)); 803 true));
817 CHECK(buffer); 804 CHECK(buffer);
818 HandleScope handles; 805 HandleScope handles;
819 MacroAssembler assembler(Isolate::Current(), 806 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
820 buffer,
821 static_cast<int>(actual_size));
822 807
823 MacroAssembler* masm = &assembler; 808 MacroAssembler* masm = &assembler;
824 masm->set_allow_stub_calls(false); 809 masm->set_allow_stub_calls(false);
825 EntryCode(masm); 810 EntryCode(masm);
826 Label exit; 811 Label exit;
827 812
828 // No-overflow tests. 813 // No-overflow tests.
829 SmiAddTest(masm, &exit, 0x10, 1, 2); 814 SmiAddTest(masm, &exit, 0x10, 1, 2);
830 SmiAddTest(masm, &exit, 0x20, 1, -2); 815 SmiAddTest(masm, &exit, 0x20, 1, -2);
831 SmiAddTest(masm, &exit, 0x30, -1, 2); 816 SmiAddTest(masm, &exit, 0x30, -1, 2);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 TEST(SmiSub) { 986 TEST(SmiSub) {
1002 v8::internal::V8::Initialize(NULL); 987 v8::internal::V8::Initialize(NULL);
1003 // Allocate an executable page of memory. 988 // Allocate an executable page of memory.
1004 size_t actual_size; 989 size_t actual_size;
1005 byte* buffer = 990 byte* buffer =
1006 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 991 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1007 &actual_size, 992 &actual_size,
1008 true)); 993 true));
1009 CHECK(buffer); 994 CHECK(buffer);
1010 HandleScope handles; 995 HandleScope handles;
1011 MacroAssembler assembler(Isolate::Current(), 996 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1012 buffer,
1013 static_cast<int>(actual_size));
1014 997
1015 MacroAssembler* masm = &assembler; 998 MacroAssembler* masm = &assembler;
1016 masm->set_allow_stub_calls(false); 999 masm->set_allow_stub_calls(false);
1017 EntryCode(masm); 1000 EntryCode(masm);
1018 Label exit; 1001 Label exit;
1019 1002
1020 SmiSubTest(masm, &exit, 0x10, 1, 2); 1003 SmiSubTest(masm, &exit, 0x10, 1, 2);
1021 SmiSubTest(masm, &exit, 0x20, 1, -2); 1004 SmiSubTest(masm, &exit, 0x20, 1, -2);
1022 SmiSubTest(masm, &exit, 0x30, -1, 2); 1005 SmiSubTest(masm, &exit, 0x30, -1, 2);
1023 SmiSubTest(masm, &exit, 0x40, -1, -2); 1006 SmiSubTest(masm, &exit, 0x40, -1, -2);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1076
1094 TEST(SmiMul) { 1077 TEST(SmiMul) {
1095 v8::internal::V8::Initialize(NULL); 1078 v8::internal::V8::Initialize(NULL);
1096 // Allocate an executable page of memory. 1079 // Allocate an executable page of memory.
1097 size_t actual_size; 1080 size_t actual_size;
1098 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1081 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1099 &actual_size, 1082 &actual_size,
1100 true)); 1083 true));
1101 CHECK(buffer); 1084 CHECK(buffer);
1102 HandleScope handles; 1085 HandleScope handles;
1103 MacroAssembler assembler(Isolate::Current(), 1086 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1104 buffer,
1105 static_cast<int>(actual_size));
1106 1087
1107 MacroAssembler* masm = &assembler; 1088 MacroAssembler* masm = &assembler;
1108 masm->set_allow_stub_calls(false); 1089 masm->set_allow_stub_calls(false);
1109 EntryCode(masm); 1090 EntryCode(masm);
1110 Label exit; 1091 Label exit;
1111 1092
1112 TestSmiMul(masm, &exit, 0x10, 0, 0); 1093 TestSmiMul(masm, &exit, 0x10, 0, 0);
1113 TestSmiMul(masm, &exit, 0x20, -1, 0); 1094 TestSmiMul(masm, &exit, 0x20, -1, 0);
1114 TestSmiMul(masm, &exit, 0x30, 0, -1); 1095 TestSmiMul(masm, &exit, 0x30, 0, -1);
1115 TestSmiMul(masm, &exit, 0x40, -1, -1); 1096 TestSmiMul(masm, &exit, 0x40, -1, -1);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 TEST(SmiDiv) { 1182 TEST(SmiDiv) {
1202 v8::internal::V8::Initialize(NULL); 1183 v8::internal::V8::Initialize(NULL);
1203 // Allocate an executable page of memory. 1184 // Allocate an executable page of memory.
1204 size_t actual_size; 1185 size_t actual_size;
1205 byte* buffer = 1186 byte* buffer =
1206 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1187 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1207 &actual_size, 1188 &actual_size,
1208 true)); 1189 true));
1209 CHECK(buffer); 1190 CHECK(buffer);
1210 HandleScope handles; 1191 HandleScope handles;
1211 MacroAssembler assembler(Isolate::Current(), 1192 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1212 buffer,
1213 static_cast<int>(actual_size));
1214 1193
1215 MacroAssembler* masm = &assembler; 1194 MacroAssembler* masm = &assembler;
1216 masm->set_allow_stub_calls(false); 1195 masm->set_allow_stub_calls(false);
1217 EntryCode(masm); 1196 EntryCode(masm);
1218 Label exit; 1197 Label exit;
1219 1198
1220 __ push(r14); 1199 __ push(r14);
1221 __ push(r15); 1200 __ push(r15);
1222 TestSmiDiv(masm, &exit, 0x10, 1, 1); 1201 TestSmiDiv(masm, &exit, 0x10, 1, 1);
1223 TestSmiDiv(masm, &exit, 0x20, 1, 0); 1202 TestSmiDiv(masm, &exit, 0x20, 1, 0);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 TEST(SmiMod) { 1292 TEST(SmiMod) {
1314 v8::internal::V8::Initialize(NULL); 1293 v8::internal::V8::Initialize(NULL);
1315 // Allocate an executable page of memory. 1294 // Allocate an executable page of memory.
1316 size_t actual_size; 1295 size_t actual_size;
1317 byte* buffer = 1296 byte* buffer =
1318 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1297 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1319 &actual_size, 1298 &actual_size,
1320 true)); 1299 true));
1321 CHECK(buffer); 1300 CHECK(buffer);
1322 HandleScope handles; 1301 HandleScope handles;
1323 MacroAssembler assembler(Isolate::Current(), 1302 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1324 buffer,
1325 static_cast<int>(actual_size));
1326 1303
1327 MacroAssembler* masm = &assembler; 1304 MacroAssembler* masm = &assembler;
1328 masm->set_allow_stub_calls(false); 1305 masm->set_allow_stub_calls(false);
1329 EntryCode(masm); 1306 EntryCode(masm);
1330 Label exit; 1307 Label exit;
1331 1308
1332 __ push(r14); 1309 __ push(r14);
1333 __ push(r15); 1310 __ push(r15);
1334 TestSmiMod(masm, &exit, 0x10, 1, 1); 1311 TestSmiMod(masm, &exit, 0x10, 1, 1);
1335 TestSmiMod(masm, &exit, 0x20, 1, 0); 1312 TestSmiMod(masm, &exit, 0x20, 1, 0);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 TEST(SmiIndex) { 1388 TEST(SmiIndex) {
1412 v8::internal::V8::Initialize(NULL); 1389 v8::internal::V8::Initialize(NULL);
1413 // Allocate an executable page of memory. 1390 // Allocate an executable page of memory.
1414 size_t actual_size; 1391 size_t actual_size;
1415 byte* buffer = 1392 byte* buffer =
1416 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1393 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1417 &actual_size, 1394 &actual_size,
1418 true)); 1395 true));
1419 CHECK(buffer); 1396 CHECK(buffer);
1420 HandleScope handles; 1397 HandleScope handles;
1421 MacroAssembler assembler(Isolate::Current(), 1398 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1422 buffer,
1423 static_cast<int>(actual_size));
1424 1399
1425 MacroAssembler* masm = &assembler; 1400 MacroAssembler* masm = &assembler;
1426 masm->set_allow_stub_calls(false); 1401 masm->set_allow_stub_calls(false);
1427 EntryCode(masm); 1402 EntryCode(masm);
1428 Label exit; 1403 Label exit;
1429 1404
1430 TestSmiIndex(masm, &exit, 0x10, 0); 1405 TestSmiIndex(masm, &exit, 0x10, 0);
1431 TestSmiIndex(masm, &exit, 0x20, 1); 1406 TestSmiIndex(masm, &exit, 0x20, 1);
1432 TestSmiIndex(masm, &exit, 0x30, 100); 1407 TestSmiIndex(masm, &exit, 0x30, 100);
1433 TestSmiIndex(masm, &exit, 0x40, 1000); 1408 TestSmiIndex(masm, &exit, 0x40, 1000);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 TEST(SmiSelectNonSmi) { 1457 TEST(SmiSelectNonSmi) {
1483 v8::internal::V8::Initialize(NULL); 1458 v8::internal::V8::Initialize(NULL);
1484 // Allocate an executable page of memory. 1459 // Allocate an executable page of memory.
1485 size_t actual_size; 1460 size_t actual_size;
1486 byte* buffer = 1461 byte* buffer =
1487 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1462 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1488 &actual_size, 1463 &actual_size,
1489 true)); 1464 true));
1490 CHECK(buffer); 1465 CHECK(buffer);
1491 HandleScope handles; 1466 HandleScope handles;
1492 MacroAssembler assembler(Isolate::Current(), 1467 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1493 buffer,
1494 static_cast<int>(actual_size));
1495 1468
1496 MacroAssembler* masm = &assembler; 1469 MacroAssembler* masm = &assembler;
1497 masm->set_allow_stub_calls(false); // Avoid inline checks. 1470 masm->set_allow_stub_calls(false); // Avoid inline checks.
1498 EntryCode(masm); 1471 EntryCode(masm);
1499 Label exit; 1472 Label exit;
1500 1473
1501 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); 1474 TestSelectNonSmi(masm, &exit, 0x10, 0, 0);
1502 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); 1475 TestSelectNonSmi(masm, &exit, 0x20, 0, 1);
1503 TestSelectNonSmi(masm, &exit, 0x30, 1, 0); 1476 TestSelectNonSmi(masm, &exit, 0x30, 1, 0);
1504 TestSelectNonSmi(masm, &exit, 0x40, 0, -1); 1477 TestSelectNonSmi(masm, &exit, 0x40, 0, -1);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 TEST(SmiAnd) { 1536 TEST(SmiAnd) {
1564 v8::internal::V8::Initialize(NULL); 1537 v8::internal::V8::Initialize(NULL);
1565 // Allocate an executable page of memory. 1538 // Allocate an executable page of memory.
1566 size_t actual_size; 1539 size_t actual_size;
1567 byte* buffer = 1540 byte* buffer =
1568 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1541 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1569 &actual_size, 1542 &actual_size,
1570 true)); 1543 true));
1571 CHECK(buffer); 1544 CHECK(buffer);
1572 HandleScope handles; 1545 HandleScope handles;
1573 MacroAssembler assembler(Isolate::Current(), 1546 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1574 buffer,
1575 static_cast<int>(actual_size));
1576 1547
1577 MacroAssembler* masm = &assembler; 1548 MacroAssembler* masm = &assembler;
1578 masm->set_allow_stub_calls(false); 1549 masm->set_allow_stub_calls(false);
1579 EntryCode(masm); 1550 EntryCode(masm);
1580 Label exit; 1551 Label exit;
1581 1552
1582 TestSmiAnd(masm, &exit, 0x10, 0, 0); 1553 TestSmiAnd(masm, &exit, 0x10, 0, 0);
1583 TestSmiAnd(masm, &exit, 0x20, 0, 1); 1554 TestSmiAnd(masm, &exit, 0x20, 0, 1);
1584 TestSmiAnd(masm, &exit, 0x30, 1, 0); 1555 TestSmiAnd(masm, &exit, 0x30, 1, 0);
1585 TestSmiAnd(masm, &exit, 0x40, 0, -1); 1556 TestSmiAnd(masm, &exit, 0x40, 0, -1);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 TEST(SmiOr) { 1617 TEST(SmiOr) {
1647 v8::internal::V8::Initialize(NULL); 1618 v8::internal::V8::Initialize(NULL);
1648 // Allocate an executable page of memory. 1619 // Allocate an executable page of memory.
1649 size_t actual_size; 1620 size_t actual_size;
1650 byte* buffer = 1621 byte* buffer =
1651 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1622 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1652 &actual_size, 1623 &actual_size,
1653 true)); 1624 true));
1654 CHECK(buffer); 1625 CHECK(buffer);
1655 HandleScope handles; 1626 HandleScope handles;
1656 MacroAssembler assembler(Isolate::Current(), 1627 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1657 buffer,
1658 static_cast<int>(actual_size));
1659 1628
1660 MacroAssembler* masm = &assembler; 1629 MacroAssembler* masm = &assembler;
1661 masm->set_allow_stub_calls(false); 1630 masm->set_allow_stub_calls(false);
1662 EntryCode(masm); 1631 EntryCode(masm);
1663 Label exit; 1632 Label exit;
1664 1633
1665 TestSmiOr(masm, &exit, 0x10, 0, 0); 1634 TestSmiOr(masm, &exit, 0x10, 0, 0);
1666 TestSmiOr(masm, &exit, 0x20, 0, 1); 1635 TestSmiOr(masm, &exit, 0x20, 0, 1);
1667 TestSmiOr(masm, &exit, 0x30, 1, 0); 1636 TestSmiOr(masm, &exit, 0x30, 1, 0);
1668 TestSmiOr(masm, &exit, 0x40, 0, -1); 1637 TestSmiOr(masm, &exit, 0x40, 0, -1);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 TEST(SmiXor) { 1700 TEST(SmiXor) {
1732 v8::internal::V8::Initialize(NULL); 1701 v8::internal::V8::Initialize(NULL);
1733 // Allocate an executable page of memory. 1702 // Allocate an executable page of memory.
1734 size_t actual_size; 1703 size_t actual_size;
1735 byte* buffer = 1704 byte* buffer =
1736 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1705 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1737 &actual_size, 1706 &actual_size,
1738 true)); 1707 true));
1739 CHECK(buffer); 1708 CHECK(buffer);
1740 HandleScope handles; 1709 HandleScope handles;
1741 MacroAssembler assembler(Isolate::Current(), 1710 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1742 buffer,
1743 static_cast<int>(actual_size));
1744 1711
1745 MacroAssembler* masm = &assembler; 1712 MacroAssembler* masm = &assembler;
1746 masm->set_allow_stub_calls(false); 1713 masm->set_allow_stub_calls(false);
1747 EntryCode(masm); 1714 EntryCode(masm);
1748 Label exit; 1715 Label exit;
1749 1716
1750 TestSmiXor(masm, &exit, 0x10, 0, 0); 1717 TestSmiXor(masm, &exit, 0x10, 0, 0);
1751 TestSmiXor(masm, &exit, 0x20, 0, 1); 1718 TestSmiXor(masm, &exit, 0x20, 0, 1);
1752 TestSmiXor(masm, &exit, 0x30, 1, 0); 1719 TestSmiXor(masm, &exit, 0x30, 1, 0);
1753 TestSmiXor(masm, &exit, 0x40, 0, -1); 1720 TestSmiXor(masm, &exit, 0x40, 0, -1);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 TEST(SmiNot) { 1767 TEST(SmiNot) {
1801 v8::internal::V8::Initialize(NULL); 1768 v8::internal::V8::Initialize(NULL);
1802 // Allocate an executable page of memory. 1769 // Allocate an executable page of memory.
1803 size_t actual_size; 1770 size_t actual_size;
1804 byte* buffer = 1771 byte* buffer =
1805 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1772 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1806 &actual_size, 1773 &actual_size,
1807 true)); 1774 true));
1808 CHECK(buffer); 1775 CHECK(buffer);
1809 HandleScope handles; 1776 HandleScope handles;
1810 MacroAssembler assembler(Isolate::Current(), 1777 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1811 buffer,
1812 static_cast<int>(actual_size));
1813 1778
1814 MacroAssembler* masm = &assembler; 1779 MacroAssembler* masm = &assembler;
1815 masm->set_allow_stub_calls(false); 1780 masm->set_allow_stub_calls(false);
1816 EntryCode(masm); 1781 EntryCode(masm);
1817 Label exit; 1782 Label exit;
1818 1783
1819 TestSmiNot(masm, &exit, 0x10, 0); 1784 TestSmiNot(masm, &exit, 0x10, 0);
1820 TestSmiNot(masm, &exit, 0x20, 1); 1785 TestSmiNot(masm, &exit, 0x20, 1);
1821 TestSmiNot(masm, &exit, 0x30, -1); 1786 TestSmiNot(masm, &exit, 0x30, -1);
1822 TestSmiNot(masm, &exit, 0x40, 127); 1787 TestSmiNot(masm, &exit, 0x40, 127);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 TEST(SmiShiftLeft) { 1863 TEST(SmiShiftLeft) {
1899 v8::internal::V8::Initialize(NULL); 1864 v8::internal::V8::Initialize(NULL);
1900 // Allocate an executable page of memory. 1865 // Allocate an executable page of memory.
1901 size_t actual_size; 1866 size_t actual_size;
1902 byte* buffer = 1867 byte* buffer =
1903 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 1868 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
1904 &actual_size, 1869 &actual_size,
1905 true)); 1870 true));
1906 CHECK(buffer); 1871 CHECK(buffer);
1907 HandleScope handles; 1872 HandleScope handles;
1908 MacroAssembler assembler(Isolate::Current(), 1873 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1909 buffer,
1910 static_cast<int>(actual_size));
1911 1874
1912 MacroAssembler* masm = &assembler; 1875 MacroAssembler* masm = &assembler;
1913 masm->set_allow_stub_calls(false); 1876 masm->set_allow_stub_calls(false);
1914 EntryCode(masm); 1877 EntryCode(masm);
1915 Label exit; 1878 Label exit;
1916 1879
1917 TestSmiShiftLeft(masm, &exit, 0x10, 0); 1880 TestSmiShiftLeft(masm, &exit, 0x10, 0);
1918 TestSmiShiftLeft(masm, &exit, 0x50, 1); 1881 TestSmiShiftLeft(masm, &exit, 0x50, 1);
1919 TestSmiShiftLeft(masm, &exit, 0x90, 127); 1882 TestSmiShiftLeft(masm, &exit, 0x90, 127);
1920 TestSmiShiftLeft(masm, &exit, 0xD0, 65535); 1883 TestSmiShiftLeft(masm, &exit, 0xD0, 65535);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 TEST(SmiShiftLogicalRight) { 1969 TEST(SmiShiftLogicalRight) {
2007 v8::internal::V8::Initialize(NULL); 1970 v8::internal::V8::Initialize(NULL);
2008 // Allocate an executable page of memory. 1971 // Allocate an executable page of memory.
2009 size_t actual_size; 1972 size_t actual_size;
2010 byte* buffer = 1973 byte* buffer =
2011 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1974 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
2012 &actual_size, 1975 &actual_size,
2013 true)); 1976 true));
2014 CHECK(buffer); 1977 CHECK(buffer);
2015 HandleScope handles; 1978 HandleScope handles;
2016 MacroAssembler assembler(Isolate::Current(), 1979 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2017 buffer,
2018 static_cast<int>(actual_size));
2019 1980
2020 MacroAssembler* masm = &assembler; 1981 MacroAssembler* masm = &assembler;
2021 masm->set_allow_stub_calls(false); 1982 masm->set_allow_stub_calls(false);
2022 EntryCode(masm); 1983 EntryCode(masm);
2023 Label exit; 1984 Label exit;
2024 1985
2025 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); 1986 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0);
2026 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); 1987 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1);
2027 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127); 1988 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127);
2028 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535); 1989 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 TEST(SmiShiftArithmeticRight) { 2038 TEST(SmiShiftArithmeticRight) {
2078 v8::internal::V8::Initialize(NULL); 2039 v8::internal::V8::Initialize(NULL);
2079 // Allocate an executable page of memory. 2040 // Allocate an executable page of memory.
2080 size_t actual_size; 2041 size_t actual_size;
2081 byte* buffer = 2042 byte* buffer =
2082 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2043 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2083 &actual_size, 2044 &actual_size,
2084 true)); 2045 true));
2085 CHECK(buffer); 2046 CHECK(buffer);
2086 HandleScope handles; 2047 HandleScope handles;
2087 MacroAssembler assembler(Isolate::Current(), 2048 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2088 buffer,
2089 static_cast<int>(actual_size));
2090 2049
2091 MacroAssembler* masm = &assembler; 2050 MacroAssembler* masm = &assembler;
2092 masm->set_allow_stub_calls(false); 2051 masm->set_allow_stub_calls(false);
2093 EntryCode(masm); 2052 EntryCode(masm);
2094 Label exit; 2053 Label exit;
2095 2054
2096 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); 2055 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0);
2097 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); 2056 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1);
2098 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127); 2057 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127);
2099 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535); 2058 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { 2102 TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
2144 v8::internal::V8::Initialize(NULL); 2103 v8::internal::V8::Initialize(NULL);
2145 // Allocate an executable page of memory. 2104 // Allocate an executable page of memory.
2146 size_t actual_size; 2105 size_t actual_size;
2147 byte* buffer = 2106 byte* buffer =
2148 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 2107 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
2149 &actual_size, 2108 &actual_size,
2150 true)); 2109 true));
2151 CHECK(buffer); 2110 CHECK(buffer);
2152 HandleScope handles; 2111 HandleScope handles;
2153 MacroAssembler assembler(Isolate::Current(), 2112 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2154 buffer,
2155 static_cast<int>(actual_size));
2156 2113
2157 MacroAssembler* masm = &assembler; 2114 MacroAssembler* masm = &assembler;
2158 masm->set_allow_stub_calls(false); 2115 masm->set_allow_stub_calls(false);
2159 EntryCode(masm); 2116 EntryCode(masm);
2160 Label exit; 2117 Label exit;
2161 2118
2162 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); 2119 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0);
2163 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); 2120 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1);
2164 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127); 2121 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127);
2165 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128); 2122 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128);
(...skipping 22 matching lines...) Expand all
2188 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } 2145 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; }
2189 2146
2190 // Allocate an executable page of memory. 2147 // Allocate an executable page of memory.
2191 size_t actual_size; 2148 size_t actual_size;
2192 byte* buffer = 2149 byte* buffer =
2193 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2150 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2194 &actual_size, 2151 &actual_size,
2195 true)); 2152 true));
2196 CHECK(buffer); 2153 CHECK(buffer);
2197 HandleScope handles; 2154 HandleScope handles;
2198 MacroAssembler assembler(Isolate::Current(), 2155 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2199 buffer,
2200 static_cast<int>(actual_size));
2201 2156
2202 MacroAssembler* masm = &assembler; 2157 MacroAssembler* masm = &assembler;
2203 masm->set_allow_stub_calls(false); 2158 masm->set_allow_stub_calls(false);
2204 Label exit; 2159 Label exit;
2205 2160
2206 EntryCode(masm); 2161 EntryCode(masm);
2207 __ push(r13); 2162 __ push(r13);
2208 __ push(r14); 2163 __ push(r14);
2209 __ push(rbx); 2164 __ push(rbx);
2210 __ push(rbp); 2165 __ push(rbp);
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 CodeDesc desc; 2490 CodeDesc desc;
2536 masm->GetCode(&desc); 2491 masm->GetCode(&desc);
2537 // Call the function from C++. 2492 // Call the function from C++.
2538 int result = FUNCTION_CAST<F0>(buffer)(); 2493 int result = FUNCTION_CAST<F0>(buffer)();
2539 CHECK_EQ(0, result); 2494 CHECK_EQ(0, result);
2540 } 2495 }
2541 2496
2542 2497
2543 2498
2544 #undef __ 2499 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698