OLD | NEW |
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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 ASSERT(!target.is(rdi)); | 781 ASSERT(!target.is(rdi)); |
782 // Load the JavaScript builtin function from the builtins object. | 782 // Load the JavaScript builtin function from the builtins object. |
783 GetBuiltinFunction(rdi, id); | 783 GetBuiltinFunction(rdi, id); |
784 movq(target, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 784 movq(target, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
785 } | 785 } |
786 | 786 |
787 | 787 |
788 void MacroAssembler::Set(Register dst, int64_t x) { | 788 void MacroAssembler::Set(Register dst, int64_t x) { |
789 if (x == 0) { | 789 if (x == 0) { |
790 xorl(dst, dst); | 790 xorl(dst, dst); |
| 791 } else if (is_uint32(x)) { |
| 792 movl(dst, Immediate(static_cast<uint32_t>(x))); |
791 } else if (is_int32(x)) { | 793 } else if (is_int32(x)) { |
792 movq(dst, Immediate(static_cast<int32_t>(x))); | 794 movq(dst, Immediate(static_cast<int32_t>(x))); |
793 } else if (is_uint32(x)) { | |
794 movl(dst, Immediate(static_cast<uint32_t>(x))); | |
795 } else { | 795 } else { |
796 movq(dst, x, RelocInfo::NONE); | 796 movq(dst, x, RelocInfo::NONE); |
797 } | 797 } |
798 } | 798 } |
799 | 799 |
800 void MacroAssembler::Set(const Operand& dst, int64_t x) { | 800 void MacroAssembler::Set(const Operand& dst, int64_t x) { |
801 if (is_int32(x)) { | 801 if (is_int32(x)) { |
802 movq(dst, Immediate(static_cast<int32_t>(x))); | 802 movq(dst, Immediate(static_cast<int32_t>(x))); |
803 } else { | 803 } else { |
804 movq(kScratchRegister, x, RelocInfo::NONE); | 804 Set(kScratchRegister, x); |
805 movq(dst, kScratchRegister); | 805 movq(dst, kScratchRegister); |
806 } | 806 } |
807 } | 807 } |
808 | 808 |
809 // ---------------------------------------------------------------------------- | 809 // ---------------------------------------------------------------------------- |
810 // Smi tagging, untagging and tag detection. | 810 // Smi tagging, untagging and tag detection. |
811 | 811 |
812 Register MacroAssembler::GetSmiConstant(Smi* source) { | 812 Register MacroAssembler::GetSmiConstant(Smi* source) { |
813 int value = source->value(); | 813 int value = source->value(); |
814 if (value == 0) { | 814 if (value == 0) { |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 bind(&done); | 1807 bind(&done); |
1808 | 1808 |
1809 // Set the top handler address to next handler past the current ENTRY handler. | 1809 // Set the top handler address to next handler past the current ENTRY handler. |
1810 Operand handler_operand = ExternalOperand(handler_address); | 1810 Operand handler_operand = ExternalOperand(handler_address); |
1811 pop(handler_operand); | 1811 pop(handler_operand); |
1812 | 1812 |
1813 if (type == OUT_OF_MEMORY) { | 1813 if (type == OUT_OF_MEMORY) { |
1814 // Set external caught exception to false. | 1814 // Set external caught exception to false. |
1815 ExternalReference external_caught( | 1815 ExternalReference external_caught( |
1816 Isolate::k_external_caught_exception_address, isolate()); | 1816 Isolate::k_external_caught_exception_address, isolate()); |
1817 movq(rax, Immediate(false)); | 1817 Set(rax, static_cast<int64_t>(false)); |
1818 Store(external_caught, rax); | 1818 Store(external_caught, rax); |
1819 | 1819 |
1820 // Set pending exception and rax to out of memory exception. | 1820 // Set pending exception and rax to out of memory exception. |
1821 ExternalReference pending_exception(Isolate::k_pending_exception_address, | 1821 ExternalReference pending_exception(Isolate::k_pending_exception_address, |
1822 isolate()); | 1822 isolate()); |
1823 movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); | 1823 movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); |
1824 Store(pending_exception, rax); | 1824 Store(pending_exception, rax); |
1825 } | 1825 } |
1826 | 1826 |
1827 // Clear the context pointer. | 1827 // Clear the context pointer. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 movq(result, FieldOperand(result, Map::kConstructorOffset)); | 1995 movq(result, FieldOperand(result, Map::kConstructorOffset)); |
1996 | 1996 |
1997 // All done. | 1997 // All done. |
1998 bind(&done); | 1998 bind(&done); |
1999 } | 1999 } |
2000 | 2000 |
2001 | 2001 |
2002 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 2002 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
2003 if (FLAG_native_code_counters && counter->Enabled()) { | 2003 if (FLAG_native_code_counters && counter->Enabled()) { |
2004 Operand counter_operand = ExternalOperand(ExternalReference(counter)); | 2004 Operand counter_operand = ExternalOperand(ExternalReference(counter)); |
2005 movq(counter_operand, Immediate(value)); | 2005 movl(counter_operand, Immediate(value)); |
2006 } | 2006 } |
2007 } | 2007 } |
2008 | 2008 |
2009 | 2009 |
2010 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { | 2010 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { |
2011 ASSERT(value > 0); | 2011 ASSERT(value > 0); |
2012 if (FLAG_native_code_counters && counter->Enabled()) { | 2012 if (FLAG_native_code_counters && counter->Enabled()) { |
2013 Operand counter_operand = ExternalOperand(ExternalReference(counter)); | 2013 Operand counter_operand = ExternalOperand(ExternalReference(counter)); |
2014 if (value == 1) { | 2014 if (value == 1) { |
2015 incl(counter_operand); | 2015 incl(counter_operand); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg); | 2213 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg); |
2214 } | 2214 } |
2215 } else if (arg_stack_space > 0) { | 2215 } else if (arg_stack_space > 0) { |
2216 subq(rsp, Immediate(arg_stack_space * kPointerSize)); | 2216 subq(rsp, Immediate(arg_stack_space * kPointerSize)); |
2217 } | 2217 } |
2218 | 2218 |
2219 // Get the required frame alignment for the OS. | 2219 // Get the required frame alignment for the OS. |
2220 const int kFrameAlignment = OS::ActivationFrameAlignment(); | 2220 const int kFrameAlignment = OS::ActivationFrameAlignment(); |
2221 if (kFrameAlignment > 0) { | 2221 if (kFrameAlignment > 0) { |
2222 ASSERT(IsPowerOf2(kFrameAlignment)); | 2222 ASSERT(IsPowerOf2(kFrameAlignment)); |
2223 movq(kScratchRegister, Immediate(-kFrameAlignment)); | 2223 ASSERT(is_int8(kFrameAlignment)); |
2224 and_(rsp, kScratchRegister); | 2224 and_(rsp, Immediate(-kFrameAlignment)); |
2225 } | 2225 } |
2226 | 2226 |
2227 // Patch the saved entry sp. | 2227 // Patch the saved entry sp. |
2228 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp); | 2228 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp); |
2229 } | 2229 } |
2230 | 2230 |
2231 | 2231 |
2232 void MacroAssembler::EnterExitFrame(int arg_stack_space, bool save_doubles) { | 2232 void MacroAssembler::EnterExitFrame(int arg_stack_space, bool save_doubles) { |
2233 EnterExitFramePrologue(true); | 2233 EnterExitFramePrologue(true); |
2234 | 2234 |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2904 CPU::FlushICache(address_, size_); | 2904 CPU::FlushICache(address_, size_); |
2905 | 2905 |
2906 // Check that the code was patched as expected. | 2906 // Check that the code was patched as expected. |
2907 ASSERT(masm_.pc_ == address_ + size_); | 2907 ASSERT(masm_.pc_ == address_ + size_); |
2908 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2908 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2909 } | 2909 } |
2910 | 2910 |
2911 } } // namespace v8::internal | 2911 } } // namespace v8::internal |
2912 | 2912 |
2913 #endif // V8_TARGET_ARCH_X64 | 2913 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |