| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 TEST(AssemblerIa321) { | 87 TEST(AssemblerIa321) { |
| 88 InitializeVM(); | 88 InitializeVM(); |
| 89 v8::HandleScope scope; | 89 v8::HandleScope scope; |
| 90 | 90 |
| 91 v8::internal::byte buffer[256]; | 91 v8::internal::byte buffer[256]; |
| 92 Assembler assm(Isolate::Current(), buffer, sizeof buffer); | 92 Assembler assm(Isolate::Current(), buffer, sizeof buffer); |
| 93 Label L, C; | 93 Label L, C; |
| 94 | 94 |
| 95 __ mov(edx, Operand(esp, 4)); | 95 __ mov(edx, Operand(esp, 4)); |
| 96 __ xor_(eax, Operand(eax)); // clear eax | 96 __ xor_(eax, eax); // clear eax |
| 97 __ jmp(&C); | 97 __ jmp(&C); |
| 98 | 98 |
| 99 __ bind(&L); | 99 __ bind(&L); |
| 100 __ add(eax, Operand(edx)); | 100 __ add(eax, edx); |
| 101 __ sub(Operand(edx), Immediate(1)); | 101 __ sub(edx, Immediate(1)); |
| 102 | 102 |
| 103 __ bind(&C); | 103 __ bind(&C); |
| 104 __ test(edx, Operand(edx)); | 104 __ test(edx, edx); |
| 105 __ j(not_zero, &L); | 105 __ j(not_zero, &L); |
| 106 __ ret(0); | 106 __ ret(0); |
| 107 | 107 |
| 108 CodeDesc desc; | 108 CodeDesc desc; |
| 109 assm.GetCode(&desc); | 109 assm.GetCode(&desc); |
| 110 Object* code = HEAP->CreateCode( | 110 Object* code = HEAP->CreateCode( |
| 111 desc, | 111 desc, |
| 112 Code::ComputeFlags(Code::STUB), | 112 Code::ComputeFlags(Code::STUB), |
| 113 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | 113 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); |
| 114 CHECK(code->IsCode()); | 114 CHECK(code->IsCode()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 128 | 128 |
| 129 v8::internal::byte buffer[256]; | 129 v8::internal::byte buffer[256]; |
| 130 Assembler assm(Isolate::Current(), buffer, sizeof buffer); | 130 Assembler assm(Isolate::Current(), buffer, sizeof buffer); |
| 131 Label L, C; | 131 Label L, C; |
| 132 | 132 |
| 133 __ mov(edx, Operand(esp, 4)); | 133 __ mov(edx, Operand(esp, 4)); |
| 134 __ mov(eax, 1); | 134 __ mov(eax, 1); |
| 135 __ jmp(&C); | 135 __ jmp(&C); |
| 136 | 136 |
| 137 __ bind(&L); | 137 __ bind(&L); |
| 138 __ imul(eax, Operand(edx)); | 138 __ imul(eax, edx); |
| 139 __ sub(Operand(edx), Immediate(1)); | 139 __ sub(edx, Immediate(1)); |
| 140 | 140 |
| 141 __ bind(&C); | 141 __ bind(&C); |
| 142 __ test(edx, Operand(edx)); | 142 __ test(edx, edx); |
| 143 __ j(not_zero, &L); | 143 __ j(not_zero, &L); |
| 144 __ ret(0); | 144 __ ret(0); |
| 145 | 145 |
| 146 // some relocated stuff here, not executed | 146 // some relocated stuff here, not executed |
| 147 __ mov(eax, FACTORY->true_value()); | 147 __ mov(eax, FACTORY->true_value()); |
| 148 __ jmp(NULL, RelocInfo::RUNTIME_ENTRY); | 148 __ jmp(NULL, RelocInfo::RUNTIME_ENTRY); |
| 149 | 149 |
| 150 CodeDesc desc; | 150 CodeDesc desc; |
| 151 assm.GetCode(&desc); | 151 assm.GetCode(&desc); |
| 152 Object* code = HEAP->CreateCode( | 152 Object* code = HEAP->CreateCode( |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 v8::internal::byte buffer[256]; | 268 v8::internal::byte buffer[256]; |
| 269 Assembler assm(Isolate::Current(), buffer, sizeof buffer); | 269 Assembler assm(Isolate::Current(), buffer, sizeof buffer); |
| 270 | 270 |
| 271 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize)); | 271 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize)); |
| 272 __ movdbl(xmm1, Operand(esp, 3 * kPointerSize)); | 272 __ movdbl(xmm1, Operand(esp, 3 * kPointerSize)); |
| 273 __ addsd(xmm0, xmm1); | 273 __ addsd(xmm0, xmm1); |
| 274 __ mulsd(xmm0, xmm1); | 274 __ mulsd(xmm0, xmm1); |
| 275 __ subsd(xmm0, xmm1); | 275 __ subsd(xmm0, xmm1); |
| 276 __ divsd(xmm0, xmm1); | 276 __ divsd(xmm0, xmm1); |
| 277 // Copy xmm0 to st(0) using eight bytes of stack. | 277 // Copy xmm0 to st(0) using eight bytes of stack. |
| 278 __ sub(Operand(esp), Immediate(8)); | 278 __ sub(esp, Immediate(8)); |
| 279 __ movdbl(Operand(esp, 0), xmm0); | 279 __ movdbl(Operand(esp, 0), xmm0); |
| 280 __ fld_d(Operand(esp, 0)); | 280 __ fld_d(Operand(esp, 0)); |
| 281 __ add(Operand(esp), Immediate(8)); | 281 __ add(esp, Immediate(8)); |
| 282 __ ret(0); | 282 __ ret(0); |
| 283 | 283 |
| 284 CodeDesc desc; | 284 CodeDesc desc; |
| 285 assm.GetCode(&desc); | 285 assm.GetCode(&desc); |
| 286 Code* code = Code::cast(HEAP->CreateCode( | 286 Code* code = Code::cast(HEAP->CreateCode( |
| 287 desc, | 287 desc, |
| 288 Code::ComputeFlags(Code::STUB), | 288 Code::ComputeFlags(Code::STUB), |
| 289 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked()); | 289 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked()); |
| 290 #ifdef DEBUG | 290 #ifdef DEBUG |
| 291 ::printf("\n---\n"); | 291 ::printf("\n---\n"); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 307 TEST(AssemblerIa328) { | 307 TEST(AssemblerIa328) { |
| 308 InitializeVM(); | 308 InitializeVM(); |
| 309 if (!CpuFeatures::IsSupported(SSE2)) return; | 309 if (!CpuFeatures::IsSupported(SSE2)) return; |
| 310 | 310 |
| 311 v8::HandleScope scope; | 311 v8::HandleScope scope; |
| 312 CHECK(CpuFeatures::IsSupported(SSE2)); | 312 CHECK(CpuFeatures::IsSupported(SSE2)); |
| 313 CpuFeatures::Scope fscope(SSE2); | 313 CpuFeatures::Scope fscope(SSE2); |
| 314 v8::internal::byte buffer[256]; | 314 v8::internal::byte buffer[256]; |
| 315 Assembler assm(Isolate::Current(), buffer, sizeof buffer); | 315 Assembler assm(Isolate::Current(), buffer, sizeof buffer); |
| 316 __ mov(eax, Operand(esp, 4)); | 316 __ mov(eax, Operand(esp, 4)); |
| 317 __ cvtsi2sd(xmm0, Operand(eax)); | 317 __ cvtsi2sd(xmm0, eax); |
| 318 // Copy xmm0 to st(0) using eight bytes of stack. | 318 // Copy xmm0 to st(0) using eight bytes of stack. |
| 319 __ sub(Operand(esp), Immediate(8)); | 319 __ sub(esp, Immediate(8)); |
| 320 __ movdbl(Operand(esp, 0), xmm0); | 320 __ movdbl(Operand(esp, 0), xmm0); |
| 321 __ fld_d(Operand(esp, 0)); | 321 __ fld_d(Operand(esp, 0)); |
| 322 __ add(Operand(esp), Immediate(8)); | 322 __ add(esp, Immediate(8)); |
| 323 __ ret(0); | 323 __ ret(0); |
| 324 CodeDesc desc; | 324 CodeDesc desc; |
| 325 assm.GetCode(&desc); | 325 assm.GetCode(&desc); |
| 326 Code* code = Code::cast(HEAP->CreateCode( | 326 Code* code = Code::cast(HEAP->CreateCode( |
| 327 desc, | 327 desc, |
| 328 Code::ComputeFlags(Code::STUB), | 328 Code::ComputeFlags(Code::STUB), |
| 329 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked()); | 329 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked()); |
| 330 CHECK(code->IsCode()); | 330 CHECK(code->IsCode()); |
| 331 #ifdef OBJECT_PRINT | 331 #ifdef OBJECT_PRINT |
| 332 Code::cast(code)->Print(); | 332 Code::cast(code)->Print(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 Assembler assm(Isolate::Current(), NULL, 0); | 402 Assembler assm(Isolate::Current(), NULL, 0); |
| 403 | 403 |
| 404 Label target; | 404 Label target; |
| 405 __ j(equal, &target); | 405 __ j(equal, &target); |
| 406 __ j(not_equal, &target); | 406 __ j(not_equal, &target); |
| 407 __ bind(&target); | 407 __ bind(&target); |
| 408 __ nop(); | 408 __ nop(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 #undef __ | 411 #undef __ |
| OLD | NEW |