| OLD | NEW |
| 1 // Copyright 2011 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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 HandleScope scope(isolate); | 53 HandleScope scope(isolate); |
| 54 | 54 |
| 55 v8::internal::byte buffer[256]; | 55 v8::internal::byte buffer[256]; |
| 56 Assembler assm(isolate, buffer, sizeof buffer); | 56 Assembler assm(isolate, buffer, sizeof buffer); |
| 57 | 57 |
| 58 __ mov(eax, Operand(esp, 4)); | 58 __ mov(eax, Operand(esp, 4)); |
| 59 __ add(eax, Operand(esp, 8)); | 59 __ add(eax, Operand(esp, 8)); |
| 60 __ ret(0); | 60 __ ret(0); |
| 61 | 61 |
| 62 CodeDesc desc; | 62 CodeDesc desc; |
| 63 assm.GetCode(&desc); | 63 assm.GetCode(isolate, &desc); |
| 64 Handle<Code> code = isolate->factory()->NewCode( | 64 Handle<Code> code = isolate->factory()->NewCode( |
| 65 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 65 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 66 #ifdef OBJECT_PRINT | 66 #ifdef OBJECT_PRINT |
| 67 OFStream os(stdout); | 67 OFStream os(stdout); |
| 68 code->Print(os); | 68 code->Print(os); |
| 69 #endif | 69 #endif |
| 70 F2 f = FUNCTION_CAST<F2>(code->entry()); | 70 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 71 int res = f(3, 4); | 71 int res = f(3, 4); |
| 72 ::printf("f() = %d\n", res); | 72 ::printf("f() = %d\n", res); |
| 73 CHECK_EQ(7, res); | 73 CHECK_EQ(7, res); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 90 __ bind(&L); | 90 __ bind(&L); |
| 91 __ add(eax, edx); | 91 __ add(eax, edx); |
| 92 __ sub(edx, Immediate(1)); | 92 __ sub(edx, Immediate(1)); |
| 93 | 93 |
| 94 __ bind(&C); | 94 __ bind(&C); |
| 95 __ test(edx, edx); | 95 __ test(edx, edx); |
| 96 __ j(not_zero, &L); | 96 __ j(not_zero, &L); |
| 97 __ ret(0); | 97 __ ret(0); |
| 98 | 98 |
| 99 CodeDesc desc; | 99 CodeDesc desc; |
| 100 assm.GetCode(&desc); | 100 assm.GetCode(isolate, &desc); |
| 101 Handle<Code> code = isolate->factory()->NewCode( | 101 Handle<Code> code = isolate->factory()->NewCode( |
| 102 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 102 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 103 #ifdef OBJECT_PRINT | 103 #ifdef OBJECT_PRINT |
| 104 OFStream os(stdout); | 104 OFStream os(stdout); |
| 105 code->Print(os); | 105 code->Print(os); |
| 106 #endif | 106 #endif |
| 107 F1 f = FUNCTION_CAST<F1>(code->entry()); | 107 F1 f = FUNCTION_CAST<F1>(code->entry()); |
| 108 int res = f(100); | 108 int res = f(100); |
| 109 ::printf("f() = %d\n", res); | 109 ::printf("f() = %d\n", res); |
| 110 CHECK_EQ(5050, res); | 110 CHECK_EQ(5050, res); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 131 __ bind(&C); | 131 __ bind(&C); |
| 132 __ test(edx, edx); | 132 __ test(edx, edx); |
| 133 __ j(not_zero, &L); | 133 __ j(not_zero, &L); |
| 134 __ ret(0); | 134 __ ret(0); |
| 135 | 135 |
| 136 // some relocated stuff here, not executed | 136 // some relocated stuff here, not executed |
| 137 __ mov(eax, isolate->factory()->true_value()); | 137 __ mov(eax, isolate->factory()->true_value()); |
| 138 __ jmp(NULL, RelocInfo::RUNTIME_ENTRY); | 138 __ jmp(NULL, RelocInfo::RUNTIME_ENTRY); |
| 139 | 139 |
| 140 CodeDesc desc; | 140 CodeDesc desc; |
| 141 assm.GetCode(&desc); | 141 assm.GetCode(isolate, &desc); |
| 142 Handle<Code> code = isolate->factory()->NewCode( | 142 Handle<Code> code = isolate->factory()->NewCode( |
| 143 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 143 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 144 #ifdef OBJECT_PRINT | 144 #ifdef OBJECT_PRINT |
| 145 OFStream os(stdout); | 145 OFStream os(stdout); |
| 146 code->Print(os); | 146 code->Print(os); |
| 147 #endif | 147 #endif |
| 148 F1 f = FUNCTION_CAST<F1>(code->entry()); | 148 F1 f = FUNCTION_CAST<F1>(code->entry()); |
| 149 int res = f(10); | 149 int res = f(10); |
| 150 ::printf("f() = %d\n", res); | 150 ::printf("f() = %d\n", res); |
| 151 CHECK_EQ(3628800, res); | 151 CHECK_EQ(3628800, res); |
| 152 } | 152 } |
| 153 | 153 |
| 154 | 154 |
| 155 typedef int (*F3)(float x); | 155 typedef int (*F3)(float x); |
| 156 | 156 |
| 157 TEST(AssemblerIa323) { | 157 TEST(AssemblerIa323) { |
| 158 CcTest::InitializeVM(); | 158 CcTest::InitializeVM(); |
| 159 | 159 |
| 160 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 160 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
| 161 HandleScope scope(isolate); | 161 HandleScope scope(isolate); |
| 162 | 162 |
| 163 v8::internal::byte buffer[256]; | 163 v8::internal::byte buffer[256]; |
| 164 Assembler assm(isolate, buffer, sizeof buffer); | 164 Assembler assm(isolate, buffer, sizeof buffer); |
| 165 | 165 |
| 166 __ cvttss2si(eax, Operand(esp, 4)); | 166 __ cvttss2si(eax, Operand(esp, 4)); |
| 167 __ ret(0); | 167 __ ret(0); |
| 168 | 168 |
| 169 CodeDesc desc; | 169 CodeDesc desc; |
| 170 assm.GetCode(&desc); | 170 assm.GetCode(isolate, &desc); |
| 171 Handle<Code> code = isolate->factory()->NewCode( | 171 Handle<Code> code = isolate->factory()->NewCode( |
| 172 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 172 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 173 #ifdef OBJECT_PRINT | 173 #ifdef OBJECT_PRINT |
| 174 OFStream os(stdout); | 174 OFStream os(stdout); |
| 175 code->Print(os); | 175 code->Print(os); |
| 176 #endif | 176 #endif |
| 177 F3 f = FUNCTION_CAST<F3>(code->entry()); | 177 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 178 int res = f(static_cast<float>(-3.1415)); | 178 int res = f(static_cast<float>(-3.1415)); |
| 179 ::printf("f() = %d\n", res); | 179 ::printf("f() = %d\n", res); |
| 180 CHECK_EQ(-3, res); | 180 CHECK_EQ(-3, res); |
| 181 } | 181 } |
| 182 | 182 |
| 183 | 183 |
| 184 typedef int (*F4)(double x); | 184 typedef int (*F4)(double x); |
| 185 | 185 |
| 186 TEST(AssemblerIa324) { | 186 TEST(AssemblerIa324) { |
| 187 CcTest::InitializeVM(); | 187 CcTest::InitializeVM(); |
| 188 | 188 |
| 189 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 189 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
| 190 HandleScope scope(isolate); | 190 HandleScope scope(isolate); |
| 191 | 191 |
| 192 v8::internal::byte buffer[256]; | 192 v8::internal::byte buffer[256]; |
| 193 Assembler assm(isolate, buffer, sizeof buffer); | 193 Assembler assm(isolate, buffer, sizeof buffer); |
| 194 | 194 |
| 195 __ cvttsd2si(eax, Operand(esp, 4)); | 195 __ cvttsd2si(eax, Operand(esp, 4)); |
| 196 __ ret(0); | 196 __ ret(0); |
| 197 | 197 |
| 198 CodeDesc desc; | 198 CodeDesc desc; |
| 199 assm.GetCode(&desc); | 199 assm.GetCode(isolate, &desc); |
| 200 Handle<Code> code = isolate->factory()->NewCode( | 200 Handle<Code> code = isolate->factory()->NewCode( |
| 201 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 201 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 202 #ifdef OBJECT_PRINT | 202 #ifdef OBJECT_PRINT |
| 203 OFStream os(stdout); | 203 OFStream os(stdout); |
| 204 code->Print(os); | 204 code->Print(os); |
| 205 #endif | 205 #endif |
| 206 F4 f = FUNCTION_CAST<F4>(code->entry()); | 206 F4 f = FUNCTION_CAST<F4>(code->entry()); |
| 207 int res = f(2.718281828); | 207 int res = f(2.718281828); |
| 208 ::printf("f() = %d\n", res); | 208 ::printf("f() = %d\n", res); |
| 209 CHECK_EQ(2, res); | 209 CHECK_EQ(2, res); |
| 210 } | 210 } |
| 211 | 211 |
| 212 | 212 |
| 213 static int baz = 42; | 213 static int baz = 42; |
| 214 TEST(AssemblerIa325) { | 214 TEST(AssemblerIa325) { |
| 215 CcTest::InitializeVM(); | 215 CcTest::InitializeVM(); |
| 216 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 216 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
| 217 HandleScope scope(isolate); | 217 HandleScope scope(isolate); |
| 218 | 218 |
| 219 v8::internal::byte buffer[256]; | 219 v8::internal::byte buffer[256]; |
| 220 Assembler assm(isolate, buffer, sizeof buffer); | 220 Assembler assm(isolate, buffer, sizeof buffer); |
| 221 | 221 |
| 222 __ mov(eax, Operand(reinterpret_cast<intptr_t>(&baz), RelocInfo::NONE32)); | 222 __ mov(eax, Operand(reinterpret_cast<intptr_t>(&baz), RelocInfo::NONE32)); |
| 223 __ ret(0); | 223 __ ret(0); |
| 224 | 224 |
| 225 CodeDesc desc; | 225 CodeDesc desc; |
| 226 assm.GetCode(&desc); | 226 assm.GetCode(isolate, &desc); |
| 227 Handle<Code> code = isolate->factory()->NewCode( | 227 Handle<Code> code = isolate->factory()->NewCode( |
| 228 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 228 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 229 F0 f = FUNCTION_CAST<F0>(code->entry()); | 229 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 230 int res = f(); | 230 int res = f(); |
| 231 CHECK_EQ(42, res); | 231 CHECK_EQ(42, res); |
| 232 } | 232 } |
| 233 | 233 |
| 234 | 234 |
| 235 typedef double (*F5)(double x, double y); | 235 typedef double (*F5)(double x, double y); |
| 236 | 236 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 249 __ subsd(xmm0, xmm1); | 249 __ subsd(xmm0, xmm1); |
| 250 __ divsd(xmm0, xmm1); | 250 __ divsd(xmm0, xmm1); |
| 251 // Copy xmm0 to st(0) using eight bytes of stack. | 251 // Copy xmm0 to st(0) using eight bytes of stack. |
| 252 __ sub(esp, Immediate(8)); | 252 __ sub(esp, Immediate(8)); |
| 253 __ movsd(Operand(esp, 0), xmm0); | 253 __ movsd(Operand(esp, 0), xmm0); |
| 254 __ fld_d(Operand(esp, 0)); | 254 __ fld_d(Operand(esp, 0)); |
| 255 __ add(esp, Immediate(8)); | 255 __ add(esp, Immediate(8)); |
| 256 __ ret(0); | 256 __ ret(0); |
| 257 | 257 |
| 258 CodeDesc desc; | 258 CodeDesc desc; |
| 259 assm.GetCode(&desc); | 259 assm.GetCode(isolate, &desc); |
| 260 Handle<Code> code = isolate->factory()->NewCode( | 260 Handle<Code> code = isolate->factory()->NewCode( |
| 261 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 261 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 262 #ifdef OBJECT_PRINT | 262 #ifdef OBJECT_PRINT |
| 263 OFStream os(stdout); | 263 OFStream os(stdout); |
| 264 code->Print(os); | 264 code->Print(os); |
| 265 #endif | 265 #endif |
| 266 F5 f = FUNCTION_CAST<F5>(code->entry()); | 266 F5 f = FUNCTION_CAST<F5>(code->entry()); |
| 267 double res = f(2.2, 1.1); | 267 double res = f(2.2, 1.1); |
| 268 ::printf("f() = %f\n", res); | 268 ::printf("f() = %f\n", res); |
| 269 CHECK(2.29 < res && res < 2.31); | 269 CHECK(2.29 < res && res < 2.31); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 281 Assembler assm(isolate, buffer, sizeof buffer); | 281 Assembler assm(isolate, buffer, sizeof buffer); |
| 282 __ mov(eax, Operand(esp, 4)); | 282 __ mov(eax, Operand(esp, 4)); |
| 283 __ cvtsi2sd(xmm0, eax); | 283 __ cvtsi2sd(xmm0, eax); |
| 284 // Copy xmm0 to st(0) using eight bytes of stack. | 284 // Copy xmm0 to st(0) using eight bytes of stack. |
| 285 __ sub(esp, Immediate(8)); | 285 __ sub(esp, Immediate(8)); |
| 286 __ movsd(Operand(esp, 0), xmm0); | 286 __ movsd(Operand(esp, 0), xmm0); |
| 287 __ fld_d(Operand(esp, 0)); | 287 __ fld_d(Operand(esp, 0)); |
| 288 __ add(esp, Immediate(8)); | 288 __ add(esp, Immediate(8)); |
| 289 __ ret(0); | 289 __ ret(0); |
| 290 CodeDesc desc; | 290 CodeDesc desc; |
| 291 assm.GetCode(&desc); | 291 assm.GetCode(isolate, &desc); |
| 292 Handle<Code> code = isolate->factory()->NewCode( | 292 Handle<Code> code = isolate->factory()->NewCode( |
| 293 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 293 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 294 #ifdef OBJECT_PRINT | 294 #ifdef OBJECT_PRINT |
| 295 OFStream os(stdout); | 295 OFStream os(stdout); |
| 296 code->Print(os); | 296 code->Print(os); |
| 297 #endif | 297 #endif |
| 298 F6 f = FUNCTION_CAST<F6>(code->entry()); | 298 F6 f = FUNCTION_CAST<F6>(code->entry()); |
| 299 double res = f(12); | 299 double res = f(12); |
| 300 | 300 |
| 301 ::printf("f() = %f\n", res); | 301 ::printf("f() = %f\n", res); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 __ bind(&less_l); | 336 __ bind(&less_l); |
| 337 __ mov(eax, kLess); | 337 __ mov(eax, kLess); |
| 338 __ ret(0); | 338 __ ret(0); |
| 339 | 339 |
| 340 __ bind(&nan_l); | 340 __ bind(&nan_l); |
| 341 __ mov(eax, kNaN); | 341 __ mov(eax, kNaN); |
| 342 __ ret(0); | 342 __ ret(0); |
| 343 | 343 |
| 344 | 344 |
| 345 CodeDesc desc; | 345 CodeDesc desc; |
| 346 assm.GetCode(&desc); | 346 assm.GetCode(isolate, &desc); |
| 347 Handle<Code> code = isolate->factory()->NewCode( | 347 Handle<Code> code = isolate->factory()->NewCode( |
| 348 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 348 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 349 #ifdef OBJECT_PRINT | 349 #ifdef OBJECT_PRINT |
| 350 OFStream os(stdout); | 350 OFStream os(stdout); |
| 351 code->Print(os); | 351 code->Print(os); |
| 352 #endif | 352 #endif |
| 353 | 353 |
| 354 F7 f = FUNCTION_CAST<F7>(code->entry()); | 354 F7 f = FUNCTION_CAST<F7>(code->entry()); |
| 355 CHECK_EQ(kLess, f(1.1, 2.2)); | 355 CHECK_EQ(kLess, f(1.1, 2.2)); |
| 356 CHECK_EQ(kEqual, f(2.2, 2.2)); | 356 CHECK_EQ(kEqual, f(2.2, 2.2)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 __ bind(&fail); | 420 __ bind(&fail); |
| 421 __ mov(eax, 13); | 421 __ mov(eax, 13); |
| 422 __ pop(esi); | 422 __ pop(esi); |
| 423 __ pop(edi); | 423 __ pop(edi); |
| 424 __ pop(edx); | 424 __ pop(edx); |
| 425 __ pop(ecx); | 425 __ pop(ecx); |
| 426 __ pop(ebx); | 426 __ pop(ebx); |
| 427 __ ret(0); | 427 __ ret(0); |
| 428 | 428 |
| 429 CodeDesc desc; | 429 CodeDesc desc; |
| 430 assm.GetCode(&desc); | 430 assm.GetCode(isolate, &desc); |
| 431 Handle<Code> code = isolate->factory()->NewCode( | 431 Handle<Code> code = isolate->factory()->NewCode( |
| 432 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 432 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 433 CHECK(code->IsCode()); | 433 CHECK(code->IsCode()); |
| 434 | 434 |
| 435 F0 f = FUNCTION_CAST<F0>(code->entry()); | 435 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 436 int res = f(); | 436 int res = f(); |
| 437 CHECK_EQ(42, res); | 437 CHECK_EQ(42, res); |
| 438 } | 438 } |
| 439 | 439 |
| 440 | 440 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 469 __ movmskps(eax, xmm0); | 469 __ movmskps(eax, xmm0); |
| 470 | 470 |
| 471 // Remove unused data from the stack. | 471 // Remove unused data from the stack. |
| 472 __ add(esp, Immediate(ELEMENT_COUNT * sizeof(int32_t))); | 472 __ add(esp, Immediate(ELEMENT_COUNT * sizeof(int32_t))); |
| 473 // Restore return address. | 473 // Restore return address. |
| 474 __ push(ecx); | 474 __ push(ecx); |
| 475 | 475 |
| 476 __ ret(0); | 476 __ ret(0); |
| 477 | 477 |
| 478 CodeDesc desc; | 478 CodeDesc desc; |
| 479 assm.GetCode(&desc); | 479 assm.GetCode(isolate, &desc); |
| 480 | 480 |
| 481 Handle<Code> code = isolate->factory()->NewCode( | 481 Handle<Code> code = isolate->factory()->NewCode( |
| 482 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 482 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 483 | 483 |
| 484 F0 f = FUNCTION_CAST<F0>(code->entry()); | 484 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 485 int res = f(); | 485 int res = f(); |
| 486 args.GetReturnValue().Set(v8::Integer::New(CcTest::isolate(), res)); | 486 args.GetReturnValue().Set(v8::Integer::New(CcTest::isolate(), res)); |
| 487 } | 487 } |
| 488 | 488 |
| 489 | 489 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 v8::internal::byte buffer[256]; | 535 v8::internal::byte buffer[256]; |
| 536 MacroAssembler assm(isolate, buffer, sizeof(buffer), | 536 MacroAssembler assm(isolate, buffer, sizeof(buffer), |
| 537 v8::internal::CodeObjectRequired::kYes); | 537 v8::internal::CodeObjectRequired::kYes); |
| 538 { CpuFeatureScope fscope41(&assm, SSE4_1); | 538 { CpuFeatureScope fscope41(&assm, SSE4_1); |
| 539 __ movsd(xmm1, Operand(esp, 4)); | 539 __ movsd(xmm1, Operand(esp, 4)); |
| 540 __ extractps(eax, xmm1, 0x1); | 540 __ extractps(eax, xmm1, 0x1); |
| 541 __ ret(0); | 541 __ ret(0); |
| 542 } | 542 } |
| 543 | 543 |
| 544 CodeDesc desc; | 544 CodeDesc desc; |
| 545 assm.GetCode(&desc); | 545 assm.GetCode(isolate, &desc); |
| 546 Handle<Code> code = isolate->factory()->NewCode( | 546 Handle<Code> code = isolate->factory()->NewCode( |
| 547 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 547 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 548 #ifdef OBJECT_PRINT | 548 #ifdef OBJECT_PRINT |
| 549 OFStream os(stdout); | 549 OFStream os(stdout); |
| 550 code->Print(os); | 550 code->Print(os); |
| 551 #endif | 551 #endif |
| 552 | 552 |
| 553 F4 f = FUNCTION_CAST<F4>(code->entry()); | 553 F4 f = FUNCTION_CAST<F4>(code->entry()); |
| 554 uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321); | 554 uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321); |
| 555 CHECK_EQ(0x12345678, f(uint64_to_double(value1))); | 555 CHECK_EQ(0x12345678, f(uint64_to_double(value1))); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 575 __ movaps(xmm2, xmm1); | 575 __ movaps(xmm2, xmm1); |
| 576 __ addps(xmm2, xmm0); | 576 __ addps(xmm2, xmm0); |
| 577 __ mulps(xmm2, xmm1); | 577 __ mulps(xmm2, xmm1); |
| 578 __ subps(xmm2, xmm0); | 578 __ subps(xmm2, xmm0); |
| 579 __ divps(xmm2, xmm1); | 579 __ divps(xmm2, xmm1); |
| 580 __ cvttss2si(eax, xmm2); | 580 __ cvttss2si(eax, xmm2); |
| 581 __ ret(0); | 581 __ ret(0); |
| 582 } | 582 } |
| 583 | 583 |
| 584 CodeDesc desc; | 584 CodeDesc desc; |
| 585 assm.GetCode(&desc); | 585 assm.GetCode(isolate, &desc); |
| 586 Handle<Code> code = isolate->factory()->NewCode( | 586 Handle<Code> code = isolate->factory()->NewCode( |
| 587 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 587 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 588 #ifdef OBJECT_PRINT | 588 #ifdef OBJECT_PRINT |
| 589 OFStream os(stdout); | 589 OFStream os(stdout); |
| 590 code->Print(os); | 590 code->Print(os); |
| 591 #endif | 591 #endif |
| 592 | 592 |
| 593 F8 f = FUNCTION_CAST<F8>(code->entry()); | 593 F8 f = FUNCTION_CAST<F8>(code->entry()); |
| 594 CHECK_EQ(2, f(1.0, 2.0)); | 594 CHECK_EQ(2, f(1.0, 2.0)); |
| 595 } | 595 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 __ j(not_equal, &exit); | 804 __ j(not_equal, &exit); |
| 805 | 805 |
| 806 | 806 |
| 807 __ xor_(eax, eax); | 807 __ xor_(eax, eax); |
| 808 __ bind(&exit); | 808 __ bind(&exit); |
| 809 __ add(esp, Immediate(kDoubleSize)); | 809 __ add(esp, Immediate(kDoubleSize)); |
| 810 __ ret(0); | 810 __ ret(0); |
| 811 } | 811 } |
| 812 | 812 |
| 813 CodeDesc desc; | 813 CodeDesc desc; |
| 814 assm.GetCode(&desc); | 814 assm.GetCode(isolate, &desc); |
| 815 Handle<Code> code = isolate->factory()->NewCode( | 815 Handle<Code> code = isolate->factory()->NewCode( |
| 816 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 816 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 817 #ifdef OBJECT_PRINT | 817 #ifdef OBJECT_PRINT |
| 818 OFStream os(stdout); | 818 OFStream os(stdout); |
| 819 code->Print(os); | 819 code->Print(os); |
| 820 #endif | 820 #endif |
| 821 | 821 |
| 822 F9 f = FUNCTION_CAST<F9>(code->entry()); | 822 F9 f = FUNCTION_CAST<F9>(code->entry()); |
| 823 CHECK_EQ(0, f(0.000092662107262076, -2.460774966188315, -1.0958787393627414)); | 823 CHECK_EQ(0, f(0.000092662107262076, -2.460774966188315, -1.0958787393627414)); |
| 824 } | 824 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 __ j(not_equal, &exit); | 1033 __ j(not_equal, &exit); |
| 1034 | 1034 |
| 1035 | 1035 |
| 1036 __ xor_(eax, eax); | 1036 __ xor_(eax, eax); |
| 1037 __ bind(&exit); | 1037 __ bind(&exit); |
| 1038 __ add(esp, Immediate(kDoubleSize)); | 1038 __ add(esp, Immediate(kDoubleSize)); |
| 1039 __ ret(0); | 1039 __ ret(0); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 CodeDesc desc; | 1042 CodeDesc desc; |
| 1043 assm.GetCode(&desc); | 1043 assm.GetCode(isolate, &desc); |
| 1044 Handle<Code> code = isolate->factory()->NewCode( | 1044 Handle<Code> code = isolate->factory()->NewCode( |
| 1045 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1045 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1046 #ifdef OBJECT_PRINT | 1046 #ifdef OBJECT_PRINT |
| 1047 OFStream os(stdout); | 1047 OFStream os(stdout); |
| 1048 code->Print(os); | 1048 code->Print(os); |
| 1049 #endif | 1049 #endif |
| 1050 | 1050 |
| 1051 F10 f = FUNCTION_CAST<F10>(code->entry()); | 1051 F10 f = FUNCTION_CAST<F10>(code->entry()); |
| 1052 CHECK_EQ(0, f(9.26621069e-05f, -2.4607749f, -1.09587872f)); | 1052 CHECK_EQ(0, f(9.26621069e-05f, -2.4607749f, -1.09587872f)); |
| 1053 } | 1053 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 __ j(not_equal, &exit); | 1141 __ j(not_equal, &exit); |
| 1142 | 1142 |
| 1143 __ xor_(eax, eax); | 1143 __ xor_(eax, eax); |
| 1144 __ bind(&exit); | 1144 __ bind(&exit); |
| 1145 __ pop(ecx); | 1145 __ pop(ecx); |
| 1146 __ pop(ebx); | 1146 __ pop(ebx); |
| 1147 __ ret(0); | 1147 __ ret(0); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 CodeDesc desc; | 1150 CodeDesc desc; |
| 1151 assm.GetCode(&desc); | 1151 assm.GetCode(isolate, &desc); |
| 1152 Handle<Code> code = isolate->factory()->NewCode( | 1152 Handle<Code> code = isolate->factory()->NewCode( |
| 1153 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1153 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1154 #ifdef OBJECT_PRINT | 1154 #ifdef OBJECT_PRINT |
| 1155 OFStream os(stdout); | 1155 OFStream os(stdout); |
| 1156 code->Print(os); | 1156 code->Print(os); |
| 1157 #endif | 1157 #endif |
| 1158 | 1158 |
| 1159 F0 f = FUNCTION_CAST<F0>(code->entry()); | 1159 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 1160 CHECK_EQ(0, f()); | 1160 CHECK_EQ(0, f()); |
| 1161 } | 1161 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1189 __ j(not_equal, &exit); | 1189 __ j(not_equal, &exit); |
| 1190 | 1190 |
| 1191 __ xor_(eax, eax); | 1191 __ xor_(eax, eax); |
| 1192 __ bind(&exit); | 1192 __ bind(&exit); |
| 1193 __ pop(ecx); | 1193 __ pop(ecx); |
| 1194 __ pop(ebx); | 1194 __ pop(ebx); |
| 1195 __ ret(0); | 1195 __ ret(0); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 CodeDesc desc; | 1198 CodeDesc desc; |
| 1199 assm.GetCode(&desc); | 1199 assm.GetCode(isolate, &desc); |
| 1200 Handle<Code> code = isolate->factory()->NewCode( | 1200 Handle<Code> code = isolate->factory()->NewCode( |
| 1201 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1201 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1202 #ifdef OBJECT_PRINT | 1202 #ifdef OBJECT_PRINT |
| 1203 OFStream os(stdout); | 1203 OFStream os(stdout); |
| 1204 code->Print(os); | 1204 code->Print(os); |
| 1205 #endif | 1205 #endif |
| 1206 | 1206 |
| 1207 F0 f = FUNCTION_CAST<F0>(code->entry()); | 1207 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 1208 CHECK_EQ(0, f()); | 1208 CHECK_EQ(0, f()); |
| 1209 } | 1209 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1237 __ j(not_equal, &exit); | 1237 __ j(not_equal, &exit); |
| 1238 | 1238 |
| 1239 __ xor_(eax, eax); | 1239 __ xor_(eax, eax); |
| 1240 __ bind(&exit); | 1240 __ bind(&exit); |
| 1241 __ pop(ecx); | 1241 __ pop(ecx); |
| 1242 __ pop(ebx); | 1242 __ pop(ebx); |
| 1243 __ ret(0); | 1243 __ ret(0); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 CodeDesc desc; | 1246 CodeDesc desc; |
| 1247 assm.GetCode(&desc); | 1247 assm.GetCode(isolate, &desc); |
| 1248 Handle<Code> code = isolate->factory()->NewCode( | 1248 Handle<Code> code = isolate->factory()->NewCode( |
| 1249 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1249 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1250 #ifdef OBJECT_PRINT | 1250 #ifdef OBJECT_PRINT |
| 1251 OFStream os(stdout); | 1251 OFStream os(stdout); |
| 1252 code->Print(os); | 1252 code->Print(os); |
| 1253 #endif | 1253 #endif |
| 1254 | 1254 |
| 1255 F0 f = FUNCTION_CAST<F0>(code->entry()); | 1255 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 1256 CHECK_EQ(0, f()); | 1256 CHECK_EQ(0, f()); |
| 1257 } | 1257 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 | 1383 |
| 1384 __ xor_(eax, eax); | 1384 __ xor_(eax, eax); |
| 1385 __ bind(&exit); | 1385 __ bind(&exit); |
| 1386 __ pop(ecx); | 1386 __ pop(ecx); |
| 1387 __ pop(esi); | 1387 __ pop(esi); |
| 1388 __ pop(ebx); | 1388 __ pop(ebx); |
| 1389 __ ret(0); | 1389 __ ret(0); |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 CodeDesc desc; | 1392 CodeDesc desc; |
| 1393 assm.GetCode(&desc); | 1393 assm.GetCode(isolate, &desc); |
| 1394 Handle<Code> code = isolate->factory()->NewCode( | 1394 Handle<Code> code = isolate->factory()->NewCode( |
| 1395 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1395 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1396 #ifdef OBJECT_PRINT | 1396 #ifdef OBJECT_PRINT |
| 1397 OFStream os(stdout); | 1397 OFStream os(stdout); |
| 1398 code->Print(os); | 1398 code->Print(os); |
| 1399 #endif | 1399 #endif |
| 1400 | 1400 |
| 1401 F0 f = FUNCTION_CAST<F0>(code->entry()); | 1401 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 1402 CHECK_EQ(0, f()); | 1402 CHECK_EQ(0, f()); |
| 1403 } | 1403 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1427 for (int i = 0; i < kNumCases; ++i) { | 1427 for (int i = 0; i < kNumCases; ++i) { |
| 1428 __ bind(&labels[i]); | 1428 __ bind(&labels[i]); |
| 1429 __ mov(eax, Immediate(values[i])); | 1429 __ mov(eax, Immediate(values[i])); |
| 1430 __ jmp(&done); | 1430 __ jmp(&done); |
| 1431 } | 1431 } |
| 1432 | 1432 |
| 1433 __ bind(&done); | 1433 __ bind(&done); |
| 1434 __ ret(0); | 1434 __ ret(0); |
| 1435 | 1435 |
| 1436 CodeDesc desc; | 1436 CodeDesc desc; |
| 1437 assm.GetCode(&desc); | 1437 assm.GetCode(isolate, &desc); |
| 1438 Handle<Code> code = isolate->factory()->NewCode( | 1438 Handle<Code> code = isolate->factory()->NewCode( |
| 1439 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1439 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1440 #ifdef OBJECT_PRINT | 1440 #ifdef OBJECT_PRINT |
| 1441 OFStream os(stdout); | 1441 OFStream os(stdout); |
| 1442 code->Print(os); | 1442 code->Print(os); |
| 1443 #endif | 1443 #endif |
| 1444 F1 f = FUNCTION_CAST<F1>(code->entry()); | 1444 F1 f = FUNCTION_CAST<F1>(code->entry()); |
| 1445 for (int i = 0; i < kNumCases; ++i) { | 1445 for (int i = 0; i < kNumCases; ++i) { |
| 1446 int res = f(i); | 1446 int res = f(i); |
| 1447 ::printf("f(%d) = %d\n", i, res); | 1447 ::printf("f(%d) = %d\n", i, res); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1475 | 1475 |
| 1476 __ bind(&table); | 1476 __ bind(&table); |
| 1477 for (int i = 0; i < kNumCases; ++i) { | 1477 for (int i = 0; i < kNumCases; ++i) { |
| 1478 __ dd(&labels[i]); | 1478 __ dd(&labels[i]); |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 __ bind(&done); | 1481 __ bind(&done); |
| 1482 __ ret(0); | 1482 __ ret(0); |
| 1483 | 1483 |
| 1484 CodeDesc desc; | 1484 CodeDesc desc; |
| 1485 assm.GetCode(&desc); | 1485 assm.GetCode(isolate, &desc); |
| 1486 Handle<Code> code = isolate->factory()->NewCode( | 1486 Handle<Code> code = isolate->factory()->NewCode( |
| 1487 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1487 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1488 #ifdef OBJECT_PRINT | 1488 #ifdef OBJECT_PRINT |
| 1489 OFStream os(stdout); | 1489 OFStream os(stdout); |
| 1490 code->Print(os); | 1490 code->Print(os); |
| 1491 #endif | 1491 #endif |
| 1492 F1 f = FUNCTION_CAST<F1>(code->entry()); | 1492 F1 f = FUNCTION_CAST<F1>(code->entry()); |
| 1493 for (int i = 0; i < kNumCases; ++i) { | 1493 for (int i = 0; i < kNumCases; ++i) { |
| 1494 int res = f(i); | 1494 int res = f(i); |
| 1495 ::printf("f(%d) = %d\n", i, res); | 1495 ::printf("f(%d) = %d\n", i, res); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1518 __ j(below_equal, &fail); | 1518 __ j(below_equal, &fail); |
| 1519 __ mov(eax, 1); | 1519 __ mov(eax, 1); |
| 1520 __ pop(ebx); | 1520 __ pop(ebx); |
| 1521 __ ret(0); | 1521 __ ret(0); |
| 1522 __ bind(&fail); | 1522 __ bind(&fail); |
| 1523 __ mov(eax, 0); | 1523 __ mov(eax, 0); |
| 1524 __ pop(ebx); | 1524 __ pop(ebx); |
| 1525 __ ret(0); | 1525 __ ret(0); |
| 1526 | 1526 |
| 1527 CodeDesc desc; | 1527 CodeDesc desc; |
| 1528 assm.GetCode(&desc); | 1528 assm.GetCode(isolate, &desc); |
| 1529 Handle<Code> code = isolate->factory()->NewCode( | 1529 Handle<Code> code = isolate->factory()->NewCode( |
| 1530 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1530 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1531 | 1531 |
| 1532 #ifdef OBJECT_PRINT | 1532 #ifdef OBJECT_PRINT |
| 1533 OFStream os(stdout); | 1533 OFStream os(stdout); |
| 1534 code->Print(os); | 1534 code->Print(os); |
| 1535 #endif | 1535 #endif |
| 1536 | 1536 |
| 1537 F0 f = FUNCTION_CAST<F0>(code->entry()); | 1537 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 1538 CHECK_EQ(1, f()); | 1538 CHECK_EQ(1, f()); |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 #undef __ | 1541 #undef __ |
| OLD | NEW |