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

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

Issue 2900683002: [compiler] Delay allocation of code-embedded heap numbers. (Closed)
Patch Set: Fix rebase. Created 3 years, 6 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
« no previous file with comments | « test/cctest/test-macro-assembler-ia32.cc ('k') | test/cctest/test-macro-assembler-mips64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 __ lw(a2, MemOperand(a0, offsetof(T, r5))); 86 __ lw(a2, MemOperand(a0, offsetof(T, r5)));
87 __ nop(); 87 __ nop();
88 __ ByteSwapUnsigned(a2, a2, 2); 88 __ ByteSwapUnsigned(a2, a2, 2);
89 __ sw(a2, MemOperand(a0, offsetof(T, r5))); 89 __ sw(a2, MemOperand(a0, offsetof(T, r5)));
90 90
91 __ jr(ra); 91 __ jr(ra);
92 __ nop(); 92 __ nop();
93 93
94 CodeDesc desc; 94 CodeDesc desc;
95 masm->GetCode(&desc); 95 masm->GetCode(isolate, &desc);
96 Handle<Code> code = isolate->factory()->NewCode( 96 Handle<Code> code = isolate->factory()->NewCode(
97 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 97 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
98 ::F3 f = FUNCTION_CAST<::F3>(code->entry()); 98 ::F3 f = FUNCTION_CAST<::F3>(code->entry());
99 t.r1 = 0x781A15C3; 99 t.r1 = 0x781A15C3;
100 t.r2 = 0x2CDE; 100 t.r2 = 0x2CDE;
101 t.r3 = 0x9F; 101 t.r3 = 0x9F;
102 t.r4 = 0x9F; 102 t.r4 = 0x9F;
103 t.r5 = 0x2CDE; 103 t.r5 = 0x2CDE;
104 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); 104 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
105 USE(dummy); 105 USE(dummy);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 __ bind(&done); 195 __ bind(&done);
196 __ Pop(ra); 196 __ Pop(ra);
197 __ jr(ra); 197 __ jr(ra);
198 __ nop(); 198 __ nop();
199 199
200 __ bind(&end); 200 __ bind(&end);
201 __ Branch(&near_start); 201 __ Branch(&near_start);
202 202
203 CodeDesc desc; 203 CodeDesc desc;
204 masm->GetCode(&desc); 204 masm->GetCode(isolate, &desc);
205 Handle<Code> code = isolate->factory()->NewCode( 205 Handle<Code> code = isolate->factory()->NewCode(
206 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 206 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
207 #ifdef OBJECT_PRINT 207 #ifdef OBJECT_PRINT
208 code->Print(std::cout); 208 code->Print(std::cout);
209 #endif 209 #endif
210 F1 f = FUNCTION_CAST<F1>(code->entry()); 210 F1 f = FUNCTION_CAST<F1>(code->entry());
211 for (int i = 0; i < kNumCases; ++i) { 211 for (int i = 0; i < kNumCases; ++i) {
212 int res = 212 int res =
213 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); 213 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0));
214 ::printf("f(%d) = %d\n", i, res); 214 ::printf("f(%d) = %d\n", i, res);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 __ jr(ra); 261 __ jr(ra);
262 __ nop(); 262 __ nop();
263 } 263 }
264 264
265 __ bind(&done); 265 __ bind(&done);
266 __ Pop(ra); 266 __ Pop(ra);
267 __ jr(ra); 267 __ jr(ra);
268 __ nop(); 268 __ nop();
269 269
270 CodeDesc desc; 270 CodeDesc desc;
271 masm->GetCode(&desc); 271 masm->GetCode(isolate, &desc);
272 Handle<Code> code = isolate->factory()->NewCode( 272 Handle<Code> code = isolate->factory()->NewCode(
273 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 273 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
274 #ifdef OBJECT_PRINT 274 #ifdef OBJECT_PRINT
275 code->Print(std::cout); 275 code->Print(std::cout);
276 #endif 276 #endif
277 F1 f = FUNCTION_CAST<F1>(code->entry()); 277 F1 f = FUNCTION_CAST<F1>(code->entry());
278 for (int i = 0; i < kNumCases; ++i) { 278 for (int i = 0; i < kNumCases; ++i) {
279 int32_t res = reinterpret_cast<int32_t>( 279 int32_t res = reinterpret_cast<int32_t>(
280 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); 280 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0));
281 ::printf("f(%d) = %d\n", i, res); 281 ::printf("f(%d) = %d\n", i, res);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 __ bind(&done); 353 __ bind(&done);
354 __ Pop(ra); 354 __ Pop(ra);
355 __ jr(ra); 355 __ jr(ra);
356 __ nop(); 356 __ nop();
357 357
358 __ bind(&end); 358 __ bind(&end);
359 __ Branch(&near_start); 359 __ Branch(&near_start);
360 360
361 CodeDesc desc; 361 CodeDesc desc;
362 masm->GetCode(&desc); 362 masm->GetCode(isolate, &desc);
363 Handle<Code> code = isolate->factory()->NewCode( 363 Handle<Code> code = isolate->factory()->NewCode(
364 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 364 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
365 #ifdef OBJECT_PRINT 365 #ifdef OBJECT_PRINT
366 code->Print(std::cout); 366 code->Print(std::cout);
367 #endif 367 #endif
368 F1 f = FUNCTION_CAST<F1>(code->entry()); 368 F1 f = FUNCTION_CAST<F1>(code->entry());
369 for (int i = 0; i < kSwitchTableCases; ++i) { 369 for (int i = 0; i < kSwitchTableCases; ++i) {
370 int res = 370 int res =
371 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); 371 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0));
372 ::printf("f(%d) = %d\n", i, res); 372 ::printf("f(%d) = %d\n", i, res);
373 CHECK_EQ(values[i], res); 373 CHECK_EQ(values[i], res);
374 } 374 }
375 } 375 }
376 376
377 static uint32_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) { 377 static uint32_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) {
378 Isolate* isolate = CcTest::i_isolate(); 378 Isolate* isolate = CcTest::i_isolate();
379 HandleScope scope(isolate); 379 HandleScope scope(isolate);
380 MacroAssembler assembler(isolate, nullptr, 0, 380 MacroAssembler assembler(isolate, nullptr, 0,
381 v8::internal::CodeObjectRequired::kYes); 381 v8::internal::CodeObjectRequired::kYes);
382 MacroAssembler* masm = &assembler; 382 MacroAssembler* masm = &assembler;
383 383
384 __ Lsa(v0, a0, a1, sa); 384 __ Lsa(v0, a0, a1, sa);
385 __ jr(ra); 385 __ jr(ra);
386 __ nop(); 386 __ nop();
387 387
388 CodeDesc desc; 388 CodeDesc desc;
389 assembler.GetCode(&desc); 389 assembler.GetCode(isolate, &desc);
390 Handle<Code> code = isolate->factory()->NewCode( 390 Handle<Code> code = isolate->factory()->NewCode(
391 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 391 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
392 392
393 F1 f = FUNCTION_CAST<F1>(code->entry()); 393 F1 f = FUNCTION_CAST<F1>(code->entry());
394 394
395 uint32_t res = reinterpret_cast<uint32_t>( 395 uint32_t res = reinterpret_cast<uint32_t>(
396 CALL_GENERATED_CODE(isolate, f, rt, rs, 0, 0, 0)); 396 CALL_GENERATED_CODE(isolate, f, rt, rs, 0, 0, 0));
397 397
398 return res; 398 return res;
399 } 399 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 v8::internal::CodeObjectRequired::kYes); 509 v8::internal::CodeObjectRequired::kYes);
510 MacroAssembler* masm = &assm; 510 MacroAssembler* masm = &assm;
511 511
512 __ mtc1(a0, f4); 512 __ mtc1(a0, f4);
513 GenerateConvertInstructionFunc(masm); 513 GenerateConvertInstructionFunc(masm);
514 __ mfc1(v0, f2); 514 __ mfc1(v0, f2);
515 __ jr(ra); 515 __ jr(ra);
516 __ nop(); 516 __ nop();
517 517
518 CodeDesc desc; 518 CodeDesc desc;
519 assm.GetCode(&desc); 519 assm.GetCode(isolate, &desc);
520 Handle<Code> code = isolate->factory()->NewCode( 520 Handle<Code> code = isolate->factory()->NewCode(
521 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 521 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
522 522
523 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); 523 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry());
524 524
525 return reinterpret_cast<RET_TYPE>( 525 return reinterpret_cast<RET_TYPE>(
526 CALL_GENERATED_CODE(isolate, f, x, 0, 0, 0, 0)); 526 CALL_GENERATED_CODE(isolate, f, x, 0, 0, 0, 0));
527 } 527 }
528 528
529 TEST(cvt_s_w_Trunc_uw_s) { 529 TEST(cvt_s_w_Trunc_uw_s) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 HandleScope scope(isolate); 614 HandleScope scope(isolate);
615 MacroAssembler assm(isolate, nullptr, 0, 615 MacroAssembler assm(isolate, nullptr, 0,
616 v8::internal::CodeObjectRequired::kYes); 616 v8::internal::CodeObjectRequired::kYes);
617 MacroAssembler* masm = &assm; 617 MacroAssembler* masm = &assm;
618 618
619 GenerateOverflowInstructions(masm, valLeft, valRight); 619 GenerateOverflowInstructions(masm, valLeft, valRight);
620 __ jr(ra); 620 __ jr(ra);
621 __ nop(); 621 __ nop();
622 622
623 CodeDesc desc; 623 CodeDesc desc;
624 assm.GetCode(&desc); 624 assm.GetCode(isolate, &desc);
625 Handle<Code> code = isolate->factory()->NewCode( 625 Handle<Code> code = isolate->factory()->NewCode(
626 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 626 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
627 627
628 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); 628 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry());
629 629
630 int32_t r = 630 int32_t r =
631 reinterpret_cast<int32_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); 631 reinterpret_cast<int32_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0));
632 632
633 DCHECK(r == 0 || r == 1); 633 DCHECK(r == 0 || r == 1);
634 return r; 634 return r;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 __ pop(s6); 1043 __ pop(s6);
1044 __ jr(ra); 1044 __ jr(ra);
1045 __ nop(); 1045 __ nop();
1046 1046
1047 handle_dnan(f10, &handle_mind_nan, &back_mind_nan); 1047 handle_dnan(f10, &handle_mind_nan, &back_mind_nan);
1048 handle_dnan(f12, &handle_maxd_nan, &back_maxd_nan); 1048 handle_dnan(f12, &handle_maxd_nan, &back_maxd_nan);
1049 handle_snan(f14, &handle_mins_nan, &back_mins_nan); 1049 handle_snan(f14, &handle_mins_nan, &back_mins_nan);
1050 handle_snan(f16, &handle_maxs_nan, &back_maxs_nan); 1050 handle_snan(f16, &handle_maxs_nan, &back_maxs_nan);
1051 1051
1052 CodeDesc desc; 1052 CodeDesc desc;
1053 masm->GetCode(&desc); 1053 masm->GetCode(isolate, &desc);
1054 Handle<Code> code = isolate->factory()->NewCode( 1054 Handle<Code> code = isolate->factory()->NewCode(
1055 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1055 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1056 ::F3 f = FUNCTION_CAST<::F3>(code->entry()); 1056 ::F3 f = FUNCTION_CAST<::F3>(code->entry());
1057 for (int i = 0; i < kTableLength; i++) { 1057 for (int i = 0; i < kTableLength; i++) {
1058 test.a = inputsa[i]; 1058 test.a = inputsa[i];
1059 test.b = inputsb[i]; 1059 test.b = inputsb[i];
1060 test.e = inputse[i]; 1060 test.e = inputse[i];
1061 test.f = inputsf[i]; 1061 test.f = inputsf[i];
1062 1062
1063 CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); 1063 CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0);
(...skipping 15 matching lines...) Expand all
1079 MacroAssembler assm(isolate, nullptr, 0, 1079 MacroAssembler assm(isolate, nullptr, 0,
1080 v8::internal::CodeObjectRequired::kYes); 1080 v8::internal::CodeObjectRequired::kYes);
1081 MacroAssembler* masm = &assm; 1081 MacroAssembler* masm = &assm;
1082 IN_TYPE res; 1082 IN_TYPE res;
1083 1083
1084 GenerateUnalignedInstructionFunc(masm, in_offset, out_offset); 1084 GenerateUnalignedInstructionFunc(masm, in_offset, out_offset);
1085 __ jr(ra); 1085 __ jr(ra);
1086 __ nop(); 1086 __ nop();
1087 1087
1088 CodeDesc desc; 1088 CodeDesc desc;
1089 assm.GetCode(&desc); 1089 assm.GetCode(isolate, &desc);
1090 Handle<Code> code = isolate->factory()->NewCode( 1090 Handle<Code> code = isolate->factory()->NewCode(
1091 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1091 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1092 1092
1093 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); 1093 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry());
1094 1094
1095 MemCopy(memory_buffer + in_offset, &value, sizeof(IN_TYPE)); 1095 MemCopy(memory_buffer + in_offset, &value, sizeof(IN_TYPE));
1096 CALL_GENERATED_CODE(isolate, f, memory_buffer, 0, 0, 0, 0); 1096 CALL_GENERATED_CODE(isolate, f, memory_buffer, 0, 0, 0, 0);
1097 MemCopy(&res, memory_buffer + out_offset, sizeof(IN_TYPE)); 1097 MemCopy(&res, memory_buffer + out_offset, sizeof(IN_TYPE));
1098 1098
1099 return res == value; 1099 return res == value;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 HandleScope scope(isolate); 1327 HandleScope scope(isolate);
1328 MacroAssembler assm(isolate, nullptr, 0, 1328 MacroAssembler assm(isolate, nullptr, 0,
1329 v8::internal::CodeObjectRequired::kYes); 1329 v8::internal::CodeObjectRequired::kYes);
1330 MacroAssembler* masm = &assm; 1330 MacroAssembler* masm = &assm;
1331 1331
1332 GenerateSltuInstructionFunc(masm, rd); 1332 GenerateSltuInstructionFunc(masm, rd);
1333 __ jr(ra); 1333 __ jr(ra);
1334 __ nop(); 1334 __ nop();
1335 1335
1336 CodeDesc desc; 1336 CodeDesc desc;
1337 assm.GetCode(&desc); 1337 assm.GetCode(isolate, &desc);
1338 Handle<Code> code = isolate->factory()->NewCode( 1338 Handle<Code> code = isolate->factory()->NewCode(
1339 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1339 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1340 1340
1341 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); 1341 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry());
1342 int32_t res = reinterpret_cast<int32_t>( 1342 int32_t res = reinterpret_cast<int32_t>(
1343 CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); 1343 CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0));
1344 return res == 1; 1344 return res == 1;
1345 } 1345 }
1346 1346
1347 TEST(Sltu) { 1347 TEST(Sltu) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1422
1423 __ bind(&ool_max_aab); 1423 __ bind(&ool_max_aab);
1424 __ Float32MaxOutOfLine(a, a, b); 1424 __ Float32MaxOutOfLine(a, a, b);
1425 __ Branch(&done_max_aab); 1425 __ Branch(&done_max_aab);
1426 1426
1427 __ bind(&ool_max_aba); 1427 __ bind(&ool_max_aba);
1428 __ Float32MaxOutOfLine(a, b, a); 1428 __ Float32MaxOutOfLine(a, b, a);
1429 __ Branch(&done_max_aba); 1429 __ Branch(&done_max_aba);
1430 1430
1431 CodeDesc desc; 1431 CodeDesc desc;
1432 masm->GetCode(&desc); 1432 masm->GetCode(masm->isolate(), &desc);
1433 Handle<Code> code = masm->isolate()->factory()->NewCode( 1433 Handle<Code> code = masm->isolate()->factory()->NewCode(
1434 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1434 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1435 #ifdef DEBUG 1435 #ifdef DEBUG
1436 OFStream os(stdout); 1436 OFStream os(stdout);
1437 code->Print(os); 1437 code->Print(os);
1438 #endif 1438 #endif
1439 return FUNCTION_CAST<::F4>(code->entry()); 1439 return FUNCTION_CAST<::F4>(code->entry());
1440 } 1440 }
1441 1441
1442 TEST(macro_float_minmax_f32) { 1442 TEST(macro_float_minmax_f32) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 1565
1566 __ bind(&ool_max_aab); 1566 __ bind(&ool_max_aab);
1567 __ Float64MaxOutOfLine(a, a, b); 1567 __ Float64MaxOutOfLine(a, a, b);
1568 __ Branch(&done_max_aab); 1568 __ Branch(&done_max_aab);
1569 1569
1570 __ bind(&ool_max_aba); 1570 __ bind(&ool_max_aba);
1571 __ Float64MaxOutOfLine(a, b, a); 1571 __ Float64MaxOutOfLine(a, b, a);
1572 __ Branch(&done_max_aba); 1572 __ Branch(&done_max_aba);
1573 1573
1574 CodeDesc desc; 1574 CodeDesc desc;
1575 masm->GetCode(&desc); 1575 masm->GetCode(masm->isolate(), &desc);
1576 Handle<Code> code = masm->isolate()->factory()->NewCode( 1576 Handle<Code> code = masm->isolate()->factory()->NewCode(
1577 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1577 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1578 #ifdef DEBUG 1578 #ifdef DEBUG
1579 OFStream os(stdout); 1579 OFStream os(stdout);
1580 code->Print(os); 1580 code->Print(os);
1581 #endif 1581 #endif
1582 return FUNCTION_CAST<::F4>(code->entry()); 1582 return FUNCTION_CAST<::F4>(code->entry());
1583 } 1583 }
1584 1584
1585 TEST(macro_float_minmax_f64) { 1585 TEST(macro_float_minmax_f64) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 1645
1646 CHECK_MINMAX(0.0, nan_a, nan_a, nan_a); 1646 CHECK_MINMAX(0.0, nan_a, nan_a, nan_a);
1647 CHECK_MINMAX(nan_a, 0.0, nan_a, nan_a); 1647 CHECK_MINMAX(nan_a, 0.0, nan_a, nan_a);
1648 CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a); 1648 CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a);
1649 CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b); 1649 CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b);
1650 1650
1651 #undef CHECK_MINMAX 1651 #undef CHECK_MINMAX
1652 } 1652 }
1653 1653
1654 #undef __ 1654 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-ia32.cc ('k') | test/cctest/test-macro-assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698