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

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

Issue 1476763002: Make whether or not a Code object should be created by masm explicit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: enum class FTW Created 5 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
« no previous file with comments | « test/cctest/test-assembler-arm64.cc ('k') | test/cctest/test-assembler-mips.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 308
309 typedef int (*F7)(double x, double y); 309 typedef int (*F7)(double x, double y);
310 310
311 TEST(AssemblerIa329) { 311 TEST(AssemblerIa329) {
312 CcTest::InitializeVM(); 312 CcTest::InitializeVM();
313 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 313 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
314 HandleScope scope(isolate); 314 HandleScope scope(isolate);
315 v8::internal::byte buffer[256]; 315 v8::internal::byte buffer[256];
316 MacroAssembler assm(isolate, buffer, sizeof buffer); 316 MacroAssembler assm(isolate, buffer, sizeof(buffer),
317 v8::internal::CodeObjectRequired::kYes);
317 enum { kEqual = 0, kGreater = 1, kLess = 2, kNaN = 3, kUndefined = 4 }; 318 enum { kEqual = 0, kGreater = 1, kLess = 2, kNaN = 3, kUndefined = 4 };
318 Label equal_l, less_l, greater_l, nan_l; 319 Label equal_l, less_l, greater_l, nan_l;
319 __ fld_d(Operand(esp, 3 * kPointerSize)); 320 __ fld_d(Operand(esp, 3 * kPointerSize));
320 __ fld_d(Operand(esp, 1 * kPointerSize)); 321 __ fld_d(Operand(esp, 1 * kPointerSize));
321 __ FCmp(); 322 __ FCmp();
322 __ j(parity_even, &nan_l); 323 __ j(parity_even, &nan_l);
323 __ j(equal, &equal_l); 324 __ j(equal, &equal_l);
324 __ j(below, &less_l); 325 __ j(below, &less_l);
325 __ j(above, &greater_l); 326 __ j(above, &greater_l);
326 327
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 #endif // __GNUC__ 529 #endif // __GNUC__
529 530
530 531
531 TEST(AssemblerIa32Extractps) { 532 TEST(AssemblerIa32Extractps) {
532 CcTest::InitializeVM(); 533 CcTest::InitializeVM();
533 if (!CpuFeatures::IsSupported(SSE4_1)) return; 534 if (!CpuFeatures::IsSupported(SSE4_1)) return;
534 535
535 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 536 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
536 HandleScope scope(isolate); 537 HandleScope scope(isolate);
537 v8::internal::byte buffer[256]; 538 v8::internal::byte buffer[256];
538 MacroAssembler assm(isolate, buffer, sizeof buffer); 539 MacroAssembler assm(isolate, buffer, sizeof(buffer),
540 v8::internal::CodeObjectRequired::kYes);
539 { CpuFeatureScope fscope41(&assm, SSE4_1); 541 { CpuFeatureScope fscope41(&assm, SSE4_1);
540 __ movsd(xmm1, Operand(esp, 4)); 542 __ movsd(xmm1, Operand(esp, 4));
541 __ extractps(eax, xmm1, 0x1); 543 __ extractps(eax, xmm1, 0x1);
542 __ ret(0); 544 __ ret(0);
543 } 545 }
544 546
545 CodeDesc desc; 547 CodeDesc desc;
546 assm.GetCode(&desc); 548 assm.GetCode(&desc);
547 Handle<Code> code = isolate->factory()->NewCode( 549 Handle<Code> code = isolate->factory()->NewCode(
548 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 550 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
(...skipping 10 matching lines...) Expand all
559 } 561 }
560 562
561 563
562 typedef int (*F8)(float x, float y); 564 typedef int (*F8)(float x, float y);
563 TEST(AssemblerIa32SSE) { 565 TEST(AssemblerIa32SSE) {
564 CcTest::InitializeVM(); 566 CcTest::InitializeVM();
565 567
566 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 568 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
567 HandleScope scope(isolate); 569 HandleScope scope(isolate);
568 v8::internal::byte buffer[256]; 570 v8::internal::byte buffer[256];
569 MacroAssembler assm(isolate, buffer, sizeof buffer); 571 MacroAssembler assm(isolate, buffer, sizeof(buffer),
572 v8::internal::CodeObjectRequired::kYes);
570 { 573 {
571 __ movss(xmm0, Operand(esp, kPointerSize)); 574 __ movss(xmm0, Operand(esp, kPointerSize));
572 __ movss(xmm1, Operand(esp, 2 * kPointerSize)); 575 __ movss(xmm1, Operand(esp, 2 * kPointerSize));
573 __ shufps(xmm0, xmm0, 0x0); 576 __ shufps(xmm0, xmm0, 0x0);
574 __ shufps(xmm1, xmm1, 0x0); 577 __ shufps(xmm1, xmm1, 0x0);
575 __ movaps(xmm2, xmm1); 578 __ movaps(xmm2, xmm1);
576 __ addps(xmm2, xmm0); 579 __ addps(xmm2, xmm0);
577 __ mulps(xmm2, xmm1); 580 __ mulps(xmm2, xmm1);
578 __ subps(xmm2, xmm0); 581 __ subps(xmm2, xmm0);
579 __ divps(xmm2, xmm1); 582 __ divps(xmm2, xmm1);
(...skipping 16 matching lines...) Expand all
596 599
597 600
598 typedef int (*F9)(double x, double y, double z); 601 typedef int (*F9)(double x, double y, double z);
599 TEST(AssemblerX64FMA_sd) { 602 TEST(AssemblerX64FMA_sd) {
600 CcTest::InitializeVM(); 603 CcTest::InitializeVM();
601 if (!CpuFeatures::IsSupported(FMA3)) return; 604 if (!CpuFeatures::IsSupported(FMA3)) return;
602 605
603 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 606 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
604 HandleScope scope(isolate); 607 HandleScope scope(isolate);
605 v8::internal::byte buffer[1024]; 608 v8::internal::byte buffer[1024];
606 MacroAssembler assm(isolate, buffer, sizeof buffer); 609 MacroAssembler assm(isolate, buffer, sizeof(buffer),
610 v8::internal::CodeObjectRequired::kYes);
607 { 611 {
608 CpuFeatureScope fscope(&assm, FMA3); 612 CpuFeatureScope fscope(&assm, FMA3);
609 Label exit; 613 Label exit;
610 __ movsd(xmm0, Operand(esp, 1 * kPointerSize)); 614 __ movsd(xmm0, Operand(esp, 1 * kPointerSize));
611 __ movsd(xmm1, Operand(esp, 3 * kPointerSize)); 615 __ movsd(xmm1, Operand(esp, 3 * kPointerSize));
612 __ movsd(xmm2, Operand(esp, 5 * kPointerSize)); 616 __ movsd(xmm2, Operand(esp, 5 * kPointerSize));
613 // argument in xmm0, xmm1 and xmm2 617 // argument in xmm0, xmm1 and xmm2
614 // xmm0 * xmm1 + xmm2 618 // xmm0 * xmm1 + xmm2
615 __ movaps(xmm3, xmm0); 619 __ movaps(xmm3, xmm0);
616 __ mulsd(xmm3, xmm1); 620 __ mulsd(xmm3, xmm1);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 828
825 829
826 typedef int (*F10)(float x, float y, float z); 830 typedef int (*F10)(float x, float y, float z);
827 TEST(AssemblerX64FMA_ss) { 831 TEST(AssemblerX64FMA_ss) {
828 CcTest::InitializeVM(); 832 CcTest::InitializeVM();
829 if (!CpuFeatures::IsSupported(FMA3)) return; 833 if (!CpuFeatures::IsSupported(FMA3)) return;
830 834
831 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 835 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
832 HandleScope scope(isolate); 836 HandleScope scope(isolate);
833 v8::internal::byte buffer[1024]; 837 v8::internal::byte buffer[1024];
834 MacroAssembler assm(isolate, buffer, sizeof buffer); 838 MacroAssembler assm(isolate, buffer, sizeof(buffer),
839 v8::internal::CodeObjectRequired::kYes);
835 { 840 {
836 CpuFeatureScope fscope(&assm, FMA3); 841 CpuFeatureScope fscope(&assm, FMA3);
837 Label exit; 842 Label exit;
838 __ movss(xmm0, Operand(esp, 1 * kPointerSize)); 843 __ movss(xmm0, Operand(esp, 1 * kPointerSize));
839 __ movss(xmm1, Operand(esp, 2 * kPointerSize)); 844 __ movss(xmm1, Operand(esp, 2 * kPointerSize));
840 __ movss(xmm2, Operand(esp, 3 * kPointerSize)); 845 __ movss(xmm2, Operand(esp, 3 * kPointerSize));
841 // arguments in xmm0, xmm1 and xmm2 846 // arguments in xmm0, xmm1 and xmm2
842 // xmm0 * xmm1 + xmm2 847 // xmm0 * xmm1 + xmm2
843 __ movaps(xmm3, xmm0); 848 __ movaps(xmm3, xmm0);
844 __ mulss(xmm3, xmm1); 849 __ mulss(xmm3, xmm1);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 } 1056 }
1052 1057
1053 1058
1054 TEST(AssemblerIa32BMI1) { 1059 TEST(AssemblerIa32BMI1) {
1055 CcTest::InitializeVM(); 1060 CcTest::InitializeVM();
1056 if (!CpuFeatures::IsSupported(BMI1)) return; 1061 if (!CpuFeatures::IsSupported(BMI1)) return;
1057 1062
1058 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 1063 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
1059 HandleScope scope(isolate); 1064 HandleScope scope(isolate);
1060 v8::internal::byte buffer[1024]; 1065 v8::internal::byte buffer[1024];
1061 MacroAssembler assm(isolate, buffer, sizeof buffer); 1066 MacroAssembler assm(isolate, buffer, sizeof(buffer),
1067 v8::internal::CodeObjectRequired::kYes);
1062 { 1068 {
1063 CpuFeatureScope fscope(&assm, BMI1); 1069 CpuFeatureScope fscope(&assm, BMI1);
1064 Label exit; 1070 Label exit;
1065 1071
1066 __ push(ebx); // save ebx 1072 __ push(ebx); // save ebx
1067 __ mov(ecx, Immediate(0x55667788u)); // source operand 1073 __ mov(ecx, Immediate(0x55667788u)); // source operand
1068 __ push(ecx); // For memory operand 1074 __ push(ecx); // For memory operand
1069 1075
1070 // andn 1076 // andn
1071 __ mov(edx, Immediate(0x20000000u)); 1077 __ mov(edx, Immediate(0x20000000u));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 } 1164 }
1159 1165
1160 1166
1161 TEST(AssemblerIa32LZCNT) { 1167 TEST(AssemblerIa32LZCNT) {
1162 CcTest::InitializeVM(); 1168 CcTest::InitializeVM();
1163 if (!CpuFeatures::IsSupported(LZCNT)) return; 1169 if (!CpuFeatures::IsSupported(LZCNT)) return;
1164 1170
1165 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 1171 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
1166 HandleScope scope(isolate); 1172 HandleScope scope(isolate);
1167 v8::internal::byte buffer[256]; 1173 v8::internal::byte buffer[256];
1168 MacroAssembler assm(isolate, buffer, sizeof buffer); 1174 MacroAssembler assm(isolate, buffer, sizeof(buffer),
1175 v8::internal::CodeObjectRequired::kYes);
1169 { 1176 {
1170 CpuFeatureScope fscope(&assm, LZCNT); 1177 CpuFeatureScope fscope(&assm, LZCNT);
1171 Label exit; 1178 Label exit;
1172 1179
1173 __ push(ebx); // save ebx 1180 __ push(ebx); // save ebx
1174 __ mov(ecx, Immediate(0x55667788u)); // source operand 1181 __ mov(ecx, Immediate(0x55667788u)); // source operand
1175 __ push(ecx); // For memory operand 1182 __ push(ecx); // For memory operand
1176 1183
1177 __ mov(eax, Immediate(1)); // Test number 1184 __ mov(eax, Immediate(1)); // Test number
1178 __ lzcnt(ebx, ecx); 1185 __ lzcnt(ebx, ecx);
(...skipping 26 matching lines...) Expand all
1205 } 1212 }
1206 1213
1207 1214
1208 TEST(AssemblerIa32POPCNT) { 1215 TEST(AssemblerIa32POPCNT) {
1209 CcTest::InitializeVM(); 1216 CcTest::InitializeVM();
1210 if (!CpuFeatures::IsSupported(POPCNT)) return; 1217 if (!CpuFeatures::IsSupported(POPCNT)) return;
1211 1218
1212 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 1219 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
1213 HandleScope scope(isolate); 1220 HandleScope scope(isolate);
1214 v8::internal::byte buffer[256]; 1221 v8::internal::byte buffer[256];
1215 MacroAssembler assm(isolate, buffer, sizeof buffer); 1222 MacroAssembler assm(isolate, buffer, sizeof(buffer),
1223 v8::internal::CodeObjectRequired::kYes);
1216 { 1224 {
1217 CpuFeatureScope fscope(&assm, POPCNT); 1225 CpuFeatureScope fscope(&assm, POPCNT);
1218 Label exit; 1226 Label exit;
1219 1227
1220 __ push(ebx); // save ebx 1228 __ push(ebx); // save ebx
1221 __ mov(ecx, Immediate(0x11111100u)); // source operand 1229 __ mov(ecx, Immediate(0x11111100u)); // source operand
1222 __ push(ecx); // For memory operand 1230 __ push(ecx); // For memory operand
1223 1231
1224 __ mov(eax, Immediate(1)); // Test number 1232 __ mov(eax, Immediate(1)); // Test number
1225 __ popcnt(ebx, ecx); 1233 __ popcnt(ebx, ecx);
(...skipping 26 matching lines...) Expand all
1252 } 1260 }
1253 1261
1254 1262
1255 TEST(AssemblerIa32BMI2) { 1263 TEST(AssemblerIa32BMI2) {
1256 CcTest::InitializeVM(); 1264 CcTest::InitializeVM();
1257 if (!CpuFeatures::IsSupported(BMI2)) return; 1265 if (!CpuFeatures::IsSupported(BMI2)) return;
1258 1266
1259 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); 1267 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
1260 HandleScope scope(isolate); 1268 HandleScope scope(isolate);
1261 v8::internal::byte buffer[2048]; 1269 v8::internal::byte buffer[2048];
1262 MacroAssembler assm(isolate, buffer, sizeof buffer); 1270 MacroAssembler assm(isolate, buffer, sizeof(buffer),
1271 v8::internal::CodeObjectRequired::kYes);
1263 { 1272 {
1264 CpuFeatureScope fscope(&assm, BMI2); 1273 CpuFeatureScope fscope(&assm, BMI2);
1265 Label exit; 1274 Label exit;
1266 1275
1267 __ push(ebx); // save ebx 1276 __ push(ebx); // save ebx
1268 __ push(esi); // save esi 1277 __ push(esi); // save esi
1269 __ mov(ecx, Immediate(0x55667788u)); // source operand 1278 __ mov(ecx, Immediate(0x55667788u)); // source operand
1270 __ push(ecx); // For memory operand 1279 __ push(ecx); // For memory operand
1271 1280
1272 // bzhi 1281 // bzhi
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 #endif 1494 #endif
1486 F1 f = FUNCTION_CAST<F1>(code->entry()); 1495 F1 f = FUNCTION_CAST<F1>(code->entry());
1487 for (int i = 0; i < kNumCases; ++i) { 1496 for (int i = 0; i < kNumCases; ++i) {
1488 int res = f(i); 1497 int res = f(i);
1489 ::printf("f(%d) = %d\n", i, res); 1498 ::printf("f(%d) = %d\n", i, res);
1490 CHECK_EQ(values[i], res); 1499 CHECK_EQ(values[i], res);
1491 } 1500 }
1492 } 1501 }
1493 1502
1494 #undef __ 1503 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-arm64.cc ('k') | test/cctest/test-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698