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

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 119241: A bunch of changes to speed up math on ARM.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4989 matching lines...) Expand 10 before | Expand all | Expand 10 after
5000 } else { 5000 } else {
5001 Load(node->expression()); 5001 Load(node->expression());
5002 switch (op) { 5002 switch (op) {
5003 case Token::NOT: 5003 case Token::NOT:
5004 case Token::DELETE: 5004 case Token::DELETE:
5005 case Token::TYPEOF: 5005 case Token::TYPEOF:
5006 UNREACHABLE(); // handled above 5006 UNREACHABLE(); // handled above
5007 break; 5007 break;
5008 5008
5009 case Token::SUB: { 5009 case Token::SUB: {
5010 UnarySubStub stub; 5010 bool overwrite =
5011 (node->AsBinaryOperation() != NULL &&
5012 node->AsBinaryOperation()->ResultOverwriteAllowed());
5013 UnarySubStub stub(overwrite);
5011 // TODO(1222589): remove dependency of TOS being cached inside stub 5014 // TODO(1222589): remove dependency of TOS being cached inside stub
5012 Result operand = frame_->Pop(); 5015 Result operand = frame_->Pop();
5013 Result answer = frame_->CallStub(&stub, &operand); 5016 Result answer = frame_->CallStub(&stub, &operand);
5014 frame_->Push(&answer); 5017 frame_->Push(&answer);
5015 break; 5018 break;
5016 } 5019 }
5017 5020
5018 case Token::BIT_NOT: { 5021 case Token::BIT_NOT: {
5019 // Smi check. 5022 // Smi check.
5020 JumpTarget smi_label; 5023 JumpTarget smi_label;
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
6531 __ pop(ecx); // pop return address 6534 __ pop(ecx); // pop return address
6532 __ push(eax); 6535 __ push(eax);
6533 __ push(ecx); // push return address 6536 __ push(ecx); // push return address
6534 __ InvokeBuiltin(Builtins::UNARY_MINUS, JUMP_FUNCTION); 6537 __ InvokeBuiltin(Builtins::UNARY_MINUS, JUMP_FUNCTION);
6535 6538
6536 // Try floating point case. 6539 // Try floating point case.
6537 __ bind(&try_float); 6540 __ bind(&try_float);
6538 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); 6541 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
6539 __ cmp(edx, Factory::heap_number_map()); 6542 __ cmp(edx, Factory::heap_number_map());
6540 __ j(not_equal, &slow); 6543 __ j(not_equal, &slow);
6541 __ mov(edx, Operand(eax)); 6544 if (overwrite_) {
6542 // edx: operand 6545 __ mov(edx, FieldOperand(eax, HeapNumber::kExponentOffset));
6543 FloatingPointHelper::AllocateHeapNumber(masm, &undo, ebx, ecx); 6546 __ xor_(edx, HeapNumber::kSignMask); // Flip sign.
6544 // eax: allocated 'empty' number 6547 __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), edx);
6545 __ fld_d(FieldOperand(edx, HeapNumber::kValueOffset)); 6548 } else {
6546 __ fchs(); 6549 __ mov(edx, Operand(eax));
6547 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); 6550 // edx: operand
6551 FloatingPointHelper::AllocateHeapNumber(masm, &undo, ebx, ecx);
6552 // eax: allocated 'empty' number
6553 __ mov(ecx, FieldOperand(edx, HeapNumber::kExponentOffset));
6554 __ xor_(ecx, HeapNumber::kSignMask); // Flip sign.
6555 __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ecx);
6556 __ mov(ecx, FieldOperand(edx, HeapNumber::kMantissaOffset));
6557 __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx);
6558 }
6548 6559
6549 __ bind(&done); 6560 __ bind(&done);
6550 6561
6551 __ StubReturn(1); 6562 __ StubReturn(1);
6552 } 6563 }
6553 6564
6554 6565
6555 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { 6566 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
6556 // Check if the calling frame is an arguments adaptor frame. 6567 // Check if the calling frame is an arguments adaptor frame.
6557 Label adaptor; 6568 Label adaptor;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
6681 __ bind(&return_equal); 6692 __ bind(&return_equal);
6682 __ Set(eax, Immediate(0)); 6693 __ Set(eax, Immediate(0));
6683 __ ret(0); 6694 __ ret(0);
6684 6695
6685 __ bind(&heap_number); 6696 __ bind(&heap_number);
6686 // It is a heap number, so return non-equal if it's NaN and equal if it's 6697 // It is a heap number, so return non-equal if it's NaN and equal if it's
6687 // not NaN. 6698 // not NaN.
6688 // The representation of NaN values has all exponent bits (52..62) set, 6699 // The representation of NaN values has all exponent bits (52..62) set,
6689 // and not all mantissa bits (0..51) clear. 6700 // and not all mantissa bits (0..51) clear.
6690 // Read top bits of double representation (second word of value). 6701 // Read top bits of double representation (second word of value).
6691 __ mov(eax, FieldOperand(edx, HeapNumber::kValueOffset + kPointerSize)); 6702 __ mov(eax, FieldOperand(edx, HeapNumber::kExponentOffset));
6692 // Test that exponent bits are all set. 6703 // Test that exponent bits are all set.
6693 __ not_(eax); 6704 __ not_(eax);
6694 __ test(eax, Immediate(0x7ff00000)); 6705 __ test(eax, Immediate(0x7ff00000));
6695 __ j(not_zero, &return_equal); 6706 __ j(not_zero, &return_equal);
6696 __ not_(eax); 6707 __ not_(eax);
6697 6708
6698 // Shift out flag and all exponent bits, retaining only mantissa. 6709 // Shift out flag and all exponent bits, retaining only mantissa.
6699 __ shl(eax, 12); 6710 __ shl(eax, 12);
6700 // Or with all low-bits of mantissa. 6711 // Or with all low-bits of mantissa.
6701 __ or_(eax, FieldOperand(edx, HeapNumber::kValueOffset)); 6712 __ or_(eax, FieldOperand(edx, HeapNumber::kMantissaOffset));
6702 // Return zero equal if all bits in mantissa is zero (it's an Infinity) 6713 // Return zero equal if all bits in mantissa is zero (it's an Infinity)
6703 // and non-zero if not (it's a NaN). 6714 // and non-zero if not (it's a NaN).
6704 __ ret(0); 6715 __ ret(0);
6705 6716
6706 __ bind(&not_identical); 6717 __ bind(&not_identical);
6707 } 6718 }
6708 6719
6709 // If we're doing a strict equality comparison, we don't have to do 6720 // If we're doing a strict equality comparison, we don't have to do
6710 // type conversion, so we generate code to do fast comparison for objects 6721 // type conversion, so we generate code to do fast comparison for objects
6711 // and oddballs. Non-smi numbers and strings still go through the usual 6722 // and oddballs. Non-smi numbers and strings still go through the usual
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
7272 7283
7273 // Slow-case: Go through the JavaScript implementation. 7284 // Slow-case: Go through the JavaScript implementation.
7274 __ bind(&slow); 7285 __ bind(&slow);
7275 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 7286 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
7276 } 7287 }
7277 7288
7278 7289
7279 #undef __ 7290 #undef __
7280 7291
7281 } } // namespace v8::internal 7292 } } // namespace v8::internal
OLDNEW
« src/arm/codegen-arm.cc ('K') | « src/d8.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698