Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 6602007: Add MathPowStub to x64 platform, and fix error in stub on ia32 platform. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3392 __ cvtsi2sd(xmm3, Operand(ecx)); 3392 __ cvtsi2sd(xmm3, Operand(ecx));
3393 3393
3394 Label exponent_nonsmi; 3394 Label exponent_nonsmi;
3395 Label base_nonsmi; 3395 Label base_nonsmi;
3396 // If the exponent is a heap number go to that specific case. 3396 // If the exponent is a heap number go to that specific case.
3397 __ test(eax, Immediate(kSmiTagMask)); 3397 __ test(eax, Immediate(kSmiTagMask));
3398 __ j(not_zero, &exponent_nonsmi); 3398 __ j(not_zero, &exponent_nonsmi);
3399 __ test(edx, Immediate(kSmiTagMask)); 3399 __ test(edx, Immediate(kSmiTagMask));
3400 __ j(not_zero, &base_nonsmi); 3400 __ j(not_zero, &base_nonsmi);
3401 3401
3402 // Optimized version when both exponent and base is a smi. 3402 // Optimized version when both exponent and base are smis.
3403 Label powi; 3403 Label powi;
3404 __ SmiUntag(edx); 3404 __ SmiUntag(edx);
3405 __ cvtsi2sd(xmm0, Operand(edx)); 3405 __ cvtsi2sd(xmm0, Operand(edx));
3406 __ jmp(&powi); 3406 __ jmp(&powi);
3407 // exponent is smi and base is a heapnumber. 3407 // exponent is smi and base is a heapnumber.
3408 __ bind(&base_nonsmi); 3408 __ bind(&base_nonsmi);
3409 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), 3409 __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
3410 Factory::heap_number_map()); 3410 Factory::heap_number_map());
3411 __ j(not_equal, &call_runtime); 3411 __ j(not_equal, &call_runtime);
3412 3412
(...skipping 18 matching lines...) Expand all
3431 // Load xmm1 with 1. 3431 // Load xmm1 with 1.
3432 __ movsd(xmm1, xmm3); 3432 __ movsd(xmm1, xmm3);
3433 NearLabel while_true; 3433 NearLabel while_true;
3434 NearLabel no_multiply; 3434 NearLabel no_multiply;
3435 3435
3436 __ bind(&while_true); 3436 __ bind(&while_true);
3437 __ shr(eax, 1); 3437 __ shr(eax, 1);
3438 __ j(not_carry, &no_multiply); 3438 __ j(not_carry, &no_multiply);
3439 __ mulsd(xmm1, xmm0); 3439 __ mulsd(xmm1, xmm0);
3440 __ bind(&no_multiply); 3440 __ bind(&no_multiply);
3441 __ test(eax, Operand(eax));
3442 __ mulsd(xmm0, xmm0); 3441 __ mulsd(xmm0, xmm0);
3443 __ j(not_zero, &while_true); 3442 __ j(not_zero, &while_true);
3444 3443
3445 // base has the original value of the exponent - if the exponent is 3444 // base has the original value of the exponent - if the exponent is
3446 // negative return 1/result. 3445 // negative return 1/result.
3447 __ test(edx, Operand(edx)); 3446 __ test(edx, Operand(edx));
3448 __ j(positive, &allocate_return); 3447 __ j(positive, &allocate_return);
3449 // Special case if xmm1 has reached infinity. 3448 // Special case if xmm1 has reached infinity.
3450 __ mov(ecx, Immediate(0x7FB00000)); 3449 __ mov(ecx, Immediate(0x7FB00000));
3451 __ movd(xmm0, Operand(ecx)); 3450 __ movd(xmm0, Operand(ecx));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3518 // Calculates square root. 3517 // Calculates square root.
3519 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. 3518 // sqrtsd returns -0 when input is -0. ECMA spec requires +0.
3520 __ xorpd(xmm1, xmm1); 3519 __ xorpd(xmm1, xmm1);
3521 __ addsd(xmm1, xmm0); 3520 __ addsd(xmm1, xmm0);
3522 __ sqrtsd(xmm1, xmm1); 3521 __ sqrtsd(xmm1, xmm1);
3523 3522
3524 __ bind(&allocate_return); 3523 __ bind(&allocate_return);
3525 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime); 3524 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime);
3526 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1); 3525 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1);
3527 __ mov(eax, ecx); 3526 __ mov(eax, ecx);
3528 __ ret(2); 3527 __ ret(2 * kPointerSize);
3529 3528
3530 __ bind(&call_runtime); 3529 __ bind(&call_runtime);
3531 __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1); 3530 __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1);
3532 } 3531 }
3533 3532
3534 3533
3535 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 3534 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
3536 // The key is in edx and the parameter count is in eax. 3535 // The key is in edx and the parameter count is in eax.
3537 3536
3538 // The displacement is used for skipping the frame pointer on the 3537 // The displacement is used for skipping the frame pointer on the
(...skipping 3077 matching lines...) Expand 10 before | Expand all | Expand 10 after
6616 __ mov_b(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); 6615 __ mov_b(Operand(external_pointer, untagged_key, times_1, 0), untagged_value);
6617 __ ret(0); // Return value in eax. 6616 __ ret(0); // Return value in eax.
6618 } 6617 }
6619 6618
6620 6619
6621 #undef __ 6620 #undef __
6622 6621
6623 } } // namespace v8::internal 6622 } } // namespace v8::internal
6624 6623
6625 #endif // V8_TARGET_ARCH_IA32 6624 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698