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

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

Issue 1457223005: Remove a bunch of Isolate::Current() callsites from simulators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 1 month 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-mips64.cc ('k') | test/cctest/test-code-stubs-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 __ blr(); 62 __ blr();
63 63
64 CodeDesc desc; 64 CodeDesc desc;
65 assm.GetCode(&desc); 65 assm.GetCode(&desc);
66 Handle<Code> code = isolate->factory()->NewCode( 66 Handle<Code> code = isolate->factory()->NewCode(
67 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 67 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
68 #ifdef DEBUG 68 #ifdef DEBUG
69 code->Print(); 69 code->Print();
70 #endif 70 #endif
71 F2 f = FUNCTION_CAST<F2>(code->entry()); 71 F2 f = FUNCTION_CAST<F2>(code->entry());
72 intptr_t res = 72 intptr_t res = reinterpret_cast<intptr_t>(
73 reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); 73 CALL_GENERATED_CODE(isolate, f, 3, 4, 0, 0, 0));
74 ::printf("f() = %" V8PRIdPTR "\n", res); 74 ::printf("f() = %" V8PRIdPTR "\n", res);
75 CHECK_EQ(7, static_cast<int>(res)); 75 CHECK_EQ(7, static_cast<int>(res));
76 } 76 }
77 77
78 78
79 // Loop 100 times, adding loop counter to result 79 // Loop 100 times, adding loop counter to result
80 TEST(1) { 80 TEST(1) {
81 CcTest::InitializeVM(); 81 CcTest::InitializeVM();
82 Isolate* isolate = Isolate::Current(); 82 Isolate* isolate = Isolate::Current();
83 HandleScope scope(isolate); 83 HandleScope scope(isolate);
(...skipping 17 matching lines...) Expand all
101 __ blr(); 101 __ blr();
102 102
103 CodeDesc desc; 103 CodeDesc desc;
104 assm.GetCode(&desc); 104 assm.GetCode(&desc);
105 Handle<Code> code = isolate->factory()->NewCode( 105 Handle<Code> code = isolate->factory()->NewCode(
106 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 106 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
107 #ifdef DEBUG 107 #ifdef DEBUG
108 code->Print(); 108 code->Print();
109 #endif 109 #endif
110 F1 f = FUNCTION_CAST<F1>(code->entry()); 110 F1 f = FUNCTION_CAST<F1>(code->entry());
111 intptr_t res = 111 intptr_t res = reinterpret_cast<intptr_t>(
112 reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); 112 CALL_GENERATED_CODE(isolate, f, 100, 0, 0, 0, 0));
113 ::printf("f() = %" V8PRIdPTR "\n", res); 113 ::printf("f() = %" V8PRIdPTR "\n", res);
114 CHECK_EQ(5050, static_cast<int>(res)); 114 CHECK_EQ(5050, static_cast<int>(res));
115 } 115 }
116 116
117 117
118 TEST(2) { 118 TEST(2) {
119 CcTest::InitializeVM(); 119 CcTest::InitializeVM();
120 Isolate* isolate = Isolate::Current(); 120 Isolate* isolate = Isolate::Current();
121 HandleScope scope(isolate); 121 HandleScope scope(isolate);
122 122
(...skipping 29 matching lines...) Expand all
152 __ mov(r0, Operand(0xFFF0FFFF)); 152 __ mov(r0, Operand(0xFFF0FFFF));
153 153
154 CodeDesc desc; 154 CodeDesc desc;
155 assm.GetCode(&desc); 155 assm.GetCode(&desc);
156 Handle<Code> code = isolate->factory()->NewCode( 156 Handle<Code> code = isolate->factory()->NewCode(
157 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 157 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
158 #ifdef DEBUG 158 #ifdef DEBUG
159 code->Print(); 159 code->Print();
160 #endif 160 #endif
161 F1 f = FUNCTION_CAST<F1>(code->entry()); 161 F1 f = FUNCTION_CAST<F1>(code->entry());
162 intptr_t res = 162 intptr_t res = reinterpret_cast<intptr_t>(
163 reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); 163 CALL_GENERATED_CODE(isolate, f, 10, 0, 0, 0, 0));
164 ::printf("f() = %" V8PRIdPTR "\n", res); 164 ::printf("f() = %" V8PRIdPTR "\n", res);
165 CHECK_EQ(3628800, static_cast<int>(res)); 165 CHECK_EQ(3628800, static_cast<int>(res));
166 } 166 }
167 167
168 168
169 TEST(3) { 169 TEST(3) {
170 CcTest::InitializeVM(); 170 CcTest::InitializeVM();
171 Isolate* isolate = Isolate::Current(); 171 Isolate* isolate = Isolate::Current();
172 HandleScope scope(isolate); 172 HandleScope scope(isolate);
173 173
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 assm.GetCode(&desc); 228 assm.GetCode(&desc);
229 Handle<Code> code = isolate->factory()->NewCode( 229 Handle<Code> code = isolate->factory()->NewCode(
230 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 230 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
231 #ifdef DEBUG 231 #ifdef DEBUG
232 code->Print(); 232 code->Print();
233 #endif 233 #endif
234 F3 f = FUNCTION_CAST<F3>(code->entry()); 234 F3 f = FUNCTION_CAST<F3>(code->entry());
235 t.i = 100000; 235 t.i = 100000;
236 t.c = 10; 236 t.c = 10;
237 t.s = 1000; 237 t.s = 1000;
238 intptr_t res = 238 intptr_t res = reinterpret_cast<intptr_t>(
239 reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); 239 CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0));
240 ::printf("f() = %" V8PRIdPTR "\n", res); 240 ::printf("f() = %" V8PRIdPTR "\n", res);
241 CHECK_EQ(101010, static_cast<int>(res)); 241 CHECK_EQ(101010, static_cast<int>(res));
242 CHECK_EQ(100000 / 2, t.i); 242 CHECK_EQ(100000 / 2, t.i);
243 CHECK_EQ(10 * 4, t.c); 243 CHECK_EQ(10 * 4, t.c);
244 CHECK_EQ(1000 / 8, t.s); 244 CHECK_EQ(1000 / 8, t.s);
245 } 245 }
246 246
247 #if 0 247 #if 0
248 TEST(4) { 248 TEST(4) {
249 // Test the VFP floating point instructions. 249 // Test the VFP floating point instructions.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 t.d = 0.0; 354 t.d = 0.0;
355 t.e = 0.0; 355 t.e = 0.0;
356 t.f = 0.0; 356 t.f = 0.0;
357 t.g = -2718.2818; 357 t.g = -2718.2818;
358 t.h = 31415926.5; 358 t.h = 31415926.5;
359 t.i = 0; 359 t.i = 0;
360 t.m = -2718.2818; 360 t.m = -2718.2818;
361 t.n = 123.456; 361 t.n = 123.456;
362 t.x = 4.5; 362 t.x = 4.5;
363 t.y = 9.0; 363 t.y = 9.0;
364 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 364 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
365 USE(dummy); 365 USE(dummy);
366 CHECK_EQ(4.5, t.y); 366 CHECK_EQ(4.5, t.y);
367 CHECK_EQ(9.0, t.x); 367 CHECK_EQ(9.0, t.x);
368 CHECK_EQ(-123.456, t.n); 368 CHECK_EQ(-123.456, t.n);
369 CHECK_EQ(2718.2818, t.m); 369 CHECK_EQ(2718.2818, t.m);
370 CHECK_EQ(2, t.i); 370 CHECK_EQ(2, t.i);
371 CHECK_EQ(2718.2818, t.g); 371 CHECK_EQ(2718.2818, t.g);
372 CHECK_EQ(31415926.5, t.h); 372 CHECK_EQ(31415926.5, t.h);
373 CHECK_EQ(42.0, t.f); 373 CHECK_EQ(42.0, t.f);
374 CHECK_EQ(1.0, t.e); 374 CHECK_EQ(1.0, t.e);
(...skipping 28 matching lines...) Expand all
403 Object* code = isolate->heap()->CreateCode( 403 Object* code = isolate->heap()->CreateCode(
404 desc, 404 desc,
405 Code::ComputeFlags(Code::STUB), 405 Code::ComputeFlags(Code::STUB),
406 Handle<Code>())->ToObjectChecked(); 406 Handle<Code>())->ToObjectChecked();
407 CHECK(code->IsCode()); 407 CHECK(code->IsCode());
408 #ifdef DEBUG 408 #ifdef DEBUG
409 Code::cast(code)->Print(); 409 Code::cast(code)->Print();
410 #endif 410 #endif
411 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 411 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
412 int res = reinterpret_cast<int>( 412 int res = reinterpret_cast<int>(
413 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); 413 CALL_GENERATED_CODE(isolate, f, 0xAAAAAAAA, 0, 0, 0, 0));
414 ::printf("f() = %d\n", res); 414 ::printf("f() = %d\n", res);
415 CHECK_EQ(-7, res); 415 CHECK_EQ(-7, res);
416 } 416 }
417 } 417 }
418 418
419 419
420 TEST(6) { 420 TEST(6) {
421 // Test saturating instructions. 421 // Test saturating instructions.
422 CcTest::InitializeVM(); 422 CcTest::InitializeVM();
423 Isolate* isolate = Isolate::Current(); 423 Isolate* isolate = Isolate::Current();
(...skipping 15 matching lines...) Expand all
439 Object* code = isolate->heap()->CreateCode( 439 Object* code = isolate->heap()->CreateCode(
440 desc, 440 desc,
441 Code::ComputeFlags(Code::STUB), 441 Code::ComputeFlags(Code::STUB),
442 Handle<Code>())->ToObjectChecked(); 442 Handle<Code>())->ToObjectChecked();
443 CHECK(code->IsCode()); 443 CHECK(code->IsCode());
444 #ifdef DEBUG 444 #ifdef DEBUG
445 Code::cast(code)->Print(); 445 Code::cast(code)->Print();
446 #endif 446 #endif
447 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 447 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
448 int res = reinterpret_cast<int>( 448 int res = reinterpret_cast<int>(
449 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0)); 449 CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0));
450 ::printf("f() = %d\n", res); 450 ::printf("f() = %d\n", res);
451 CHECK_EQ(382, res); 451 CHECK_EQ(382, res);
452 } 452 }
453 } 453 }
454 454
455 enum VCVTTypes { 455 enum VCVTTypes {
456 s32_f64, 456 s32_f64,
457 u32_f64 457 u32_f64
458 }; 458 };
459 459
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 Object* code = isolate->heap()->CreateCode( 515 Object* code = isolate->heap()->CreateCode(
516 desc, 516 desc,
517 Code::ComputeFlags(Code::STUB), 517 Code::ComputeFlags(Code::STUB),
518 Handle<Code>())->ToObjectChecked(); 518 Handle<Code>())->ToObjectChecked();
519 CHECK(code->IsCode()); 519 CHECK(code->IsCode());
520 #ifdef DEBUG 520 #ifdef DEBUG
521 Code::cast(code)->Print(); 521 Code::cast(code)->Print();
522 #endif 522 #endif
523 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 523 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
524 int res = reinterpret_cast<int>( 524 int res = reinterpret_cast<int>(
525 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); 525 CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0));
526 ::printf("res = %d\n", res); 526 ::printf("res = %d\n", res);
527 CHECK_EQ(expected, res); 527 CHECK_EQ(expected, res);
528 } 528 }
529 } 529 }
530 530
531 531
532 TEST(7) { 532 TEST(7) {
533 // Test vfp rounding modes. 533 // Test vfp rounding modes.
534 534
535 // s32_f64 (double to integer). 535 // s32_f64 (double to integer).
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 720
721 f.a = 1.0; 721 f.a = 1.0;
722 f.b = 2.0; 722 f.b = 2.0;
723 f.c = 3.0; 723 f.c = 3.0;
724 f.d = 4.0; 724 f.d = 4.0;
725 f.e = 5.0; 725 f.e = 5.0;
726 f.f = 6.0; 726 f.f = 6.0;
727 f.g = 7.0; 727 f.g = 7.0;
728 f.h = 8.0; 728 f.h = 8.0;
729 729
730 Object* dummy = CALL_GENERATED_CODE(fn, &d, &f, 0, 0, 0); 730 Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0);
731 USE(dummy); 731 USE(dummy);
732 732
733 CHECK_EQ(7.7, d.a); 733 CHECK_EQ(7.7, d.a);
734 CHECK_EQ(8.8, d.b); 734 CHECK_EQ(8.8, d.b);
735 CHECK_EQ(1.1, d.c); 735 CHECK_EQ(1.1, d.c);
736 CHECK_EQ(2.2, d.d); 736 CHECK_EQ(2.2, d.d);
737 CHECK_EQ(3.3, d.e); 737 CHECK_EQ(3.3, d.e);
738 CHECK_EQ(4.4, d.f); 738 CHECK_EQ(4.4, d.f);
739 CHECK_EQ(5.5, d.g); 739 CHECK_EQ(5.5, d.g);
740 CHECK_EQ(6.6, d.h); 740 CHECK_EQ(6.6, d.h);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 836
837 f.a = 1.0; 837 f.a = 1.0;
838 f.b = 2.0; 838 f.b = 2.0;
839 f.c = 3.0; 839 f.c = 3.0;
840 f.d = 4.0; 840 f.d = 4.0;
841 f.e = 5.0; 841 f.e = 5.0;
842 f.f = 6.0; 842 f.f = 6.0;
843 f.g = 7.0; 843 f.g = 7.0;
844 f.h = 8.0; 844 f.h = 8.0;
845 845
846 Object* dummy = CALL_GENERATED_CODE(fn, &d, &f, 0, 0, 0); 846 Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0);
847 USE(dummy); 847 USE(dummy);
848 848
849 CHECK_EQ(7.7, d.a); 849 CHECK_EQ(7.7, d.a);
850 CHECK_EQ(8.8, d.b); 850 CHECK_EQ(8.8, d.b);
851 CHECK_EQ(1.1, d.c); 851 CHECK_EQ(1.1, d.c);
852 CHECK_EQ(2.2, d.d); 852 CHECK_EQ(2.2, d.d);
853 CHECK_EQ(3.3, d.e); 853 CHECK_EQ(3.3, d.e);
854 CHECK_EQ(4.4, d.f); 854 CHECK_EQ(4.4, d.f);
855 CHECK_EQ(5.5, d.g); 855 CHECK_EQ(5.5, d.g);
856 CHECK_EQ(6.6, d.h); 856 CHECK_EQ(6.6, d.h);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 948
949 f.a = 1.0; 949 f.a = 1.0;
950 f.b = 2.0; 950 f.b = 2.0;
951 f.c = 3.0; 951 f.c = 3.0;
952 f.d = 4.0; 952 f.d = 4.0;
953 f.e = 5.0; 953 f.e = 5.0;
954 f.f = 6.0; 954 f.f = 6.0;
955 f.g = 7.0; 955 f.g = 7.0;
956 f.h = 8.0; 956 f.h = 8.0;
957 957
958 Object* dummy = CALL_GENERATED_CODE(fn, &d, &f, 0, 0, 0); 958 Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0);
959 USE(dummy); 959 USE(dummy);
960 960
961 CHECK_EQ(7.7, d.a); 961 CHECK_EQ(7.7, d.a);
962 CHECK_EQ(8.8, d.b); 962 CHECK_EQ(8.8, d.b);
963 CHECK_EQ(1.1, d.c); 963 CHECK_EQ(1.1, d.c);
964 CHECK_EQ(2.2, d.d); 964 CHECK_EQ(2.2, d.d);
965 CHECK_EQ(3.3, d.e); 965 CHECK_EQ(3.3, d.e);
966 CHECK_EQ(4.4, d.f); 966 CHECK_EQ(4.4, d.f);
967 CHECK_EQ(5.5, d.g); 967 CHECK_EQ(5.5, d.g);
968 CHECK_EQ(6.6, d.h); 968 CHECK_EQ(6.6, d.h);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 assm.GetCode(&desc); 1028 assm.GetCode(&desc);
1029 Object* code = isolate->heap()->CreateCode( 1029 Object* code = isolate->heap()->CreateCode(
1030 desc, 1030 desc,
1031 Code::ComputeFlags(Code::STUB), 1031 Code::ComputeFlags(Code::STUB),
1032 Handle<Code>())->ToObjectChecked(); 1032 Handle<Code>())->ToObjectChecked();
1033 CHECK(code->IsCode()); 1033 CHECK(code->IsCode());
1034 #ifdef DEBUG 1034 #ifdef DEBUG
1035 Code::cast(code)->Print(); 1035 Code::cast(code)->Print();
1036 #endif 1036 #endif
1037 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 1037 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
1038 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0); 1038 Object* dummy = CALL_GENERATED_CODE(isolate, f, &i, 0, 0, 0, 0);
1039 USE(dummy); 1039 USE(dummy);
1040 1040
1041 CHECK_EQ(0xabcd0001, i.a); 1041 CHECK_EQ(0xabcd0001, i.a);
1042 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); 1042 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b);
1043 CHECK_EQ(0x00000000, i.c); 1043 CHECK_EQ(0x00000000, i.c);
1044 CHECK_EQ(0xffffffff, i.d); 1044 CHECK_EQ(0xffffffff, i.d);
1045 } 1045 }
1046 1046
1047 1047
1048 TEST(12) { 1048 TEST(12) {
1049 // Test chaining of label usages within instructions (issue 1644). 1049 // Test chaining of label usages within instructions (issue 1644).
1050 CcTest::InitializeVM(); 1050 CcTest::InitializeVM();
1051 Isolate* isolate = Isolate::Current(); 1051 Isolate* isolate = Isolate::Current();
1052 HandleScope scope(isolate); 1052 HandleScope scope(isolate);
1053 1053
1054 Assembler assm(isolate, NULL, 0); 1054 Assembler assm(isolate, NULL, 0);
1055 Label target; 1055 Label target;
1056 __ b(eq, &target); 1056 __ b(eq, &target);
1057 __ b(ne, &target); 1057 __ b(ne, &target);
1058 __ bind(&target); 1058 __ bind(&target);
1059 __ nop(); 1059 __ nop();
1060 } 1060 }
1061 #endif 1061 #endif
1062 1062
1063 #undef __ 1063 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-mips64.cc ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698