| OLD | NEW |
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #define __ assm. | 50 #define __ assm. |
| 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[1024]; | 60 v8::internal::byte buffer[2048]; |
| 61 Assembler assm(buffer, sizeof buffer); | 61 Assembler assm(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); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 __ and_(ebx, 12345); | 216 __ and_(ebx, 12345); |
| 217 | 217 |
| 218 __ cmp(ebx, 12345); | 218 __ cmp(ebx, 12345); |
| 219 __ cmp(Operand(ebx), Immediate(12)); | 219 __ cmp(Operand(ebx), Immediate(12)); |
| 220 __ cmp(Operand(edx, ecx, times_4, 10000), Immediate(12)); | 220 __ cmp(Operand(edx, ecx, times_4, 10000), Immediate(12)); |
| 221 | 221 |
| 222 __ or_(ebx, 12345); | 222 __ or_(ebx, 12345); |
| 223 | 223 |
| 224 __ sub(Operand(ebx), Immediate(12)); | 224 __ sub(Operand(ebx), Immediate(12)); |
| 225 __ sub(Operand(edx, ecx, times_4, 10000), Immediate(12)); | 225 __ sub(Operand(edx, ecx, times_4, 10000), Immediate(12)); |
| 226 __ subb(Operand(edx, ecx, times_4, 10000), 100); |
| 227 __ subb(Operand(eax), 100); |
| 228 __ subb(eax, Operand(edx, ecx, times_4, 10000)); |
| 226 | 229 |
| 227 __ xor_(ebx, 12345); | 230 __ xor_(ebx, 12345); |
| 228 | 231 |
| 229 __ imul(edx, ecx, 12); | 232 __ imul(edx, ecx, 12); |
| 230 __ imul(edx, ecx, 1000); | 233 __ imul(edx, ecx, 1000); |
| 231 | 234 |
| 232 | 235 __ rep_movs(); |
| 233 | 236 |
| 234 __ sub(edx, Operand(ebx, ecx, times_4, 10000)); | 237 __ sub(edx, Operand(ebx, ecx, times_4, 10000)); |
| 235 __ sub(edx, Operand(ebx)); | 238 __ sub(edx, Operand(ebx)); |
| 236 | 239 |
| 237 __ test(edx, Immediate(12345)); | 240 __ test(edx, Immediate(12345)); |
| 238 __ test(edx, Operand(ebx, ecx, times_8, 10000)); | 241 __ test(edx, Operand(ebx, ecx, times_8, 10000)); |
| 239 __ nop(); | 242 __ nop(); |
| 240 | 243 |
| 241 __ xor_(edx, 12345); | 244 __ xor_(edx, 12345); |
| 242 __ xor_(edx, Operand(ebx, ecx, times_8, 10000)); | 245 __ xor_(edx, Operand(ebx, ecx, times_8, 10000)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 CpuFeatures::Scope fscope(SSE2); | 361 CpuFeatures::Scope fscope(SSE2); |
| 359 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); | 362 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); |
| 360 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); | 363 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 361 __ addsd(xmm1, xmm0); | 364 __ addsd(xmm1, xmm0); |
| 362 __ mulsd(xmm1, xmm0); | 365 __ mulsd(xmm1, xmm0); |
| 363 __ subsd(xmm1, xmm0); | 366 __ subsd(xmm1, xmm0); |
| 364 __ divsd(xmm1, xmm0); | 367 __ divsd(xmm1, xmm0); |
| 365 __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000)); | 368 __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 366 __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1); | 369 __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1); |
| 367 __ comisd(xmm0, xmm1); | 370 __ comisd(xmm0, xmm1); |
| 371 |
| 372 // 128 bit move instructions. |
| 373 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); |
| 374 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0); |
| 375 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); |
| 376 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0); |
| 368 } | 377 } |
| 369 | 378 |
| 370 // cmov. | 379 // cmov. |
| 371 { | 380 { |
| 372 CHECK(CpuFeatures::IsSupported(CMOV)); | 381 CHECK(CpuFeatures::IsSupported(CMOV)); |
| 373 CpuFeatures::Scope use_cmov(CMOV); | 382 CpuFeatures::Scope use_cmov(CMOV); |
| 374 __ cmov(overflow, eax, Operand(eax, 0)); | 383 __ cmov(overflow, eax, Operand(eax, 0)); |
| 375 __ cmov(no_overflow, eax, Operand(eax, 1)); | 384 __ cmov(no_overflow, eax, Operand(eax, 1)); |
| 376 __ cmov(below, eax, Operand(eax, 2)); | 385 __ cmov(below, eax, Operand(eax, 2)); |
| 377 __ cmov(above_equal, eax, Operand(eax, 3)); | 386 __ cmov(above_equal, eax, Operand(eax, 3)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 400 CHECK(code->IsCode()); | 409 CHECK(code->IsCode()); |
| 401 #ifdef DEBUG | 410 #ifdef DEBUG |
| 402 Code::cast(code)->Print(); | 411 Code::cast(code)->Print(); |
| 403 byte* begin = Code::cast(code)->instruction_start(); | 412 byte* begin = Code::cast(code)->instruction_start(); |
| 404 byte* end = begin + Code::cast(code)->instruction_size(); | 413 byte* end = begin + Code::cast(code)->instruction_size(); |
| 405 disasm::Disassembler::Disassemble(stdout, begin, end); | 414 disasm::Disassembler::Disassemble(stdout, begin, end); |
| 406 #endif | 415 #endif |
| 407 } | 416 } |
| 408 | 417 |
| 409 #undef __ | 418 #undef __ |
| OLD | NEW |