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

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

Issue 12254007: Make the Isolate parameter mandatory for internal HandleScopes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 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 | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-parsing.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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 // Test that we can move a Smi value literally into a register. 151 // Test that we can move a Smi value literally into a register.
152 TEST(SmiMove) { 152 TEST(SmiMove) {
153 v8::internal::V8::Initialize(NULL); 153 v8::internal::V8::Initialize(NULL);
154 // Allocate an executable page of memory. 154 // Allocate an executable page of memory.
155 size_t actual_size; 155 size_t actual_size;
156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
157 &actual_size, 157 &actual_size,
158 true)); 158 true));
159 CHECK(buffer); 159 CHECK(buffer);
160 HandleScope handles; 160 Isolate* isolate = Isolate::Current();
161 MacroAssembler assembler(Isolate::Current(), 161 HandleScope handles(isolate);
162 buffer, 162 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
163 static_cast<int>(actual_size));
164 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 163 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
165 masm->set_allow_stub_calls(false); 164 masm->set_allow_stub_calls(false);
166 EntryCode(masm); 165 EntryCode(masm);
167 Label exit; 166 Label exit;
168 167
169 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); 168 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0));
170 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); 169 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127));
171 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); 170 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128));
172 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); 171 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255));
173 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); 172 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Test that we can compare smis for equality (and more). 239 // Test that we can compare smis for equality (and more).
241 TEST(SmiCompare) { 240 TEST(SmiCompare) {
242 v8::internal::V8::Initialize(NULL); 241 v8::internal::V8::Initialize(NULL);
243 // Allocate an executable page of memory. 242 // Allocate an executable page of memory.
244 size_t actual_size; 243 size_t actual_size;
245 byte* buffer = 244 byte* buffer =
246 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 245 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
247 &actual_size, 246 &actual_size,
248 true)); 247 true));
249 CHECK(buffer); 248 CHECK(buffer);
250 HandleScope handles; 249 Isolate* isolate = Isolate::Current();
251 MacroAssembler assembler(Isolate::Current(), 250 HandleScope handles(isolate);
252 buffer, 251 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
253 static_cast<int>(actual_size));
254 252
255 MacroAssembler* masm = &assembler; 253 MacroAssembler* masm = &assembler;
256 masm->set_allow_stub_calls(false); 254 masm->set_allow_stub_calls(false);
257 EntryCode(masm); 255 EntryCode(masm);
258 Label exit; 256 Label exit;
259 257
260 TestSmiCompare(masm, &exit, 0x10, 0, 0); 258 TestSmiCompare(masm, &exit, 0x10, 0, 0);
261 TestSmiCompare(masm, &exit, 0x20, 0, 1); 259 TestSmiCompare(masm, &exit, 0x20, 0, 1);
262 TestSmiCompare(masm, &exit, 0x30, 1, 0); 260 TestSmiCompare(masm, &exit, 0x30, 1, 0);
263 TestSmiCompare(masm, &exit, 0x40, 1, 1); 261 TestSmiCompare(masm, &exit, 0x40, 1, 1);
(...skipping 28 matching lines...) Expand all
292 290
293 291
294 TEST(Integer32ToSmi) { 292 TEST(Integer32ToSmi) {
295 v8::internal::V8::Initialize(NULL); 293 v8::internal::V8::Initialize(NULL);
296 // Allocate an executable page of memory. 294 // Allocate an executable page of memory.
297 size_t actual_size; 295 size_t actual_size;
298 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 296 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
299 &actual_size, 297 &actual_size,
300 true)); 298 true));
301 CHECK(buffer); 299 CHECK(buffer);
302 HandleScope handles; 300 Isolate* isolate = Isolate::Current();
303 MacroAssembler assembler(Isolate::Current(), 301 HandleScope handles(isolate);
304 buffer, 302 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
305 static_cast<int>(actual_size));
306 303
307 MacroAssembler* masm = &assembler; 304 MacroAssembler* masm = &assembler;
308 masm->set_allow_stub_calls(false); 305 masm->set_allow_stub_calls(false);
309 EntryCode(masm); 306 EntryCode(masm);
310 Label exit; 307 Label exit;
311 308
312 __ movq(rax, Immediate(1)); // Test number. 309 __ movq(rax, Immediate(1)); // Test number.
313 __ movl(rcx, Immediate(0)); 310 __ movl(rcx, Immediate(0));
314 __ Integer32ToSmi(rcx, rcx); 311 __ Integer32ToSmi(rcx, rcx);
315 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); 312 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 419
423 420
424 TEST(Integer64PlusConstantToSmi) { 421 TEST(Integer64PlusConstantToSmi) {
425 v8::internal::V8::Initialize(NULL); 422 v8::internal::V8::Initialize(NULL);
426 // Allocate an executable page of memory. 423 // Allocate an executable page of memory.
427 size_t actual_size; 424 size_t actual_size;
428 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 425 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
429 &actual_size, 426 &actual_size,
430 true)); 427 true));
431 CHECK(buffer); 428 CHECK(buffer);
432 HandleScope handles; 429 Isolate* isolate = Isolate::Current();
433 MacroAssembler assembler(Isolate::Current(), 430 HandleScope handles(isolate);
434 buffer, 431 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
435 static_cast<int>(actual_size));
436 432
437 MacroAssembler* masm = &assembler; 433 MacroAssembler* masm = &assembler;
438 masm->set_allow_stub_calls(false); 434 masm->set_allow_stub_calls(false);
439 EntryCode(masm); 435 EntryCode(masm);
440 Label exit; 436 Label exit;
441 437
442 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; 438 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2;
443 439
444 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0); 440 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0);
445 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1); 441 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1);
(...skipping 22 matching lines...) Expand all
468 464
469 465
470 TEST(SmiCheck) { 466 TEST(SmiCheck) {
471 v8::internal::V8::Initialize(NULL); 467 v8::internal::V8::Initialize(NULL);
472 // Allocate an executable page of memory. 468 // Allocate an executable page of memory.
473 size_t actual_size; 469 size_t actual_size;
474 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 470 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
475 &actual_size, 471 &actual_size,
476 true)); 472 true));
477 CHECK(buffer); 473 CHECK(buffer);
478 HandleScope handles; 474 Isolate* isolate = Isolate::Current();
479 MacroAssembler assembler(Isolate::Current(), 475 HandleScope handles(isolate);
480 buffer, 476 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
481 static_cast<int>(actual_size));
482 477
483 MacroAssembler* masm = &assembler; 478 MacroAssembler* masm = &assembler;
484 masm->set_allow_stub_calls(false); 479 masm->set_allow_stub_calls(false);
485 EntryCode(masm); 480 EntryCode(masm);
486 Label exit; 481 Label exit;
487 Condition cond; 482 Condition cond;
488 483
489 __ movl(rax, Immediate(1)); // Test number. 484 __ movl(rax, Immediate(1)); // Test number.
490 485
491 // CheckSmi 486 // CheckSmi
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 713
719 TEST(SmiNeg) { 714 TEST(SmiNeg) {
720 v8::internal::V8::Initialize(NULL); 715 v8::internal::V8::Initialize(NULL);
721 // Allocate an executable page of memory. 716 // Allocate an executable page of memory.
722 size_t actual_size; 717 size_t actual_size;
723 byte* buffer = 718 byte* buffer =
724 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 719 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
725 &actual_size, 720 &actual_size,
726 true)); 721 true));
727 CHECK(buffer); 722 CHECK(buffer);
728 HandleScope handles; 723 Isolate* isolate = Isolate::Current();
729 MacroAssembler assembler(Isolate::Current(), 724 HandleScope handles(isolate);
730 buffer, 725 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
731 static_cast<int>(actual_size));
732 726
733 MacroAssembler* masm = &assembler; 727 MacroAssembler* masm = &assembler;
734 masm->set_allow_stub_calls(false); 728 masm->set_allow_stub_calls(false);
735 EntryCode(masm); 729 EntryCode(masm);
736 Label exit; 730 Label exit;
737 731
738 TestSmiNeg(masm, &exit, 0x10, 0); 732 TestSmiNeg(masm, &exit, 0x10, 0);
739 TestSmiNeg(masm, &exit, 0x20, 1); 733 TestSmiNeg(masm, &exit, 0x20, 1);
740 TestSmiNeg(masm, &exit, 0x30, -1); 734 TestSmiNeg(masm, &exit, 0x30, -1);
741 TestSmiNeg(masm, &exit, 0x40, 127); 735 TestSmiNeg(masm, &exit, 0x40, 127);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 } 802 }
809 803
810 TEST(SmiAdd) { 804 TEST(SmiAdd) {
811 v8::internal::V8::Initialize(NULL); 805 v8::internal::V8::Initialize(NULL);
812 // Allocate an executable page of memory. 806 // Allocate an executable page of memory.
813 size_t actual_size; 807 size_t actual_size;
814 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 808 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
815 &actual_size, 809 &actual_size,
816 true)); 810 true));
817 CHECK(buffer); 811 CHECK(buffer);
818 HandleScope handles; 812 Isolate* isolate = Isolate::Current();
819 MacroAssembler assembler(Isolate::Current(), 813 HandleScope handles(isolate);
820 buffer, 814 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
821 static_cast<int>(actual_size));
822 815
823 MacroAssembler* masm = &assembler; 816 MacroAssembler* masm = &assembler;
824 masm->set_allow_stub_calls(false); 817 masm->set_allow_stub_calls(false);
825 EntryCode(masm); 818 EntryCode(masm);
826 Label exit; 819 Label exit;
827 820
828 // No-overflow tests. 821 // No-overflow tests.
829 SmiAddTest(masm, &exit, 0x10, 1, 2); 822 SmiAddTest(masm, &exit, 0x10, 1, 2);
830 SmiAddTest(masm, &exit, 0x20, 1, -2); 823 SmiAddTest(masm, &exit, 0x20, 1, -2);
831 SmiAddTest(masm, &exit, 0x30, -1, 2); 824 SmiAddTest(masm, &exit, 0x30, -1, 2);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 993
1001 TEST(SmiSub) { 994 TEST(SmiSub) {
1002 v8::internal::V8::Initialize(NULL); 995 v8::internal::V8::Initialize(NULL);
1003 // Allocate an executable page of memory. 996 // Allocate an executable page of memory.
1004 size_t actual_size; 997 size_t actual_size;
1005 byte* buffer = 998 byte* buffer =
1006 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 999 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1007 &actual_size, 1000 &actual_size,
1008 true)); 1001 true));
1009 CHECK(buffer); 1002 CHECK(buffer);
1010 HandleScope handles; 1003 Isolate* isolate = Isolate::Current();
1011 MacroAssembler assembler(Isolate::Current(), 1004 HandleScope handles(isolate);
1012 buffer, 1005 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1013 static_cast<int>(actual_size));
1014 1006
1015 MacroAssembler* masm = &assembler; 1007 MacroAssembler* masm = &assembler;
1016 masm->set_allow_stub_calls(false); 1008 masm->set_allow_stub_calls(false);
1017 EntryCode(masm); 1009 EntryCode(masm);
1018 Label exit; 1010 Label exit;
1019 1011
1020 SmiSubTest(masm, &exit, 0x10, 1, 2); 1012 SmiSubTest(masm, &exit, 0x10, 1, 2);
1021 SmiSubTest(masm, &exit, 0x20, 1, -2); 1013 SmiSubTest(masm, &exit, 0x20, 1, -2);
1022 SmiSubTest(masm, &exit, 0x30, -1, 2); 1014 SmiSubTest(masm, &exit, 0x30, -1, 2);
1023 SmiSubTest(masm, &exit, 0x40, -1, -2); 1015 SmiSubTest(masm, &exit, 0x40, -1, -2);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 1084
1093 1085
1094 TEST(SmiMul) { 1086 TEST(SmiMul) {
1095 v8::internal::V8::Initialize(NULL); 1087 v8::internal::V8::Initialize(NULL);
1096 // Allocate an executable page of memory. 1088 // Allocate an executable page of memory.
1097 size_t actual_size; 1089 size_t actual_size;
1098 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1090 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1099 &actual_size, 1091 &actual_size,
1100 true)); 1092 true));
1101 CHECK(buffer); 1093 CHECK(buffer);
1102 HandleScope handles; 1094 Isolate* isolate = Isolate::Current();
1103 MacroAssembler assembler(Isolate::Current(), 1095 HandleScope handles(isolate);
1104 buffer, 1096 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1105 static_cast<int>(actual_size));
1106 1097
1107 MacroAssembler* masm = &assembler; 1098 MacroAssembler* masm = &assembler;
1108 masm->set_allow_stub_calls(false); 1099 masm->set_allow_stub_calls(false);
1109 EntryCode(masm); 1100 EntryCode(masm);
1110 Label exit; 1101 Label exit;
1111 1102
1112 TestSmiMul(masm, &exit, 0x10, 0, 0); 1103 TestSmiMul(masm, &exit, 0x10, 0, 0);
1113 TestSmiMul(masm, &exit, 0x20, -1, 0); 1104 TestSmiMul(masm, &exit, 0x20, -1, 0);
1114 TestSmiMul(masm, &exit, 0x30, 0, -1); 1105 TestSmiMul(masm, &exit, 0x30, 0, -1);
1115 TestSmiMul(masm, &exit, 0x40, -1, -1); 1106 TestSmiMul(masm, &exit, 0x40, -1, -1);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 1191
1201 TEST(SmiDiv) { 1192 TEST(SmiDiv) {
1202 v8::internal::V8::Initialize(NULL); 1193 v8::internal::V8::Initialize(NULL);
1203 // Allocate an executable page of memory. 1194 // Allocate an executable page of memory.
1204 size_t actual_size; 1195 size_t actual_size;
1205 byte* buffer = 1196 byte* buffer =
1206 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1197 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1207 &actual_size, 1198 &actual_size,
1208 true)); 1199 true));
1209 CHECK(buffer); 1200 CHECK(buffer);
1210 HandleScope handles; 1201 Isolate* isolate = Isolate::Current();
1211 MacroAssembler assembler(Isolate::Current(), 1202 HandleScope handles(isolate);
1212 buffer, 1203 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1213 static_cast<int>(actual_size));
1214 1204
1215 MacroAssembler* masm = &assembler; 1205 MacroAssembler* masm = &assembler;
1216 masm->set_allow_stub_calls(false); 1206 masm->set_allow_stub_calls(false);
1217 EntryCode(masm); 1207 EntryCode(masm);
1218 Label exit; 1208 Label exit;
1219 1209
1220 __ push(r14); 1210 __ push(r14);
1221 __ push(r15); 1211 __ push(r15);
1222 TestSmiDiv(masm, &exit, 0x10, 1, 1); 1212 TestSmiDiv(masm, &exit, 0x10, 1, 1);
1223 TestSmiDiv(masm, &exit, 0x20, 1, 0); 1213 TestSmiDiv(masm, &exit, 0x20, 1, 0);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 1302
1313 TEST(SmiMod) { 1303 TEST(SmiMod) {
1314 v8::internal::V8::Initialize(NULL); 1304 v8::internal::V8::Initialize(NULL);
1315 // Allocate an executable page of memory. 1305 // Allocate an executable page of memory.
1316 size_t actual_size; 1306 size_t actual_size;
1317 byte* buffer = 1307 byte* buffer =
1318 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1308 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1319 &actual_size, 1309 &actual_size,
1320 true)); 1310 true));
1321 CHECK(buffer); 1311 CHECK(buffer);
1322 HandleScope handles; 1312 Isolate* isolate = Isolate::Current();
1323 MacroAssembler assembler(Isolate::Current(), 1313 HandleScope handles(isolate);
1324 buffer, 1314 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1325 static_cast<int>(actual_size));
1326 1315
1327 MacroAssembler* masm = &assembler; 1316 MacroAssembler* masm = &assembler;
1328 masm->set_allow_stub_calls(false); 1317 masm->set_allow_stub_calls(false);
1329 EntryCode(masm); 1318 EntryCode(masm);
1330 Label exit; 1319 Label exit;
1331 1320
1332 __ push(r14); 1321 __ push(r14);
1333 __ push(r15); 1322 __ push(r15);
1334 TestSmiMod(masm, &exit, 0x10, 1, 1); 1323 TestSmiMod(masm, &exit, 0x10, 1, 1);
1335 TestSmiMod(masm, &exit, 0x20, 1, 0); 1324 TestSmiMod(masm, &exit, 0x20, 1, 0);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1399
1411 TEST(SmiIndex) { 1400 TEST(SmiIndex) {
1412 v8::internal::V8::Initialize(NULL); 1401 v8::internal::V8::Initialize(NULL);
1413 // Allocate an executable page of memory. 1402 // Allocate an executable page of memory.
1414 size_t actual_size; 1403 size_t actual_size;
1415 byte* buffer = 1404 byte* buffer =
1416 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1405 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1417 &actual_size, 1406 &actual_size,
1418 true)); 1407 true));
1419 CHECK(buffer); 1408 CHECK(buffer);
1420 HandleScope handles; 1409 Isolate* isolate = Isolate::Current();
1421 MacroAssembler assembler(Isolate::Current(), 1410 HandleScope handles(isolate);
1422 buffer, 1411 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1423 static_cast<int>(actual_size));
1424 1412
1425 MacroAssembler* masm = &assembler; 1413 MacroAssembler* masm = &assembler;
1426 masm->set_allow_stub_calls(false); 1414 masm->set_allow_stub_calls(false);
1427 EntryCode(masm); 1415 EntryCode(masm);
1428 Label exit; 1416 Label exit;
1429 1417
1430 TestSmiIndex(masm, &exit, 0x10, 0); 1418 TestSmiIndex(masm, &exit, 0x10, 0);
1431 TestSmiIndex(masm, &exit, 0x20, 1); 1419 TestSmiIndex(masm, &exit, 0x20, 1);
1432 TestSmiIndex(masm, &exit, 0x30, 100); 1420 TestSmiIndex(masm, &exit, 0x30, 100);
1433 TestSmiIndex(masm, &exit, 0x40, 1000); 1421 TestSmiIndex(masm, &exit, 0x40, 1000);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 1469
1482 TEST(SmiSelectNonSmi) { 1470 TEST(SmiSelectNonSmi) {
1483 v8::internal::V8::Initialize(NULL); 1471 v8::internal::V8::Initialize(NULL);
1484 // Allocate an executable page of memory. 1472 // Allocate an executable page of memory.
1485 size_t actual_size; 1473 size_t actual_size;
1486 byte* buffer = 1474 byte* buffer =
1487 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1475 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1488 &actual_size, 1476 &actual_size,
1489 true)); 1477 true));
1490 CHECK(buffer); 1478 CHECK(buffer);
1491 HandleScope handles; 1479 Isolate* isolate = Isolate::Current();
1492 MacroAssembler assembler(Isolate::Current(), 1480 HandleScope handles(isolate);
1493 buffer, 1481 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1494 static_cast<int>(actual_size));
1495 1482
1496 MacroAssembler* masm = &assembler; 1483 MacroAssembler* masm = &assembler;
1497 masm->set_allow_stub_calls(false); // Avoid inline checks. 1484 masm->set_allow_stub_calls(false); // Avoid inline checks.
1498 EntryCode(masm); 1485 EntryCode(masm);
1499 Label exit; 1486 Label exit;
1500 1487
1501 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); 1488 TestSelectNonSmi(masm, &exit, 0x10, 0, 0);
1502 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); 1489 TestSelectNonSmi(masm, &exit, 0x20, 0, 1);
1503 TestSelectNonSmi(masm, &exit, 0x30, 1, 0); 1490 TestSelectNonSmi(masm, &exit, 0x30, 1, 0);
1504 TestSelectNonSmi(masm, &exit, 0x40, 0, -1); 1491 TestSelectNonSmi(masm, &exit, 0x40, 0, -1);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1549
1563 TEST(SmiAnd) { 1550 TEST(SmiAnd) {
1564 v8::internal::V8::Initialize(NULL); 1551 v8::internal::V8::Initialize(NULL);
1565 // Allocate an executable page of memory. 1552 // Allocate an executable page of memory.
1566 size_t actual_size; 1553 size_t actual_size;
1567 byte* buffer = 1554 byte* buffer =
1568 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1555 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1569 &actual_size, 1556 &actual_size,
1570 true)); 1557 true));
1571 CHECK(buffer); 1558 CHECK(buffer);
1572 HandleScope handles; 1559 Isolate* isolate = Isolate::Current();
1573 MacroAssembler assembler(Isolate::Current(), 1560 HandleScope handles(isolate);
1574 buffer, 1561 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1575 static_cast<int>(actual_size));
1576 1562
1577 MacroAssembler* masm = &assembler; 1563 MacroAssembler* masm = &assembler;
1578 masm->set_allow_stub_calls(false); 1564 masm->set_allow_stub_calls(false);
1579 EntryCode(masm); 1565 EntryCode(masm);
1580 Label exit; 1566 Label exit;
1581 1567
1582 TestSmiAnd(masm, &exit, 0x10, 0, 0); 1568 TestSmiAnd(masm, &exit, 0x10, 0, 0);
1583 TestSmiAnd(masm, &exit, 0x20, 0, 1); 1569 TestSmiAnd(masm, &exit, 0x20, 0, 1);
1584 TestSmiAnd(masm, &exit, 0x30, 1, 0); 1570 TestSmiAnd(masm, &exit, 0x30, 1, 0);
1585 TestSmiAnd(masm, &exit, 0x40, 0, -1); 1571 TestSmiAnd(masm, &exit, 0x40, 0, -1);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 1631
1646 TEST(SmiOr) { 1632 TEST(SmiOr) {
1647 v8::internal::V8::Initialize(NULL); 1633 v8::internal::V8::Initialize(NULL);
1648 // Allocate an executable page of memory. 1634 // Allocate an executable page of memory.
1649 size_t actual_size; 1635 size_t actual_size;
1650 byte* buffer = 1636 byte* buffer =
1651 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1637 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1652 &actual_size, 1638 &actual_size,
1653 true)); 1639 true));
1654 CHECK(buffer); 1640 CHECK(buffer);
1655 HandleScope handles; 1641 Isolate* isolate = Isolate::Current();
1656 MacroAssembler assembler(Isolate::Current(), 1642 HandleScope handles(isolate);
1657 buffer, 1643 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1658 static_cast<int>(actual_size));
1659 1644
1660 MacroAssembler* masm = &assembler; 1645 MacroAssembler* masm = &assembler;
1661 masm->set_allow_stub_calls(false); 1646 masm->set_allow_stub_calls(false);
1662 EntryCode(masm); 1647 EntryCode(masm);
1663 Label exit; 1648 Label exit;
1664 1649
1665 TestSmiOr(masm, &exit, 0x10, 0, 0); 1650 TestSmiOr(masm, &exit, 0x10, 0, 0);
1666 TestSmiOr(masm, &exit, 0x20, 0, 1); 1651 TestSmiOr(masm, &exit, 0x20, 0, 1);
1667 TestSmiOr(masm, &exit, 0x30, 1, 0); 1652 TestSmiOr(masm, &exit, 0x30, 1, 0);
1668 TestSmiOr(masm, &exit, 0x40, 0, -1); 1653 TestSmiOr(masm, &exit, 0x40, 0, -1);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 1715
1731 TEST(SmiXor) { 1716 TEST(SmiXor) {
1732 v8::internal::V8::Initialize(NULL); 1717 v8::internal::V8::Initialize(NULL);
1733 // Allocate an executable page of memory. 1718 // Allocate an executable page of memory.
1734 size_t actual_size; 1719 size_t actual_size;
1735 byte* buffer = 1720 byte* buffer =
1736 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1721 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1737 &actual_size, 1722 &actual_size,
1738 true)); 1723 true));
1739 CHECK(buffer); 1724 CHECK(buffer);
1740 HandleScope handles; 1725 Isolate* isolate = Isolate::Current();
1741 MacroAssembler assembler(Isolate::Current(), 1726 HandleScope handles(isolate);
1742 buffer, 1727 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1743 static_cast<int>(actual_size));
1744 1728
1745 MacroAssembler* masm = &assembler; 1729 MacroAssembler* masm = &assembler;
1746 masm->set_allow_stub_calls(false); 1730 masm->set_allow_stub_calls(false);
1747 EntryCode(masm); 1731 EntryCode(masm);
1748 Label exit; 1732 Label exit;
1749 1733
1750 TestSmiXor(masm, &exit, 0x10, 0, 0); 1734 TestSmiXor(masm, &exit, 0x10, 0, 0);
1751 TestSmiXor(masm, &exit, 0x20, 0, 1); 1735 TestSmiXor(masm, &exit, 0x20, 0, 1);
1752 TestSmiXor(masm, &exit, 0x30, 1, 0); 1736 TestSmiXor(masm, &exit, 0x30, 1, 0);
1753 TestSmiXor(masm, &exit, 0x40, 0, -1); 1737 TestSmiXor(masm, &exit, 0x40, 0, -1);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 1783
1800 TEST(SmiNot) { 1784 TEST(SmiNot) {
1801 v8::internal::V8::Initialize(NULL); 1785 v8::internal::V8::Initialize(NULL);
1802 // Allocate an executable page of memory. 1786 // Allocate an executable page of memory.
1803 size_t actual_size; 1787 size_t actual_size;
1804 byte* buffer = 1788 byte* buffer =
1805 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1789 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1806 &actual_size, 1790 &actual_size,
1807 true)); 1791 true));
1808 CHECK(buffer); 1792 CHECK(buffer);
1809 HandleScope handles; 1793 Isolate* isolate = Isolate::Current();
1810 MacroAssembler assembler(Isolate::Current(), 1794 HandleScope handles(isolate);
1811 buffer, 1795 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1812 static_cast<int>(actual_size));
1813 1796
1814 MacroAssembler* masm = &assembler; 1797 MacroAssembler* masm = &assembler;
1815 masm->set_allow_stub_calls(false); 1798 masm->set_allow_stub_calls(false);
1816 EntryCode(masm); 1799 EntryCode(masm);
1817 Label exit; 1800 Label exit;
1818 1801
1819 TestSmiNot(masm, &exit, 0x10, 0); 1802 TestSmiNot(masm, &exit, 0x10, 0);
1820 TestSmiNot(masm, &exit, 0x20, 1); 1803 TestSmiNot(masm, &exit, 0x20, 1);
1821 TestSmiNot(masm, &exit, 0x30, -1); 1804 TestSmiNot(masm, &exit, 0x30, -1);
1822 TestSmiNot(masm, &exit, 0x40, 127); 1805 TestSmiNot(masm, &exit, 0x40, 127);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 1880
1898 TEST(SmiShiftLeft) { 1881 TEST(SmiShiftLeft) {
1899 v8::internal::V8::Initialize(NULL); 1882 v8::internal::V8::Initialize(NULL);
1900 // Allocate an executable page of memory. 1883 // Allocate an executable page of memory.
1901 size_t actual_size; 1884 size_t actual_size;
1902 byte* buffer = 1885 byte* buffer =
1903 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 1886 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
1904 &actual_size, 1887 &actual_size,
1905 true)); 1888 true));
1906 CHECK(buffer); 1889 CHECK(buffer);
1907 HandleScope handles; 1890 Isolate* isolate = Isolate::Current();
1908 MacroAssembler assembler(Isolate::Current(), 1891 HandleScope handles(isolate);
1909 buffer, 1892 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1910 static_cast<int>(actual_size));
1911 1893
1912 MacroAssembler* masm = &assembler; 1894 MacroAssembler* masm = &assembler;
1913 masm->set_allow_stub_calls(false); 1895 masm->set_allow_stub_calls(false);
1914 EntryCode(masm); 1896 EntryCode(masm);
1915 Label exit; 1897 Label exit;
1916 1898
1917 TestSmiShiftLeft(masm, &exit, 0x10, 0); 1899 TestSmiShiftLeft(masm, &exit, 0x10, 0);
1918 TestSmiShiftLeft(masm, &exit, 0x50, 1); 1900 TestSmiShiftLeft(masm, &exit, 0x50, 1);
1919 TestSmiShiftLeft(masm, &exit, 0x90, 127); 1901 TestSmiShiftLeft(masm, &exit, 0x90, 127);
1920 TestSmiShiftLeft(masm, &exit, 0xD0, 65535); 1902 TestSmiShiftLeft(masm, &exit, 0xD0, 65535);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 1987
2006 TEST(SmiShiftLogicalRight) { 1988 TEST(SmiShiftLogicalRight) {
2007 v8::internal::V8::Initialize(NULL); 1989 v8::internal::V8::Initialize(NULL);
2008 // Allocate an executable page of memory. 1990 // Allocate an executable page of memory.
2009 size_t actual_size; 1991 size_t actual_size;
2010 byte* buffer = 1992 byte* buffer =
2011 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1993 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
2012 &actual_size, 1994 &actual_size,
2013 true)); 1995 true));
2014 CHECK(buffer); 1996 CHECK(buffer);
2015 HandleScope handles; 1997 Isolate* isolate = Isolate::Current();
2016 MacroAssembler assembler(Isolate::Current(), 1998 HandleScope handles(isolate);
2017 buffer, 1999 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2018 static_cast<int>(actual_size));
2019 2000
2020 MacroAssembler* masm = &assembler; 2001 MacroAssembler* masm = &assembler;
2021 masm->set_allow_stub_calls(false); 2002 masm->set_allow_stub_calls(false);
2022 EntryCode(masm); 2003 EntryCode(masm);
2023 Label exit; 2004 Label exit;
2024 2005
2025 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); 2006 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0);
2026 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); 2007 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1);
2027 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127); 2008 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127);
2028 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535); 2009 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 2057
2077 TEST(SmiShiftArithmeticRight) { 2058 TEST(SmiShiftArithmeticRight) {
2078 v8::internal::V8::Initialize(NULL); 2059 v8::internal::V8::Initialize(NULL);
2079 // Allocate an executable page of memory. 2060 // Allocate an executable page of memory.
2080 size_t actual_size; 2061 size_t actual_size;
2081 byte* buffer = 2062 byte* buffer =
2082 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2063 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2083 &actual_size, 2064 &actual_size,
2084 true)); 2065 true));
2085 CHECK(buffer); 2066 CHECK(buffer);
2086 HandleScope handles; 2067 Isolate* isolate = Isolate::Current();
2087 MacroAssembler assembler(Isolate::Current(), 2068 HandleScope handles(isolate);
2088 buffer, 2069 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2089 static_cast<int>(actual_size));
2090 2070
2091 MacroAssembler* masm = &assembler; 2071 MacroAssembler* masm = &assembler;
2092 masm->set_allow_stub_calls(false); 2072 masm->set_allow_stub_calls(false);
2093 EntryCode(masm); 2073 EntryCode(masm);
2094 Label exit; 2074 Label exit;
2095 2075
2096 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); 2076 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0);
2097 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); 2077 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1);
2098 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127); 2078 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127);
2099 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535); 2079 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 2122
2143 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { 2123 TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
2144 v8::internal::V8::Initialize(NULL); 2124 v8::internal::V8::Initialize(NULL);
2145 // Allocate an executable page of memory. 2125 // Allocate an executable page of memory.
2146 size_t actual_size; 2126 size_t actual_size;
2147 byte* buffer = 2127 byte* buffer =
2148 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 2128 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
2149 &actual_size, 2129 &actual_size,
2150 true)); 2130 true));
2151 CHECK(buffer); 2131 CHECK(buffer);
2152 HandleScope handles; 2132 Isolate* isolate = Isolate::Current();
2153 MacroAssembler assembler(Isolate::Current(), 2133 HandleScope handles(isolate);
2154 buffer, 2134 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2155 static_cast<int>(actual_size));
2156 2135
2157 MacroAssembler* masm = &assembler; 2136 MacroAssembler* masm = &assembler;
2158 masm->set_allow_stub_calls(false); 2137 masm->set_allow_stub_calls(false);
2159 EntryCode(masm); 2138 EntryCode(masm);
2160 Label exit; 2139 Label exit;
2161 2140
2162 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); 2141 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0);
2163 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); 2142 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1);
2164 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127); 2143 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127);
2165 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128); 2144 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128);
(...skipping 21 matching lines...) Expand all
2187 int data[256]; 2166 int data[256];
2188 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } 2167 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; }
2189 2168
2190 // Allocate an executable page of memory. 2169 // Allocate an executable page of memory.
2191 size_t actual_size; 2170 size_t actual_size;
2192 byte* buffer = 2171 byte* buffer =
2193 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2172 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2194 &actual_size, 2173 &actual_size,
2195 true)); 2174 true));
2196 CHECK(buffer); 2175 CHECK(buffer);
2197 HandleScope handles; 2176 Isolate* isolate = Isolate::Current();
2198 MacroAssembler assembler(Isolate::Current(), 2177 HandleScope handles(isolate);
2199 buffer, 2178 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2200 static_cast<int>(actual_size));
2201 2179
2202 MacroAssembler* masm = &assembler; 2180 MacroAssembler* masm = &assembler;
2203 masm->set_allow_stub_calls(false); 2181 masm->set_allow_stub_calls(false);
2204 Label exit; 2182 Label exit;
2205 2183
2206 EntryCode(masm); 2184 EntryCode(masm);
2207 __ push(r13); 2185 __ push(r13);
2208 __ push(r14); 2186 __ push(r14);
2209 __ push(rbx); 2187 __ push(rbx);
2210 __ push(rbp); 2188 __ push(rbp);
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 CodeDesc desc; 2513 CodeDesc desc;
2536 masm->GetCode(&desc); 2514 masm->GetCode(&desc);
2537 // Call the function from C++. 2515 // Call the function from C++.
2538 int result = FUNCTION_CAST<F0>(buffer)(); 2516 int result = FUNCTION_CAST<F0>(buffer)();
2539 CHECK_EQ(0, result); 2517 CHECK_EQ(0, result);
2540 } 2518 }
2541 2519
2542 2520
2543 2521
2544 #undef __ 2522 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698