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

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

Issue 6015011: Use the macro assembler Set instead of explicit xor for clearing registers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 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 | « src/ia32/builtins-ia32.cc ('k') | src/ia32/debug-ia32.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Get the function from the stack. 98 // Get the function from the stack.
99 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 99 __ mov(ecx, Operand(esp, 1 * kPointerSize));
100 100
101 // Setup the object header. 101 // Setup the object header.
102 __ mov(FieldOperand(eax, HeapObject::kMapOffset), Factory::context_map()); 102 __ mov(FieldOperand(eax, HeapObject::kMapOffset), Factory::context_map());
103 __ mov(FieldOperand(eax, Context::kLengthOffset), 103 __ mov(FieldOperand(eax, Context::kLengthOffset),
104 Immediate(Smi::FromInt(length))); 104 Immediate(Smi::FromInt(length)));
105 105
106 // Setup the fixed slots. 106 // Setup the fixed slots.
107 __ xor_(ebx, Operand(ebx)); // Set to NULL. 107 __ Set(ebx, Immediate(0)); // Set to NULL.
108 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx); 108 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx);
109 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax); 109 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax);
110 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx); 110 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx);
111 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx); 111 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx);
112 112
113 // Copy the global object from the surrounding context. We go through the 113 // Copy the global object from the surrounding context. We go through the
114 // context in the function (ecx) to match the allocation behavior we have 114 // context in the function (ecx) to match the allocation behavior we have
115 // in the runtime system (see Heap::AllocateFunctionContext). 115 // in the runtime system (see Heap::AllocateFunctionContext).
116 __ mov(ebx, FieldOperand(ecx, JSFunction::kContextOffset)); 116 __ mov(ebx, FieldOperand(ecx, JSFunction::kContextOffset));
117 __ mov(ebx, Operand(ebx, Context::SlotOffset(Context::GLOBAL_INDEX))); 117 __ mov(ebx, Operand(ebx, Context::SlotOffset(Context::GLOBAL_INDEX)));
(...skipping 4178 matching lines...) Expand 10 before | Expand all | Expand 10 after
4296 // The representation of NaN values has all exponent bits (52..62) set, 4296 // The representation of NaN values has all exponent bits (52..62) set,
4297 // and not all mantissa bits (0..51) clear. 4297 // and not all mantissa bits (0..51) clear.
4298 // We only accept QNaNs, which have bit 51 set. 4298 // We only accept QNaNs, which have bit 51 set.
4299 // Read top bits of double representation (second word of value). 4299 // Read top bits of double representation (second word of value).
4300 4300
4301 // Value is a QNaN if value & kQuietNaNMask == kQuietNaNMask, i.e., 4301 // Value is a QNaN if value & kQuietNaNMask == kQuietNaNMask, i.e.,
4302 // all bits in the mask are set. We only need to check the word 4302 // all bits in the mask are set. We only need to check the word
4303 // that contains the exponent and high bit of the mantissa. 4303 // that contains the exponent and high bit of the mantissa.
4304 STATIC_ASSERT(((kQuietNaNHighBitsMask << 1) & 0x80000000u) != 0); 4304 STATIC_ASSERT(((kQuietNaNHighBitsMask << 1) & 0x80000000u) != 0);
4305 __ mov(edx, FieldOperand(edx, HeapNumber::kExponentOffset)); 4305 __ mov(edx, FieldOperand(edx, HeapNumber::kExponentOffset));
4306 __ xor_(eax, Operand(eax)); 4306 __ Set(eax, Immediate(0));
4307 // Shift value and mask so kQuietNaNHighBitsMask applies to topmost 4307 // Shift value and mask so kQuietNaNHighBitsMask applies to topmost
4308 // bits. 4308 // bits.
4309 __ add(edx, Operand(edx)); 4309 __ add(edx, Operand(edx));
4310 __ cmp(edx, kQuietNaNHighBitsMask << 1); 4310 __ cmp(edx, kQuietNaNHighBitsMask << 1);
4311 if (cc_ == equal) { 4311 if (cc_ == equal) {
4312 STATIC_ASSERT(EQUAL != 1); 4312 STATIC_ASSERT(EQUAL != 1);
4313 __ setcc(above_equal, eax); 4313 __ setcc(above_equal, eax);
4314 __ ret(0); 4314 __ ret(0);
4315 } else { 4315 } else {
4316 NearLabel nan; 4316 NearLabel nan;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
4426 __ FCmp(); 4426 __ FCmp();
4427 4427
4428 // Don't base result on EFLAGS when a NaN is involved. 4428 // Don't base result on EFLAGS when a NaN is involved.
4429 __ j(parity_even, &unordered, not_taken); 4429 __ j(parity_even, &unordered, not_taken);
4430 4430
4431 NearLabel below_label, above_label; 4431 NearLabel below_label, above_label;
4432 // Return a result of -1, 0, or 1, based on EFLAGS. 4432 // Return a result of -1, 0, or 1, based on EFLAGS.
4433 __ j(below, &below_label, not_taken); 4433 __ j(below, &below_label, not_taken);
4434 __ j(above, &above_label, not_taken); 4434 __ j(above, &above_label, not_taken);
4435 4435
4436 __ xor_(eax, Operand(eax)); 4436 __ Set(eax, Immediate(0));
4437 __ ret(0); 4437 __ ret(0);
4438 4438
4439 __ bind(&below_label); 4439 __ bind(&below_label);
4440 __ mov(eax, Immediate(Smi::FromInt(-1))); 4440 __ mov(eax, Immediate(Smi::FromInt(-1)));
4441 __ ret(0); 4441 __ ret(0);
4442 4442
4443 __ bind(&above_label); 4443 __ bind(&above_label);
4444 __ mov(eax, Immediate(Smi::FromInt(1))); 4444 __ mov(eax, Immediate(Smi::FromInt(1)));
4445 __ ret(0); 4445 __ ret(0);
4446 } 4446 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
4639 // Restore next handler and frame pointer, discard handler state. 4639 // Restore next handler and frame pointer, discard handler state.
4640 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); 4640 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
4641 __ pop(Operand::StaticVariable(handler_address)); 4641 __ pop(Operand::StaticVariable(handler_address));
4642 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); 4642 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
4643 __ pop(ebp); 4643 __ pop(ebp);
4644 __ pop(edx); // Remove state. 4644 __ pop(edx); // Remove state.
4645 4645
4646 // Before returning we restore the context from the frame pointer if 4646 // Before returning we restore the context from the frame pointer if
4647 // not NULL. The frame pointer is NULL in the exception handler of 4647 // not NULL. The frame pointer is NULL in the exception handler of
4648 // a JS entry frame. 4648 // a JS entry frame.
4649 __ xor_(esi, Operand(esi)); // Tentatively set context pointer to NULL. 4649 __ Set(esi, Immediate(0)); // Tentatively set context pointer to NULL.
4650 NearLabel skip; 4650 NearLabel skip;
4651 __ cmp(ebp, 0); 4651 __ cmp(ebp, 0);
4652 __ j(equal, &skip, not_taken); 4652 __ j(equal, &skip, not_taken);
4653 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 4653 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4654 __ bind(&skip); 4654 __ bind(&skip);
4655 4655
4656 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); 4656 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
4657 __ ret(0); 4657 __ ret(0);
4658 } 4658 }
4659 4659
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
4792 __ mov(eax, false); 4792 __ mov(eax, false);
4793 __ mov(Operand::StaticVariable(external_caught), eax); 4793 __ mov(Operand::StaticVariable(external_caught), eax);
4794 4794
4795 // Set pending exception and eax to out of memory exception. 4795 // Set pending exception and eax to out of memory exception.
4796 ExternalReference pending_exception(Top::k_pending_exception_address); 4796 ExternalReference pending_exception(Top::k_pending_exception_address);
4797 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); 4797 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException()));
4798 __ mov(Operand::StaticVariable(pending_exception), eax); 4798 __ mov(Operand::StaticVariable(pending_exception), eax);
4799 } 4799 }
4800 4800
4801 // Clear the context pointer. 4801 // Clear the context pointer.
4802 __ xor_(esi, Operand(esi)); 4802 __ Set(esi, Immediate(0));
4803 4803
4804 // Restore fp from handler and discard handler state. 4804 // Restore fp from handler and discard handler state.
4805 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); 4805 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
4806 __ pop(ebp); 4806 __ pop(ebp);
4807 __ pop(edx); // State. 4807 __ pop(edx); // State.
4808 4808
4809 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); 4809 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
4810 __ ret(0); 4810 __ ret(0);
4811 } 4811 }
4812 4812
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
6405 // Do a tail call to the rewritten stub. 6405 // Do a tail call to the rewritten stub.
6406 __ jmp(Operand(edi)); 6406 __ jmp(Operand(edi));
6407 } 6407 }
6408 6408
6409 6409
6410 #undef __ 6410 #undef __
6411 6411
6412 } } // namespace v8::internal 6412 } } // namespace v8::internal
6413 6413
6414 #endif // V8_TARGET_ARCH_IA32 6414 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/debug-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698