| OLD | NEW |
| 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 4815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4826 } | 4826 } |
| 4827 } | 4827 } |
| 4828 __ Push(Smi::FromInt(size_)); | 4828 __ Push(Smi::FromInt(size_)); |
| 4829 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 4829 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
| 4830 if (!target_.is(rax)) { | 4830 if (!target_.is(rax)) { |
| 4831 __ movq(target_, rax); | 4831 __ movq(target_, rax); |
| 4832 } | 4832 } |
| 4833 for (int i = kNumRegs - 1; i >= 0; i--) { | 4833 for (int i = kNumRegs - 1; i >= 0; i--) { |
| 4834 if (registers_to_save_ & (1 << i)) { | 4834 if (registers_to_save_ & (1 << i)) { |
| 4835 Register save_register = { i }; | 4835 Register save_register = { i }; |
| 4836 __ push(save_register); | 4836 __ pop(save_register); |
| 4837 } | 4837 } |
| 4838 } | 4838 } |
| 4839 } | 4839 } |
| 4840 | 4840 |
| 4841 | 4841 |
| 4842 void CodeGenerator::VisitRegExpLiteral(RegExpLiteral* node) { | 4842 void CodeGenerator::VisitRegExpLiteral(RegExpLiteral* node) { |
| 4843 Comment cmnt(masm_, "[ RegExp Literal"); | 4843 Comment cmnt(masm_, "[ RegExp Literal"); |
| 4844 | 4844 |
| 4845 // Retrieve the literals array and check the allocated entry. Begin | 4845 // Retrieve the literals array and check the allocated entry. Begin |
| 4846 // with a writable copy of the function of this activation in a | 4846 // with a writable copy of the function of this activation in a |
| (...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6641 // which is either an unmodified JSRegExpResult or null. Anything not having | 6641 // which is either an unmodified JSRegExpResult or null. Anything not having |
| 6642 // the unmodified JSRegExpResult map is returned unmodified. | 6642 // the unmodified JSRegExpResult map is returned unmodified. |
| 6643 // This also ensures that elements are fast. | 6643 // This also ensures that elements are fast. |
| 6644 | 6644 |
| 6645 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_INDEX)); | 6645 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_INDEX)); |
| 6646 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset)); | 6646 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset)); |
| 6647 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX)); | 6647 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX)); |
| 6648 __ cmpq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); | 6648 __ cmpq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); |
| 6649 __ j(not_equal, &done); | 6649 __ j(not_equal, &done); |
| 6650 | 6650 |
| 6651 if (FLAG_debug_code) { |
| 6652 // Check that object really has empty properties array, as the map |
| 6653 // should guarantee. |
| 6654 __ CompareRoot(FieldOperand(rax, JSObject::kPropertiesOffset), |
| 6655 Heap::kEmptyFixedArrayRootIndex); |
| 6656 __ Check(equal, "JSRegExpResult: default map but non-empty properties."); |
| 6657 } |
| 6658 |
| 6651 DeferredAllocateInNewSpace* allocate_fallback = | 6659 DeferredAllocateInNewSpace* allocate_fallback = |
| 6652 new DeferredAllocateInNewSpace(JSRegExpResult::kSize, | 6660 new DeferredAllocateInNewSpace(JSRegExpResult::kSize, |
| 6653 rbx, | 6661 rbx, |
| 6654 rdx.bit() | rax.bit()); | 6662 rdx.bit() | rax.bit()); |
| 6655 | 6663 |
| 6656 // All set, copy the contents to a new object. | 6664 // All set, copy the contents to a new object. |
| 6657 __ AllocateInNewSpace(JSRegExpResult::kSize, | 6665 __ AllocateInNewSpace(JSRegExpResult::kSize, |
| 6658 rbx, | 6666 rbx, |
| 6659 no_reg, | 6667 no_reg, |
| 6660 no_reg, | 6668 no_reg, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6673 } | 6681 } |
| 6674 __ movq(rcx, FieldOperand(rax, i + kPointerSize)); | 6682 __ movq(rcx, FieldOperand(rax, i + kPointerSize)); |
| 6675 | 6683 |
| 6676 STATIC_ASSERT(JSObject::kElementsOffset % (2 * kPointerSize) == 0); | 6684 STATIC_ASSERT(JSObject::kElementsOffset % (2 * kPointerSize) == 0); |
| 6677 if (i == JSObject::kElementsOffset) { | 6685 if (i == JSObject::kElementsOffset) { |
| 6678 // If the elements array isn't empty, make it copy-on-write | 6686 // If the elements array isn't empty, make it copy-on-write |
| 6679 // before copying it. | 6687 // before copying it. |
| 6680 Label empty; | 6688 Label empty; |
| 6681 __ CompareRoot(rdx, Heap::kEmptyFixedArrayRootIndex); | 6689 __ CompareRoot(rdx, Heap::kEmptyFixedArrayRootIndex); |
| 6682 __ j(equal, &empty); | 6690 __ j(equal, &empty); |
| 6683 ASSERT(!Heap::InNewSpace(Heap::fixed_cow_array_map())); | |
| 6684 __ LoadRoot(kScratchRegister, Heap::kFixedCOWArrayMapRootIndex); | 6691 __ LoadRoot(kScratchRegister, Heap::kFixedCOWArrayMapRootIndex); |
| 6685 __ movq(FieldOperand(rdx, HeapObject::kMapOffset), kScratchRegister); | 6692 __ movq(FieldOperand(rdx, HeapObject::kMapOffset), kScratchRegister); |
| 6686 __ bind(&empty); | 6693 __ bind(&empty); |
| 6687 } | 6694 } |
| 6688 __ movq(FieldOperand(rbx, i), rdx); | 6695 __ movq(FieldOperand(rbx, i), rdx); |
| 6689 __ movq(FieldOperand(rbx, i + kPointerSize), rcx); | 6696 __ movq(FieldOperand(rbx, i + kPointerSize), rcx); |
| 6690 } | 6697 } |
| 6691 __ movq(rax, rbx); | 6698 __ movq(rax, rbx); |
| 6692 | 6699 |
| 6693 __ bind(&done); | 6700 __ bind(&done); |
| (...skipping 6158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12852 #undef __ | 12859 #undef __ |
| 12853 | 12860 |
| 12854 void RecordWriteStub::Generate(MacroAssembler* masm) { | 12861 void RecordWriteStub::Generate(MacroAssembler* masm) { |
| 12855 masm->RecordWriteHelper(object_, addr_, scratch_); | 12862 masm->RecordWriteHelper(object_, addr_, scratch_); |
| 12856 masm->ret(0); | 12863 masm->ret(0); |
| 12857 } | 12864 } |
| 12858 | 12865 |
| 12859 } } // namespace v8::internal | 12866 } } // namespace v8::internal |
| 12860 | 12867 |
| 12861 #endif // V8_TARGET_ARCH_X64 | 12868 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |