| OLD | NEW |
| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 add(esp, Immediate(kDoubleSize)); | 246 add(esp, Immediate(kDoubleSize)); |
| 247 } | 247 } |
| 248 | 248 |
| 249 | 249 |
| 250 void MacroAssembler::X87TOSToI(Register result_reg, | 250 void MacroAssembler::X87TOSToI(Register result_reg, |
| 251 MinusZeroMode minus_zero_mode, | 251 MinusZeroMode minus_zero_mode, |
| 252 Label* conversion_failed, | 252 Label* conversion_failed, |
| 253 Label::Distance dst) { | 253 Label::Distance dst) { |
| 254 Label done; | 254 Label done; |
| 255 sub(esp, Immediate(kPointerSize)); | 255 sub(esp, Immediate(kPointerSize)); |
| 256 fld(0); |
| 256 fist_s(MemOperand(esp, 0)); | 257 fist_s(MemOperand(esp, 0)); |
| 257 fld(0); | |
| 258 fild_s(MemOperand(esp, 0)); | 258 fild_s(MemOperand(esp, 0)); |
| 259 pop(result_reg); | 259 pop(result_reg); |
| 260 FCmp(); | 260 FCmp(); |
| 261 j(not_equal, conversion_failed, dst); | 261 j(not_equal, conversion_failed, dst); |
| 262 j(parity_even, conversion_failed, dst); | 262 j(parity_even, conversion_failed, dst); |
| 263 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | 263 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { |
| 264 test(result_reg, Operand(result_reg)); | 264 test(result_reg, Operand(result_reg)); |
| 265 j(not_zero, &done, Label::kNear); | 265 j(not_zero, &done, Label::kNear); |
| 266 // To check for minus zero, we load the value again as float, and check | 266 // To check for minus zero, we load the value again as float, and check |
| 267 // if that is still 0. | 267 // if that is still 0. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 | 447 |
| 448 | 448 |
| 449 static double kUint32Bias = | 449 static double kUint32Bias = |
| 450 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; | 450 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; |
| 451 | 451 |
| 452 | 452 |
| 453 void MacroAssembler::LoadUint32(XMMRegister dst, | 453 void MacroAssembler::LoadUint32(XMMRegister dst, |
| 454 Register src, | 454 Register src, |
| 455 XMMRegister scratch) { | 455 XMMRegister scratch) { |
| 456 ASSERT(!Serializer::enabled()); |
| 456 Label done; | 457 Label done; |
| 457 cmp(src, Immediate(0)); | 458 cmp(src, Immediate(0)); |
| 458 movdbl(scratch, | 459 movdbl(scratch, |
| 459 Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32)); | 460 Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32)); |
| 460 Cvtsi2sd(dst, src); | 461 Cvtsi2sd(dst, src); |
| 461 j(not_sign, &done, Label::kNear); | 462 j(not_sign, &done, Label::kNear); |
| 462 addsd(dst, scratch); | 463 addsd(dst, scratch); |
| 463 bind(&done); | 464 bind(&done); |
| 464 } | 465 } |
| 465 | 466 |
| 466 | 467 |
| 468 void MacroAssembler::LoadUint32NoSSE2(Register src) { |
| 469 ASSERT(!Serializer::enabled()); |
| 470 Label done; |
| 471 push(src); |
| 472 fild_s(Operand(esp, 0)); |
| 473 cmp(src, Immediate(0)); |
| 474 j(not_sign, &done, Label::kNear); |
| 475 fld_d(Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32)); |
| 476 faddp(1); |
| 477 bind(&done); |
| 478 add(esp, Immediate(kPointerSize)); |
| 479 } |
| 480 |
| 481 |
| 467 void MacroAssembler::RecordWriteArray(Register object, | 482 void MacroAssembler::RecordWriteArray(Register object, |
| 468 Register value, | 483 Register value, |
| 469 Register index, | 484 Register index, |
| 470 SaveFPRegsMode save_fp, | 485 SaveFPRegsMode save_fp, |
| 471 RememberedSetAction remembered_set_action, | 486 RememberedSetAction remembered_set_action, |
| 472 SmiCheck smi_check) { | 487 SmiCheck smi_check) { |
| 473 // First, check if a write barrier is even needed. The tests below | 488 // First, check if a write barrier is even needed. The tests below |
| 474 // catch stores of Smis. | 489 // catch stores of Smis. |
| 475 Label done; | 490 Label done; |
| 476 | 491 |
| (...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 STATIC_ASSERT(String::kHashShift >= kSmiTagSize && kSmiTag == 0); | 2157 STATIC_ASSERT(String::kHashShift >= kSmiTagSize && kSmiTag == 0); |
| 2143 if (String::kHashShift > kSmiTagSize) { | 2158 if (String::kHashShift > kSmiTagSize) { |
| 2144 shr(hash, String::kHashShift - kSmiTagSize); | 2159 shr(hash, String::kHashShift - kSmiTagSize); |
| 2145 } | 2160 } |
| 2146 if (!index.is(hash)) { | 2161 if (!index.is(hash)) { |
| 2147 mov(index, hash); | 2162 mov(index, hash); |
| 2148 } | 2163 } |
| 2149 } | 2164 } |
| 2150 | 2165 |
| 2151 | 2166 |
| 2152 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { | |
| 2153 CallRuntime(Runtime::FunctionForId(id), num_arguments); | |
| 2154 } | |
| 2155 | |
| 2156 | |
| 2157 void MacroAssembler::CallRuntimeSaveDoubles(Runtime::FunctionId id) { | |
| 2158 const Runtime::Function* function = Runtime::FunctionForId(id); | |
| 2159 Set(eax, Immediate(function->nargs)); | |
| 2160 mov(ebx, Immediate(ExternalReference(function, isolate()))); | |
| 2161 CEntryStub ces(1, CpuFeatures::IsSupported(SSE2) ? kSaveFPRegs | |
| 2162 : kDontSaveFPRegs); | |
| 2163 CallStub(&ces); | |
| 2164 } | |
| 2165 | |
| 2166 | |
| 2167 void MacroAssembler::CallRuntime(const Runtime::Function* f, | 2167 void MacroAssembler::CallRuntime(const Runtime::Function* f, |
| 2168 int num_arguments) { | 2168 int num_arguments, |
| 2169 SaveFPRegsMode save_doubles) { |
| 2169 // If the expected number of arguments of the runtime function is | 2170 // If the expected number of arguments of the runtime function is |
| 2170 // constant, we check that the actual number of arguments match the | 2171 // constant, we check that the actual number of arguments match the |
| 2171 // expectation. | 2172 // expectation. |
| 2172 if (f->nargs >= 0 && f->nargs != num_arguments) { | 2173 if (f->nargs >= 0 && f->nargs != num_arguments) { |
| 2173 IllegalOperation(num_arguments); | 2174 IllegalOperation(num_arguments); |
| 2174 return; | 2175 return; |
| 2175 } | 2176 } |
| 2176 | 2177 |
| 2177 // TODO(1236192): Most runtime routines don't need the number of | 2178 // TODO(1236192): Most runtime routines don't need the number of |
| 2178 // arguments passed in because it is constant. At some point we | 2179 // arguments passed in because it is constant. At some point we |
| 2179 // should remove this need and make the runtime routine entry code | 2180 // should remove this need and make the runtime routine entry code |
| 2180 // smarter. | 2181 // smarter. |
| 2181 Set(eax, Immediate(num_arguments)); | 2182 Set(eax, Immediate(num_arguments)); |
| 2182 mov(ebx, Immediate(ExternalReference(f, isolate()))); | 2183 mov(ebx, Immediate(ExternalReference(f, isolate()))); |
| 2183 CEntryStub ces(1); | 2184 CEntryStub ces(1, CpuFeatures::IsSupported(SSE2) ? save_doubles |
| 2185 : kDontSaveFPRegs); |
| 2184 CallStub(&ces); | 2186 CallStub(&ces); |
| 2185 } | 2187 } |
| 2186 | 2188 |
| 2187 | 2189 |
| 2188 void MacroAssembler::CallExternalReference(ExternalReference ref, | 2190 void MacroAssembler::CallExternalReference(ExternalReference ref, |
| 2189 int num_arguments) { | 2191 int num_arguments) { |
| 2190 mov(eax, Immediate(num_arguments)); | 2192 mov(eax, Immediate(num_arguments)); |
| 2191 mov(ebx, Immediate(ref)); | 2193 mov(ebx, Immediate(ref)); |
| 2192 | 2194 |
| 2193 CEntryStub stub(1); | 2195 CEntryStub stub(1); |
| (...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3526 j(greater, &no_memento_available); | 3528 j(greater, &no_memento_available); |
| 3527 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), | 3529 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), |
| 3528 Immediate(isolate()->factory()->allocation_memento_map())); | 3530 Immediate(isolate()->factory()->allocation_memento_map())); |
| 3529 bind(&no_memento_available); | 3531 bind(&no_memento_available); |
| 3530 } | 3532 } |
| 3531 | 3533 |
| 3532 | 3534 |
| 3533 } } // namespace v8::internal | 3535 } } // namespace v8::internal |
| 3534 | 3536 |
| 3535 #endif // V8_TARGET_ARCH_IA32 | 3537 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |