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

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

Issue 235153003: Handlify code allocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 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 | « src/x64/assembler-x64.cc ('k') | test/cctest/test-assembler-arm64.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 Isolate* isolate = CcTest::i_isolate(); 50 Isolate* isolate = CcTest::i_isolate();
51 HandleScope scope(isolate); 51 HandleScope scope(isolate);
52 52
53 Assembler assm(isolate, NULL, 0); 53 Assembler assm(isolate, NULL, 0);
54 54
55 __ add(r0, r0, Operand(r1)); 55 __ add(r0, r0, Operand(r1));
56 __ mov(pc, Operand(lr)); 56 __ mov(pc, Operand(lr));
57 57
58 CodeDesc desc; 58 CodeDesc desc;
59 assm.GetCode(&desc); 59 assm.GetCode(&desc);
60 Object* code = isolate->heap()->CreateCode( 60 Handle<Code> code = isolate->factory()->NewCode(
61 desc, 61 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
62 Code::ComputeFlags(Code::STUB),
63 Handle<Code>())->ToObjectChecked();
64 CHECK(code->IsCode());
65 #ifdef DEBUG 62 #ifdef DEBUG
66 Code::cast(code)->Print(); 63 code->Print();
67 #endif 64 #endif
68 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); 65 F2 f = FUNCTION_CAST<F2>(code->entry());
69 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); 66 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0));
70 ::printf("f() = %d\n", res); 67 ::printf("f() = %d\n", res);
71 CHECK_EQ(7, res); 68 CHECK_EQ(7, res);
72 } 69 }
73 70
74 71
75 TEST(1) { 72 TEST(1) {
76 CcTest::InitializeVM(); 73 CcTest::InitializeVM();
77 Isolate* isolate = CcTest::i_isolate(); 74 Isolate* isolate = CcTest::i_isolate();
78 HandleScope scope(isolate); 75 HandleScope scope(isolate);
79 76
80 Assembler assm(isolate, NULL, 0); 77 Assembler assm(isolate, NULL, 0);
81 Label L, C; 78 Label L, C;
82 79
83 __ mov(r1, Operand(r0)); 80 __ mov(r1, Operand(r0));
84 __ mov(r0, Operand::Zero()); 81 __ mov(r0, Operand::Zero());
85 __ b(&C); 82 __ b(&C);
86 83
87 __ bind(&L); 84 __ bind(&L);
88 __ add(r0, r0, Operand(r1)); 85 __ add(r0, r0, Operand(r1));
89 __ sub(r1, r1, Operand(1)); 86 __ sub(r1, r1, Operand(1));
90 87
91 __ bind(&C); 88 __ bind(&C);
92 __ teq(r1, Operand::Zero()); 89 __ teq(r1, Operand::Zero());
93 __ b(ne, &L); 90 __ b(ne, &L);
94 __ mov(pc, Operand(lr)); 91 __ mov(pc, Operand(lr));
95 92
96 CodeDesc desc; 93 CodeDesc desc;
97 assm.GetCode(&desc); 94 assm.GetCode(&desc);
98 Object* code = isolate->heap()->CreateCode( 95 Handle<Code> code = isolate->factory()->NewCode(
99 desc, 96 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
100 Code::ComputeFlags(Code::STUB),
101 Handle<Code>())->ToObjectChecked();
102 CHECK(code->IsCode());
103 #ifdef DEBUG 97 #ifdef DEBUG
104 Code::cast(code)->Print(); 98 code->Print();
105 #endif 99 #endif
106 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 100 F1 f = FUNCTION_CAST<F1>(code->entry());
107 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); 101 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0));
108 ::printf("f() = %d\n", res); 102 ::printf("f() = %d\n", res);
109 CHECK_EQ(5050, res); 103 CHECK_EQ(5050, res);
110 } 104 }
111 105
112 106
113 TEST(2) { 107 TEST(2) {
114 CcTest::InitializeVM(); 108 CcTest::InitializeVM();
115 Isolate* isolate = CcTest::i_isolate(); 109 Isolate* isolate = CcTest::i_isolate();
116 HandleScope scope(isolate); 110 HandleScope scope(isolate);
(...skipping 18 matching lines...) Expand all
135 __ RecordComment("dead code, just testing relocations"); 129 __ RecordComment("dead code, just testing relocations");
136 __ mov(r0, Operand(isolate->factory()->true_value())); 130 __ mov(r0, Operand(isolate->factory()->true_value()));
137 __ RecordComment("dead code, just testing immediate operands"); 131 __ RecordComment("dead code, just testing immediate operands");
138 __ mov(r0, Operand(-1)); 132 __ mov(r0, Operand(-1));
139 __ mov(r0, Operand(0xFF000000)); 133 __ mov(r0, Operand(0xFF000000));
140 __ mov(r0, Operand(0xF0F0F0F0)); 134 __ mov(r0, Operand(0xF0F0F0F0));
141 __ mov(r0, Operand(0xFFF0FFFF)); 135 __ mov(r0, Operand(0xFFF0FFFF));
142 136
143 CodeDesc desc; 137 CodeDesc desc;
144 assm.GetCode(&desc); 138 assm.GetCode(&desc);
145 Object* code = isolate->heap()->CreateCode( 139 Handle<Code> code = isolate->factory()->NewCode(
146 desc, 140 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
147 Code::ComputeFlags(Code::STUB),
148 Handle<Code>())->ToObjectChecked();
149 CHECK(code->IsCode());
150 #ifdef DEBUG 141 #ifdef DEBUG
151 Code::cast(code)->Print(); 142 code->Print();
152 #endif 143 #endif
153 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 144 F1 f = FUNCTION_CAST<F1>(code->entry());
154 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); 145 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0));
155 ::printf("f() = %d\n", res); 146 ::printf("f() = %d\n", res);
156 CHECK_EQ(3628800, res); 147 CHECK_EQ(3628800, res);
157 } 148 }
158 149
159 150
160 TEST(3) { 151 TEST(3) {
161 CcTest::InitializeVM(); 152 CcTest::InitializeVM();
162 Isolate* isolate = CcTest::i_isolate(); 153 Isolate* isolate = CcTest::i_isolate();
163 HandleScope scope(isolate); 154 HandleScope scope(isolate);
(...skipping 20 matching lines...) Expand all
184 __ mov(r2, Operand(r2, LSL, 2)); 175 __ mov(r2, Operand(r2, LSL, 2));
185 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c))); 176 __ strb(r2, MemOperand(r4, OFFSET_OF(T, c)));
186 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s))); 177 __ ldrsh(r2, MemOperand(r4, OFFSET_OF(T, s)));
187 __ add(r0, r2, Operand(r0)); 178 __ add(r0, r2, Operand(r0));
188 __ mov(r2, Operand(r2, ASR, 3)); 179 __ mov(r2, Operand(r2, ASR, 3));
189 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s))); 180 __ strh(r2, MemOperand(r4, OFFSET_OF(T, s)));
190 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); 181 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
191 182
192 CodeDesc desc; 183 CodeDesc desc;
193 assm.GetCode(&desc); 184 assm.GetCode(&desc);
194 Object* code = isolate->heap()->CreateCode( 185 Handle<Code> code = isolate->factory()->NewCode(
195 desc, 186 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
196 Code::ComputeFlags(Code::STUB),
197 Handle<Code>())->ToObjectChecked();
198 CHECK(code->IsCode());
199 #ifdef DEBUG 187 #ifdef DEBUG
200 Code::cast(code)->Print(); 188 code->Print();
201 #endif 189 #endif
202 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 190 F3 f = FUNCTION_CAST<F3>(code->entry());
203 t.i = 100000; 191 t.i = 100000;
204 t.c = 10; 192 t.c = 10;
205 t.s = 1000; 193 t.s = 1000;
206 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); 194 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0));
207 ::printf("f() = %d\n", res); 195 ::printf("f() = %d\n", res);
208 CHECK_EQ(101010, res); 196 CHECK_EQ(101010, res);
209 CHECK_EQ(100000/2, t.i); 197 CHECK_EQ(100000/2, t.i);
210 CHECK_EQ(10*4, t.c); 198 CHECK_EQ(10*4, t.c);
211 CHECK_EQ(1000/8, t.s); 199 CHECK_EQ(1000/8, t.s);
212 } 200 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 __ vneg(d0, d1); 298 __ vneg(d0, d1);
311 __ vstr(d0, r4, OFFSET_OF(T, m)); 299 __ vstr(d0, r4, OFFSET_OF(T, m));
312 __ vldr(d1, r4, OFFSET_OF(T, n)); 300 __ vldr(d1, r4, OFFSET_OF(T, n));
313 __ vneg(d0, d1); 301 __ vneg(d0, d1);
314 __ vstr(d0, r4, OFFSET_OF(T, n)); 302 __ vstr(d0, r4, OFFSET_OF(T, n));
315 303
316 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); 304 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
317 305
318 CodeDesc desc; 306 CodeDesc desc;
319 assm.GetCode(&desc); 307 assm.GetCode(&desc);
320 Object* code = isolate->heap()->CreateCode( 308 Handle<Code> code = isolate->factory()->NewCode(
321 desc, 309 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
322 Code::ComputeFlags(Code::STUB),
323 Handle<Code>())->ToObjectChecked();
324 CHECK(code->IsCode());
325 #ifdef DEBUG 310 #ifdef DEBUG
326 Code::cast(code)->Print(); 311 code->Print();
327 #endif 312 #endif
328 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 313 F3 f = FUNCTION_CAST<F3>(code->entry());
329 t.a = 1.5; 314 t.a = 1.5;
330 t.b = 2.75; 315 t.b = 2.75;
331 t.c = 17.17; 316 t.c = 17.17;
332 t.d = 0.0; 317 t.d = 0.0;
333 t.e = 0.0; 318 t.e = 0.0;
334 t.f = 0.0; 319 t.f = 0.0;
335 t.g = -2718.2818; 320 t.g = -2718.2818;
336 t.h = 31415926.5; 321 t.h = 31415926.5;
337 t.i = 0; 322 t.i = 0;
338 t.j = 0; 323 t.j = 0;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. 358 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010.
374 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 359 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555
375 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 360 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11
376 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 361 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15
377 __ mov(r1, Operand(7)); 362 __ mov(r1, Operand(7));
378 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 363 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7
379 __ mov(pc, Operand(lr)); 364 __ mov(pc, Operand(lr));
380 365
381 CodeDesc desc; 366 CodeDesc desc;
382 assm.GetCode(&desc); 367 assm.GetCode(&desc);
383 Object* code = isolate->heap()->CreateCode( 368 Handle<Code> code = isolate->factory()->NewCode(
384 desc, 369 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
385 Code::ComputeFlags(Code::STUB),
386 Handle<Code>())->ToObjectChecked();
387 CHECK(code->IsCode());
388 #ifdef DEBUG 370 #ifdef DEBUG
389 Code::cast(code)->Print(); 371 code->Print();
390 #endif 372 #endif
391 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 373 F1 f = FUNCTION_CAST<F1>(code->entry());
392 int res = reinterpret_cast<int>( 374 int res = reinterpret_cast<int>(
393 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); 375 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0));
394 ::printf("f() = %d\n", res); 376 ::printf("f() = %d\n", res);
395 CHECK_EQ(-7, res); 377 CHECK_EQ(-7, res);
396 } 378 }
397 } 379 }
398 380
399 381
400 TEST(6) { 382 TEST(6) {
401 // Test saturating instructions. 383 // Test saturating instructions.
402 CcTest::InitializeVM(); 384 CcTest::InitializeVM();
403 Isolate* isolate = CcTest::i_isolate(); 385 Isolate* isolate = CcTest::i_isolate();
404 HandleScope scope(isolate); 386 HandleScope scope(isolate);
405 387
406 Assembler assm(isolate, NULL, 0); 388 Assembler assm(isolate, NULL, 0);
407 389
408 if (CpuFeatures::IsSupported(ARMv7)) { 390 if (CpuFeatures::IsSupported(ARMv7)) {
409 CpuFeatureScope scope(&assm, ARMv7); 391 CpuFeatureScope scope(&assm, ARMv7);
410 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. 392 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF.
411 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. 393 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F.
412 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. 394 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0.
413 __ add(r0, r1, Operand(r2)); 395 __ add(r0, r1, Operand(r2));
414 __ add(r0, r0, Operand(r3)); 396 __ add(r0, r0, Operand(r3));
415 __ mov(pc, Operand(lr)); 397 __ mov(pc, Operand(lr));
416 398
417 CodeDesc desc; 399 CodeDesc desc;
418 assm.GetCode(&desc); 400 assm.GetCode(&desc);
419 Object* code = isolate->heap()->CreateCode( 401 Handle<Code> code = isolate->factory()->NewCode(
420 desc, 402 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
421 Code::ComputeFlags(Code::STUB),
422 Handle<Code>())->ToObjectChecked();
423 CHECK(code->IsCode());
424 #ifdef DEBUG 403 #ifdef DEBUG
425 Code::cast(code)->Print(); 404 code->Print();
426 #endif 405 #endif
427 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 406 F1 f = FUNCTION_CAST<F1>(code->entry());
428 int res = reinterpret_cast<int>( 407 int res = reinterpret_cast<int>(
429 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0)); 408 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0));
430 ::printf("f() = %d\n", res); 409 ::printf("f() = %d\n", res);
431 CHECK_EQ(382, res); 410 CHECK_EQ(382, res);
432 } 411 }
433 } 412 }
434 413
435 414
436 enum VCVTTypes { 415 enum VCVTTypes {
437 s32_f64, 416 s32_f64,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 __ mov(pc, Operand(lr)); 464 __ mov(pc, Operand(lr));
486 465
487 // The exception behaviour is not what we expected. 466 // The exception behaviour is not what we expected.
488 // Load a special value and return. 467 // Load a special value and return.
489 __ bind(&wrong_exception); 468 __ bind(&wrong_exception);
490 __ mov(r0, Operand(11223344)); 469 __ mov(r0, Operand(11223344));
491 __ mov(pc, Operand(lr)); 470 __ mov(pc, Operand(lr));
492 471
493 CodeDesc desc; 472 CodeDesc desc;
494 assm.GetCode(&desc); 473 assm.GetCode(&desc);
495 Object* code = isolate->heap()->CreateCode( 474 Handle<Code> code = isolate->factory()->NewCode(
496 desc, 475 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
497 Code::ComputeFlags(Code::STUB),
498 Handle<Code>())->ToObjectChecked();
499 CHECK(code->IsCode());
500 #ifdef DEBUG 476 #ifdef DEBUG
501 Code::cast(code)->Print(); 477 code->Print();
502 #endif 478 #endif
503 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 479 F1 f = FUNCTION_CAST<F1>(code->entry());
504 int res = reinterpret_cast<int>( 480 int res = reinterpret_cast<int>(
505 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); 481 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0));
506 ::printf("res = %d\n", res); 482 ::printf("res = %d\n", res);
507 CHECK_EQ(expected, res); 483 CHECK_EQ(expected, res);
508 } 484 }
509 } 485 }
510 486
511 487
512 TEST(7) { 488 TEST(7) {
513 CcTest::InitializeVM(); 489 CcTest::InitializeVM();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 __ vldm(ia_w, r4, s4, s7); 647 __ vldm(ia_w, r4, s4, s7);
672 648
673 __ add(r4, r1, Operand(OFFSET_OF(F, a))); 649 __ add(r4, r1, Operand(OFFSET_OF(F, a)));
674 __ vstm(ia_w, r4, s6, s7); 650 __ vstm(ia_w, r4, s6, s7);
675 __ vstm(ia_w, r4, s0, s5); 651 __ vstm(ia_w, r4, s0, s5);
676 652
677 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); 653 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
678 654
679 CodeDesc desc; 655 CodeDesc desc;
680 assm.GetCode(&desc); 656 assm.GetCode(&desc);
681 Object* code = isolate->heap()->CreateCode( 657 Handle<Code> code = isolate->factory()->NewCode(
682 desc, 658 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
683 Code::ComputeFlags(Code::STUB),
684 Handle<Code>())->ToObjectChecked();
685 CHECK(code->IsCode());
686 #ifdef DEBUG 659 #ifdef DEBUG
687 Code::cast(code)->Print(); 660 code->Print();
688 #endif 661 #endif
689 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); 662 F4 fn = FUNCTION_CAST<F4>(code->entry());
690 d.a = 1.1; 663 d.a = 1.1;
691 d.b = 2.2; 664 d.b = 2.2;
692 d.c = 3.3; 665 d.c = 3.3;
693 d.d = 4.4; 666 d.d = 4.4;
694 d.e = 5.5; 667 d.e = 5.5;
695 d.f = 6.6; 668 d.f = 6.6;
696 d.g = 7.7; 669 d.g = 7.7;
697 d.h = 8.8; 670 d.h = 8.8;
698 671
699 f.a = 1.0; 672 f.a = 1.0;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 756
784 __ add(r4, r1, Operand(OFFSET_OF(F, a))); 757 __ add(r4, r1, Operand(OFFSET_OF(F, a)));
785 __ vstm(ia, r4, s6, s7); 758 __ vstm(ia, r4, s6, s7);
786 __ add(r4, r4, Operand(2 * 4)); 759 __ add(r4, r4, Operand(2 * 4));
787 __ vstm(ia, r4, s0, s5); 760 __ vstm(ia, r4, s0, s5);
788 761
789 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); 762 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
790 763
791 CodeDesc desc; 764 CodeDesc desc;
792 assm.GetCode(&desc); 765 assm.GetCode(&desc);
793 Object* code = isolate->heap()->CreateCode( 766 Handle<Code> code = isolate->factory()->NewCode(
794 desc, 767 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
795 Code::ComputeFlags(Code::STUB),
796 Handle<Code>())->ToObjectChecked();
797 CHECK(code->IsCode());
798 #ifdef DEBUG 768 #ifdef DEBUG
799 Code::cast(code)->Print(); 769 code->Print();
800 #endif 770 #endif
801 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); 771 F4 fn = FUNCTION_CAST<F4>(code->entry());
802 d.a = 1.1; 772 d.a = 1.1;
803 d.b = 2.2; 773 d.b = 2.2;
804 d.c = 3.3; 774 d.c = 3.3;
805 d.d = 4.4; 775 d.d = 4.4;
806 d.e = 5.5; 776 d.e = 5.5;
807 d.f = 6.6; 777 d.f = 6.6;
808 d.g = 7.7; 778 d.g = 7.7;
809 d.h = 8.8; 779 d.h = 8.8;
810 780
811 f.a = 1.0; 781 f.a = 1.0;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 __ vldm(db_w, r4, s0, s3); 861 __ vldm(db_w, r4, s0, s3);
892 862
893 __ add(r4, r1, Operand(OFFSET_OF(F, h) + 4)); 863 __ add(r4, r1, Operand(OFFSET_OF(F, h) + 4));
894 __ vstm(db_w, r4, s0, s5); 864 __ vstm(db_w, r4, s0, s5);
895 __ vstm(db_w, r4, s6, s7); 865 __ vstm(db_w, r4, s6, s7);
896 866
897 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); 867 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
898 868
899 CodeDesc desc; 869 CodeDesc desc;
900 assm.GetCode(&desc); 870 assm.GetCode(&desc);
901 Object* code = isolate->heap()->CreateCode( 871 Handle<Code> code = isolate->factory()->NewCode(
902 desc, 872 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
903 Code::ComputeFlags(Code::STUB),
904 Handle<Code>())->ToObjectChecked();
905 CHECK(code->IsCode());
906 #ifdef DEBUG 873 #ifdef DEBUG
907 Code::cast(code)->Print(); 874 code->Print();
908 #endif 875 #endif
909 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); 876 F4 fn = FUNCTION_CAST<F4>(code->entry());
910 d.a = 1.1; 877 d.a = 1.1;
911 d.b = 2.2; 878 d.b = 2.2;
912 d.c = 3.3; 879 d.c = 3.3;
913 d.d = 4.4; 880 d.d = 4.4;
914 d.e = 5.5; 881 d.e = 5.5;
915 d.f = 6.6; 882 d.f = 6.6;
916 d.g = 7.7; 883 d.g = 7.7;
917 d.h = 8.8; 884 d.h = 8.8;
918 885
919 f.a = 1.0; 886 f.a = 1.0;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 __ mov(r1, Operand(0xffffffff)); 955 __ mov(r1, Operand(0xffffffff));
989 __ mov(r2, Operand::Zero()); 956 __ mov(r2, Operand::Zero());
990 __ mov(r3, Operand(r2, ASR, 1), SetCC); // Unset the carry. 957 __ mov(r3, Operand(r2, ASR, 1), SetCC); // Unset the carry.
991 __ adc(r3, r1, Operand(r2)); 958 __ adc(r3, r1, Operand(r2));
992 __ str(r3, MemOperand(r0, OFFSET_OF(I, d))); 959 __ str(r3, MemOperand(r0, OFFSET_OF(I, d)));
993 960
994 __ mov(pc, Operand(lr)); 961 __ mov(pc, Operand(lr));
995 962
996 CodeDesc desc; 963 CodeDesc desc;
997 assm.GetCode(&desc); 964 assm.GetCode(&desc);
998 Object* code = isolate->heap()->CreateCode( 965 Handle<Code> code = isolate->factory()->NewCode(
999 desc, 966 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1000 Code::ComputeFlags(Code::STUB),
1001 Handle<Code>())->ToObjectChecked();
1002 CHECK(code->IsCode());
1003 #ifdef DEBUG 967 #ifdef DEBUG
1004 Code::cast(code)->Print(); 968 code->Print();
1005 #endif 969 #endif
1006 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 970 F3 f = FUNCTION_CAST<F3>(code->entry());
1007 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0); 971 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0);
1008 USE(dummy); 972 USE(dummy);
1009 973
1010 CHECK_EQ(0xabcd0001, i.a); 974 CHECK_EQ(0xabcd0001, i.a);
1011 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); 975 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b);
1012 CHECK_EQ(0x00000000, i.c); 976 CHECK_EQ(0x00000000, i.c);
1013 CHECK_EQ(0xffffffff, i.d); 977 CHECK_EQ(0xffffffff, i.d);
1014 } 978 }
1015 979
1016 980
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 // Move d22 into low and high. 1082 // Move d22 into low and high.
1119 __ vmov(r4, VmovIndexLo, d22); 1083 __ vmov(r4, VmovIndexLo, d22);
1120 __ str(r4, MemOperand(r0, OFFSET_OF(T, low))); 1084 __ str(r4, MemOperand(r0, OFFSET_OF(T, low)));
1121 __ vmov(r4, VmovIndexHi, d22); 1085 __ vmov(r4, VmovIndexHi, d22);
1122 __ str(r4, MemOperand(r0, OFFSET_OF(T, high))); 1086 __ str(r4, MemOperand(r0, OFFSET_OF(T, high)));
1123 1087
1124 __ ldm(ia_w, sp, r4.bit() | pc.bit()); 1088 __ ldm(ia_w, sp, r4.bit() | pc.bit());
1125 1089
1126 CodeDesc desc; 1090 CodeDesc desc;
1127 assm.GetCode(&desc); 1091 assm.GetCode(&desc);
1128 Object* code = isolate->heap()->CreateCode( 1092 Handle<Code> code = isolate->factory()->NewCode(
1129 desc, 1093 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1130 Code::ComputeFlags(Code::STUB),
1131 Handle<Code>())->ToObjectChecked();
1132 CHECK(code->IsCode());
1133 #ifdef DEBUG 1094 #ifdef DEBUG
1134 Code::cast(code)->Print(); 1095 code->Print();
1135 #endif 1096 #endif
1136 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 1097 F3 f = FUNCTION_CAST<F3>(code->entry());
1137 t.a = 1.5; 1098 t.a = 1.5;
1138 t.b = 2.75; 1099 t.b = 2.75;
1139 t.c = 17.17; 1100 t.c = 17.17;
1140 t.x = 1.5; 1101 t.x = 1.5;
1141 t.y = 2.75; 1102 t.y = 2.75;
1142 t.z = 17.17; 1103 t.z = 17.17;
1143 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1104 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
1144 USE(dummy); 1105 USE(dummy);
1145 CHECK_EQ(14.7610017472335499, t.a); 1106 CHECK_EQ(14.7610017472335499, t.a);
1146 CHECK_EQ(3.84200491244266251, t.b); 1107 CHECK_EQ(3.84200491244266251, t.b);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 __ vstr(d2, r0, OFFSET_OF(T, sub_result)); 1154 __ vstr(d2, r0, OFFSET_OF(T, sub_result));
1194 __ vmul(d2, d0, d1); 1155 __ vmul(d2, d0, d1);
1195 __ vstr(d2, r0, OFFSET_OF(T, mul_result)); 1156 __ vstr(d2, r0, OFFSET_OF(T, mul_result));
1196 __ vdiv(d2, d0, d1); 1157 __ vdiv(d2, d0, d1);
1197 __ vstr(d2, r0, OFFSET_OF(T, div_result)); 1158 __ vstr(d2, r0, OFFSET_OF(T, div_result));
1198 1159
1199 __ mov(pc, Operand(lr)); 1160 __ mov(pc, Operand(lr));
1200 1161
1201 CodeDesc desc; 1162 CodeDesc desc;
1202 assm.GetCode(&desc); 1163 assm.GetCode(&desc);
1203 Object* code = isolate->heap()->CreateCode( 1164 Handle<Code> code = isolate->factory()->NewCode(
1204 desc, 1165 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1205 Code::ComputeFlags(Code::STUB),
1206 Handle<Code>())->ToObjectChecked();
1207 CHECK(code->IsCode());
1208 #ifdef DEBUG 1166 #ifdef DEBUG
1209 Code::cast(code)->Print(); 1167 code->Print();
1210 #endif 1168 #endif
1211 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 1169 F3 f = FUNCTION_CAST<F3>(code->entry());
1212 t.left = BitCast<double>(kHoleNanInt64); 1170 t.left = BitCast<double>(kHoleNanInt64);
1213 t.right = 1; 1171 t.right = 1;
1214 t.add_result = 0; 1172 t.add_result = 0;
1215 t.sub_result = 0; 1173 t.sub_result = 0;
1216 t.mul_result = 0; 1174 t.mul_result = 0;
1217 t.div_result = 0; 1175 t.div_result = 0;
1218 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1176 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
1219 USE(dummy); 1177 USE(dummy);
1220 const uint32_t kArmNanUpper32 = 0x7ff80000; 1178 const uint32_t kArmNanUpper32 = 0x7ff80000;
1221 const uint32_t kArmNanLower32 = 0x00000000; 1179 const uint32_t kArmNanLower32 = 0x00000000;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 __ add(r4, r0, Operand(OFFSET_OF(T, srcA0))); 1257 __ add(r4, r0, Operand(OFFSET_OF(T, srcA0)));
1300 __ vld1(Neon8, NeonListOperand(d1), NeonMemOperand(r4)); 1258 __ vld1(Neon8, NeonListOperand(d1), NeonMemOperand(r4));
1301 __ vmovl(NeonU8, q1, d1); 1259 __ vmovl(NeonU8, q1, d1);
1302 __ add(r4, r0, Operand(OFFSET_OF(T, dstA4))); 1260 __ add(r4, r0, Operand(OFFSET_OF(T, dstA4)));
1303 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); 1261 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4));
1304 1262
1305 __ ldm(ia_w, sp, r4.bit() | pc.bit()); 1263 __ ldm(ia_w, sp, r4.bit() | pc.bit());
1306 1264
1307 CodeDesc desc; 1265 CodeDesc desc;
1308 assm.GetCode(&desc); 1266 assm.GetCode(&desc);
1309 Object* code = isolate->heap()->CreateCode( 1267 Handle<Code> code = isolate->factory()->NewCode(
1310 desc, 1268 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1311 Code::ComputeFlags(Code::STUB),
1312 Handle<Code>())->ToObjectChecked();
1313 CHECK(code->IsCode());
1314 #ifdef DEBUG 1269 #ifdef DEBUG
1315 Code::cast(code)->Print(); 1270 code->Print();
1316 #endif 1271 #endif
1317 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 1272 F3 f = FUNCTION_CAST<F3>(code->entry());
1318 t.src0 = 0x01020304; 1273 t.src0 = 0x01020304;
1319 t.src1 = 0x11121314; 1274 t.src1 = 0x11121314;
1320 t.src2 = 0x21222324; 1275 t.src2 = 0x21222324;
1321 t.src3 = 0x31323334; 1276 t.src3 = 0x31323334;
1322 t.src4 = 0x41424344; 1277 t.src4 = 0x41424344;
1323 t.src5 = 0x51525354; 1278 t.src5 = 0x51525354;
1324 t.src6 = 0x61626364; 1279 t.src6 = 0x61626364;
1325 t.src7 = 0x71727374; 1280 t.src7 = 0x71727374;
1326 t.dst0 = 0; 1281 t.dst0 = 0;
1327 t.dst1 = 0; 1282 t.dst1 = 0;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst3))); 1359 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst3)));
1405 1360
1406 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src2))); 1361 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src2)));
1407 __ uxtab(r2, r0, Operand(r1, ROR, 8)); 1362 __ uxtab(r2, r0, Operand(r1, ROR, 8));
1408 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst4))); 1363 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst4)));
1409 1364
1410 __ ldm(ia_w, sp, r4.bit() | pc.bit()); 1365 __ ldm(ia_w, sp, r4.bit() | pc.bit());
1411 1366
1412 CodeDesc desc; 1367 CodeDesc desc;
1413 assm.GetCode(&desc); 1368 assm.GetCode(&desc);
1414 Object* code = isolate->heap()->CreateCode( 1369 Handle<Code> code = isolate->factory()->NewCode(
1415 desc, 1370 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1416 Code::ComputeFlags(Code::STUB),
1417 Handle<Code>())->ToObjectChecked();
1418 CHECK(code->IsCode());
1419 #ifdef DEBUG 1371 #ifdef DEBUG
1420 Code::cast(code)->Print(); 1372 code->Print();
1421 #endif 1373 #endif
1422 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 1374 F3 f = FUNCTION_CAST<F3>(code->entry());
1423 t.src0 = 0x01020304; 1375 t.src0 = 0x01020304;
1424 t.src1 = 0x11121314; 1376 t.src1 = 0x11121314;
1425 t.src2 = 0x11121300; 1377 t.src2 = 0x11121300;
1426 t.dst0 = 0; 1378 t.dst0 = 0;
1427 t.dst1 = 0; 1379 t.dst1 = 0;
1428 t.dst2 = 0; 1380 t.dst2 = 0;
1429 t.dst3 = 0; 1381 t.dst3 = 0;
1430 t.dst4 = 0; 1382 t.dst4 = 0;
1431 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1383 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
1432 USE(dummy); 1384 USE(dummy);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 __ ldr(r0, MemOperand(r3, OFFSET_OF(T, dividend))); 1441 __ ldr(r0, MemOperand(r3, OFFSET_OF(T, dividend)));
1490 __ ldr(r1, MemOperand(r3, OFFSET_OF(T, divisor))); 1442 __ ldr(r1, MemOperand(r3, OFFSET_OF(T, divisor)));
1491 1443
1492 __ sdiv(r2, r0, r1); 1444 __ sdiv(r2, r0, r1);
1493 __ str(r2, MemOperand(r3, OFFSET_OF(T, result))); 1445 __ str(r2, MemOperand(r3, OFFSET_OF(T, result)));
1494 1446
1495 __ bx(lr); 1447 __ bx(lr);
1496 1448
1497 CodeDesc desc; 1449 CodeDesc desc;
1498 assm.GetCode(&desc); 1450 assm.GetCode(&desc);
1499 Object* code = isolate->heap()->CreateCode( 1451 Handle<Code> code = isolate->factory()->NewCode(
1500 desc, 1452 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1501 Code::ComputeFlags(Code::STUB),
1502 Handle<Code>())->ToObjectChecked();
1503 CHECK(code->IsCode());
1504 #ifdef DEBUG 1453 #ifdef DEBUG
1505 Code::cast(code)->Print(); 1454 code->Print();
1506 #endif 1455 #endif
1507 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 1456 F3 f = FUNCTION_CAST<F3>(code->entry());
1508 Object* dummy; 1457 Object* dummy;
1509 TEST_SDIV(1073741824, kMinInt, -2); 1458 TEST_SDIV(1073741824, kMinInt, -2);
1510 TEST_SDIV(kMinInt, kMinInt, -1); 1459 TEST_SDIV(kMinInt, kMinInt, -1);
1511 TEST_SDIV(5, 10, 2); 1460 TEST_SDIV(5, 10, 2);
1512 TEST_SDIV(3, 10, 3); 1461 TEST_SDIV(3, 10, 3);
1513 TEST_SDIV(-5, 10, -2); 1462 TEST_SDIV(-5, 10, -2);
1514 TEST_SDIV(-3, 10, -3); 1463 TEST_SDIV(-3, 10, -3);
1515 TEST_SDIV(-5, -10, 2); 1464 TEST_SDIV(-5, -10, 2);
1516 TEST_SDIV(-3, -10, 3); 1465 TEST_SDIV(-3, -10, 3);
1517 TEST_SDIV(5, -10, -2); 1466 TEST_SDIV(5, -10, -2);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 __ ldr(r3, MemOperand(r3)); 1528 __ ldr(r3, MemOperand(r3));
1580 } 1529 }
1581 __ bind(&target_faraway); 1530 __ bind(&target_faraway);
1582 // r0 = r0 + 5 + 5 + 11 1531 // r0 = r0 + 5 + 5 + 11
1583 __ add(r0, r0, Operand(11)); 1532 __ add(r0, r0, Operand(11));
1584 1533
1585 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit()); 1534 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit());
1586 1535
1587 CodeDesc desc; 1536 CodeDesc desc;
1588 assm.GetCode(&desc); 1537 assm.GetCode(&desc);
1589 Handle<Code> code = isolate->factory()->NewCode(desc, 1538 Handle<Code> code = isolate->factory()->NewCode(
1590 Code::ComputeFlags(Code::STUB), code_object); 1539 desc, Code::ComputeFlags(Code::STUB), code_object);
1591 CHECK(code->IsCode());
1592 F1 f = FUNCTION_CAST<F1>(code->entry()); 1540 F1 f = FUNCTION_CAST<F1>(code->entry());
1593 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); 1541 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0));
1594 ::printf("f() = %d\n", res); 1542 ::printf("f() = %d\n", res);
1595 CHECK_EQ(42, res); 1543 CHECK_EQ(42, res);
1596 } 1544 }
1597 1545
1598 #undef __ 1546 #undef __
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/test-assembler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698