| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 __ mov(scratch, FieldOperand(eax, HeapObject::kMapOffset)); | 263 __ mov(scratch, FieldOperand(eax, HeapObject::kMapOffset)); |
| 264 __ cmp(scratch, factory->heap_number_map()); | 264 __ cmp(scratch, factory->heap_number_map()); |
| 265 __ j(not_equal, non_float); // argument in eax is not a number -> NaN | 265 __ j(not_equal, non_float); // argument in eax is not a number -> NaN |
| 266 | 266 |
| 267 // Fall-through: Both operands are numbers. | 267 // Fall-through: Both operands are numbers. |
| 268 __ bind(&done); | 268 __ bind(&done); |
| 269 } | 269 } |
| 270 | 270 |
| 271 | 271 |
| 272 void MathPowStub::Generate(MacroAssembler* masm) { | 272 void MathPowStub::Generate(MacroAssembler* masm) { |
| 273 const Register base = edx; | |
| 274 const Register scratch = ecx; | 273 const Register scratch = ecx; |
| 275 Label call_runtime; | |
| 276 | 274 |
| 277 // We will call runtime helper function directly. | 275 // Load the double_exponent into x87 FPU |
| 278 if (exponent_type() == ON_STACK) { | 276 __ fld_d(Operand(esp, 0 * kDoubleSize + 4)); |
| 279 // The arguments are still on the stack. | 277 // Load the double_base into x87 FPU |
| 280 __ bind(&call_runtime); | 278 __ fld_d(Operand(esp, 1 * kDoubleSize + 4)); |
| 281 __ TailCallRuntime(Runtime::kMathPowRT); | |
| 282 | 279 |
| 283 // The stub is called from non-optimized code, which expects the result | 280 // Call ieee754 runtime directly. |
| 284 // as heap number in exponent. | 281 { |
| 285 __ AllocateHeapNumber(eax, scratch, base, &call_runtime); | 282 AllowExternalCallThatCantCauseGC scope(masm); |
| 286 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); | 283 __ PrepareCallCFunction(4, scratch); |
| 287 __ ret(2 * kPointerSize); | 284 // Put the double_base parameter in call stack |
| 288 } else { | 285 __ fstp_d(Operand(esp, 0 * kDoubleSize)); |
| 289 // Currently it's only called from full-compiler and exponent type is | 286 // Put the double_exponent parameter in call stack |
| 290 // ON_STACK. | 287 __ fstp_d(Operand(esp, 1 * kDoubleSize)); |
| 291 UNIMPLEMENTED(); | 288 __ CallCFunction(ExternalReference::power_double_double_function(isolate()), |
| 289 4); |
| 292 } | 290 } |
| 291 // Return value is in st(0) on ia32. |
| 292 __ ret(0); |
| 293 } | 293 } |
| 294 | 294 |
| 295 | 295 |
| 296 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 296 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
| 297 Label miss; | 297 Label miss; |
| 298 Register receiver = LoadDescriptor::ReceiverRegister(); | 298 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 299 // With careful management, we won't have to save slot and vector on | 299 // With careful management, we won't have to save slot and vector on |
| 300 // the stack. Simply handle the possibly missing case first. | 300 // the stack. Simply handle the possibly missing case first. |
| 301 // TODO(mvstanton): this code can be more efficient. | 301 // TODO(mvstanton): this code can be more efficient. |
| 302 __ cmp(FieldOperand(receiver, JSFunction::kPrototypeOrInitialMapOffset), | 302 __ cmp(FieldOperand(receiver, JSFunction::kPrototypeOrInitialMapOffset), |
| (...skipping 4985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5288 kStackUnwindSpace, nullptr, return_value_operand, | 5288 kStackUnwindSpace, nullptr, return_value_operand, |
| 5289 NULL); | 5289 NULL); |
| 5290 } | 5290 } |
| 5291 | 5291 |
| 5292 #undef __ | 5292 #undef __ |
| 5293 | 5293 |
| 5294 } // namespace internal | 5294 } // namespace internal |
| 5295 } // namespace v8 | 5295 } // namespace v8 |
| 5296 | 5296 |
| 5297 #endif // V8_TARGET_ARCH_X87 | 5297 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |