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-disasm-ia32.cc

Issue 6670119: VM initialization refactoring. (Closed)
Patch Set: Created 9 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
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 52
53 static void DummyStaticFunction(Object* result) { 53 static void DummyStaticFunction(Object* result) {
54 } 54 }
55 55
56 56
57 TEST(DisasmIa320) { 57 TEST(DisasmIa320) {
58 InitializeVM(); 58 InitializeVM();
59 v8::HandleScope scope; 59 v8::HandleScope scope;
60 v8::internal::byte buffer[2048]; 60 v8::internal::byte buffer[2048];
61 Assembler assm(buffer, sizeof buffer); 61 Assembler assm(Isolate::Current(), buffer, sizeof buffer);
62 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) 62 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging)
63 63
64 // Short immediate instructions 64 // Short immediate instructions
65 __ adc(eax, 12345678); 65 __ adc(eax, 12345678);
66 __ add(Operand(eax), Immediate(12345678)); 66 __ add(Operand(eax), Immediate(12345678));
67 __ or_(eax, 12345678); 67 __ or_(eax, 12345678);
68 __ sub(Operand(eax), Immediate(12345678)); 68 __ sub(Operand(eax), Immediate(12345678));
69 __ xor_(eax, 12345678); 69 __ xor_(eax, 12345678);
70 __ and_(eax, 12345678); 70 __ and_(eax, 12345678);
71 Handle<FixedArray> foo = FACTORY->NewFixedArray(10, TENURED); 71 Handle<FixedArray> foo = FACTORY->NewFixedArray(10, TENURED);
(...skipping 28 matching lines...) Expand all
100 __ cmp(edx, Operand(esp, 4)); 100 __ cmp(edx, Operand(esp, 4));
101 __ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000)); 101 __ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000));
102 Handle<FixedArray> foo2 = FACTORY->NewFixedArray(10, TENURED); 102 Handle<FixedArray> foo2 = FACTORY->NewFixedArray(10, TENURED);
103 __ cmp(ebx, foo2); 103 __ cmp(ebx, foo2);
104 __ cmpb(ebx, Operand(ebp, ecx, times_2, 0)); 104 __ cmpb(ebx, Operand(ebp, ecx, times_2, 0));
105 __ cmpb(Operand(ebp, ecx, times_2, 0), ebx); 105 __ cmpb(Operand(ebp, ecx, times_2, 0), ebx);
106 __ or_(edx, 3); 106 __ or_(edx, 3);
107 __ xor_(edx, 3); 107 __ xor_(edx, 3);
108 __ nop(); 108 __ nop();
109 { 109 {
110 CHECK(Isolate::Current()->cpu_features()->IsSupported(CPUID)); 110 CHECK(CpuFeatures::IsSupported(CPUID));
111 CpuFeatures::Scope fscope(CPUID); 111 CpuFeatures::Scope fscope(CPUID);
112 __ cpuid(); 112 __ cpuid();
113 } 113 }
114 { 114 {
115 CHECK(Isolate::Current()->cpu_features()->IsSupported(RDTSC)); 115 CHECK(CpuFeatures::IsSupported(RDTSC));
116 CpuFeatures::Scope fscope(RDTSC); 116 CpuFeatures::Scope fscope(RDTSC);
117 __ rdtsc(); 117 __ rdtsc();
118 } 118 }
119 __ movsx_b(edx, Operand(ecx)); 119 __ movsx_b(edx, Operand(ecx));
120 __ movsx_w(edx, Operand(ecx)); 120 __ movsx_w(edx, Operand(ecx));
121 __ movzx_b(edx, Operand(ecx)); 121 __ movzx_b(edx, Operand(ecx));
122 __ movzx_w(edx, Operand(ecx)); 122 __ movzx_w(edx, Operand(ecx));
123 123
124 __ nop(); 124 __ nop();
125 __ imul(edx, Operand(ecx)); 125 __ imul(edx, Operand(ecx));
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 __ fdiv(3); 368 __ fdiv(3);
369 369
370 __ faddp(3); 370 __ faddp(3);
371 __ fsubp(3); 371 __ fsubp(3);
372 __ fmulp(3); 372 __ fmulp(3);
373 __ fdivp(3); 373 __ fdivp(3);
374 __ fcompp(); 374 __ fcompp();
375 __ fwait(); 375 __ fwait();
376 __ nop(); 376 __ nop();
377 { 377 {
378 if (Isolate::Current()->cpu_features()->IsSupported(SSE2)) { 378 if (CpuFeatures::IsSupported(SSE2)) {
379 CpuFeatures::Scope fscope(SSE2); 379 CpuFeatures::Scope fscope(SSE2);
380 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); 380 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000));
381 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); 381 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000));
382 __ addsd(xmm1, xmm0); 382 __ addsd(xmm1, xmm0);
383 __ mulsd(xmm1, xmm0); 383 __ mulsd(xmm1, xmm0);
384 __ subsd(xmm1, xmm0); 384 __ subsd(xmm1, xmm0);
385 __ divsd(xmm1, xmm0); 385 __ divsd(xmm1, xmm0);
386 __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000)); 386 __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000));
387 __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1); 387 __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1);
388 __ ucomisd(xmm0, xmm1); 388 __ ucomisd(xmm0, xmm1);
389 389
390 // 128 bit move instructions. 390 // 128 bit move instructions.
391 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); 391 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000));
392 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0); 392 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0);
393 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); 393 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000));
394 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0); 394 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0);
395 } 395 }
396 } 396 }
397 397
398 // cmov. 398 // cmov.
399 { 399 {
400 if (Isolate::Current()->cpu_features()->IsSupported(CMOV)) { 400 if (CpuFeatures::IsSupported(CMOV)) {
401 CpuFeatures::Scope use_cmov(CMOV); 401 CpuFeatures::Scope use_cmov(CMOV);
402 __ cmov(overflow, eax, Operand(eax, 0)); 402 __ cmov(overflow, eax, Operand(eax, 0));
403 __ cmov(no_overflow, eax, Operand(eax, 1)); 403 __ cmov(no_overflow, eax, Operand(eax, 1));
404 __ cmov(below, eax, Operand(eax, 2)); 404 __ cmov(below, eax, Operand(eax, 2));
405 __ cmov(above_equal, eax, Operand(eax, 3)); 405 __ cmov(above_equal, eax, Operand(eax, 3));
406 __ cmov(equal, eax, Operand(ebx, 0)); 406 __ cmov(equal, eax, Operand(ebx, 0));
407 __ cmov(not_equal, eax, Operand(ebx, 1)); 407 __ cmov(not_equal, eax, Operand(ebx, 1));
408 __ cmov(below_equal, eax, Operand(ebx, 2)); 408 __ cmov(below_equal, eax, Operand(ebx, 2));
409 __ cmov(above, eax, Operand(ebx, 3)); 409 __ cmov(above, eax, Operand(ebx, 3));
410 __ cmov(sign, eax, Operand(ecx, 0)); 410 __ cmov(sign, eax, Operand(ecx, 0));
411 __ cmov(not_sign, eax, Operand(ecx, 1)); 411 __ cmov(not_sign, eax, Operand(ecx, 1));
412 __ cmov(parity_even, eax, Operand(ecx, 2)); 412 __ cmov(parity_even, eax, Operand(ecx, 2));
413 __ cmov(parity_odd, eax, Operand(ecx, 3)); 413 __ cmov(parity_odd, eax, Operand(ecx, 3));
414 __ cmov(less, eax, Operand(edx, 0)); 414 __ cmov(less, eax, Operand(edx, 0));
415 __ cmov(greater_equal, eax, Operand(edx, 1)); 415 __ cmov(greater_equal, eax, Operand(edx, 1));
416 __ cmov(less_equal, eax, Operand(edx, 2)); 416 __ cmov(less_equal, eax, Operand(edx, 2));
417 __ cmov(greater, eax, Operand(edx, 3)); 417 __ cmov(greater, eax, Operand(edx, 3));
418 } 418 }
419 } 419 }
420 420
421 // andpd, cmpltsd, movaps, psllq, psrlq, por. 421 // andpd, cmpltsd, movaps, psllq, psrlq, por.
422 { 422 {
423 if (Isolate::Current()->cpu_features()->IsSupported(SSE2)) { 423 if (CpuFeatures::IsSupported(SSE2)) {
424 CpuFeatures::Scope fscope(SSE2); 424 CpuFeatures::Scope fscope(SSE2);
425 __ andpd(xmm0, xmm1); 425 __ andpd(xmm0, xmm1);
426 __ andpd(xmm1, xmm2); 426 __ andpd(xmm1, xmm2);
427 427
428 __ cmpltsd(xmm0, xmm1); 428 __ cmpltsd(xmm0, xmm1);
429 __ cmpltsd(xmm1, xmm2); 429 __ cmpltsd(xmm1, xmm2);
430 430
431 __ movaps(xmm0, xmm1); 431 __ movaps(xmm0, xmm1);
432 __ movaps(xmm1, xmm2); 432 __ movaps(xmm1, xmm2);
433 433
434 __ psllq(xmm0, 17); 434 __ psllq(xmm0, 17);
435 __ psllq(xmm1, 42); 435 __ psllq(xmm1, 42);
436 436
437 __ psllq(xmm0, xmm1); 437 __ psllq(xmm0, xmm1);
438 __ psllq(xmm1, xmm2); 438 __ psllq(xmm1, xmm2);
439 439
440 __ psrlq(xmm0, 17); 440 __ psrlq(xmm0, 17);
441 __ psrlq(xmm1, 42); 441 __ psrlq(xmm1, 42);
442 442
443 __ psrlq(xmm0, xmm1); 443 __ psrlq(xmm0, xmm1);
444 __ psrlq(xmm1, xmm2); 444 __ psrlq(xmm1, xmm2);
445 445
446 __ por(xmm0, xmm1); 446 __ por(xmm0, xmm1);
447 __ por(xmm1, xmm2); 447 __ por(xmm1, xmm2);
448 } 448 }
449 } 449 }
450 450
451 { 451 {
452 if (Isolate::Current()->cpu_features()->IsSupported(SSE4_1)) { 452 if (CpuFeatures::IsSupported(SSE4_1)) {
453 CpuFeatures::Scope scope(SSE4_1); 453 CpuFeatures::Scope scope(SSE4_1);
454 __ pextrd(Operand(eax), xmm0, 1); 454 __ pextrd(Operand(eax), xmm0, 1);
455 __ pinsrd(xmm1, Operand(eax), 0); 455 __ pinsrd(xmm1, Operand(eax), 0);
456 } 456 }
457 } 457 }
458 458
459 __ ret(0); 459 __ ret(0);
460 460
461 CodeDesc desc; 461 CodeDesc desc;
462 assm.GetCode(&desc); 462 assm.GetCode(&desc);
463 Object* code = HEAP->CreateCode( 463 Object* code = HEAP->CreateCode(
464 desc, 464 desc,
465 Code::ComputeFlags(Code::STUB), 465 Code::ComputeFlags(Code::STUB),
466 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); 466 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
467 CHECK(code->IsCode()); 467 CHECK(code->IsCode());
468 #ifdef OBJECT_PRINT 468 #ifdef OBJECT_PRINT
469 Code::cast(code)->Print(); 469 Code::cast(code)->Print();
470 byte* begin = Code::cast(code)->instruction_start(); 470 byte* begin = Code::cast(code)->instruction_start();
471 byte* end = begin + Code::cast(code)->instruction_size(); 471 byte* end = begin + Code::cast(code)->instruction_size();
472 disasm::Disassembler::Disassemble(stdout, begin, end); 472 disasm::Disassembler::Disassemble(stdout, begin, end);
473 #endif 473 #endif
474 } 474 }
475 475
476 #undef __ 476 #undef __
OLDNEW
« src/v8.cc ('K') | « test/cctest/test-assembler-ia32.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698