OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 5731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5742 } | 5742 } |
5743 | 5743 |
5744 | 5744 |
5745 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5745 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
5746 DCHECK(ToRegister(instr->value()).is(eax)); | 5746 DCHECK(ToRegister(instr->value()).is(eax)); |
5747 __ push(eax); | 5747 __ push(eax); |
5748 CallRuntime(Runtime::kToFastProperties, 1, instr); | 5748 CallRuntime(Runtime::kToFastProperties, 1, instr); |
5749 } | 5749 } |
5750 | 5750 |
5751 | 5751 |
5752 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { | |
5753 DCHECK(ToRegister(instr->context()).is(esi)); | |
5754 Label materialized; | |
5755 // Registers will be used as follows: | |
5756 // ecx = literals array. | |
5757 // ebx = regexp literal. | |
5758 // eax = regexp literal clone. | |
5759 // esi = context. | |
5760 int literal_offset = | |
5761 LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index()); | |
5762 __ LoadHeapObject(ecx, instr->hydrogen()->literals()); | |
5763 __ mov(ebx, FieldOperand(ecx, literal_offset)); | |
5764 __ cmp(ebx, factory()->undefined_value()); | |
5765 __ j(not_equal, &materialized, Label::kNear); | |
5766 | |
5767 // Create regexp literal using runtime function | |
5768 // Result will be in eax. | |
5769 __ push(ecx); | |
5770 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | |
5771 __ push(Immediate(instr->hydrogen()->pattern())); | |
5772 __ push(Immediate(instr->hydrogen()->flags())); | |
5773 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | |
5774 __ mov(ebx, eax); | |
5775 | |
5776 __ bind(&materialized); | |
5777 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | |
5778 Label allocated, runtime_allocate; | |
5779 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); | |
5780 __ jmp(&allocated, Label::kNear); | |
5781 | |
5782 __ bind(&runtime_allocate); | |
5783 __ push(ebx); | |
5784 __ push(Immediate(Smi::FromInt(size))); | |
5785 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | |
5786 __ pop(ebx); | |
5787 | |
5788 __ bind(&allocated); | |
5789 // Copy the content into the newly allocated memory. | |
5790 // (Unroll copy loop once for better throughput). | |
5791 for (int i = 0; i < size - kPointerSize; i += 2 * kPointerSize) { | |
5792 __ mov(edx, FieldOperand(ebx, i)); | |
5793 __ mov(ecx, FieldOperand(ebx, i + kPointerSize)); | |
5794 __ mov(FieldOperand(eax, i), edx); | |
5795 __ mov(FieldOperand(eax, i + kPointerSize), ecx); | |
5796 } | |
5797 if ((size % (2 * kPointerSize)) != 0) { | |
5798 __ mov(edx, FieldOperand(ebx, size - kPointerSize)); | |
5799 __ mov(FieldOperand(eax, size - kPointerSize), edx); | |
5800 } | |
5801 } | |
5802 | |
5803 | |
5804 void LCodeGen::DoTypeof(LTypeof* instr) { | 5752 void LCodeGen::DoTypeof(LTypeof* instr) { |
5805 DCHECK(ToRegister(instr->context()).is(esi)); | 5753 DCHECK(ToRegister(instr->context()).is(esi)); |
5806 DCHECK(ToRegister(instr->value()).is(ebx)); | 5754 DCHECK(ToRegister(instr->value()).is(ebx)); |
5807 Label end, do_call; | 5755 Label end, do_call; |
5808 Register value_register = ToRegister(instr->value()); | 5756 Register value_register = ToRegister(instr->value()); |
5809 __ JumpIfNotSmi(value_register, &do_call); | 5757 __ JumpIfNotSmi(value_register, &do_call); |
5810 __ mov(eax, Immediate(isolate()->factory()->number_string())); | 5758 __ mov(eax, Immediate(isolate()->factory()->number_string())); |
5811 __ jmp(&end); | 5759 __ jmp(&end); |
5812 __ bind(&do_call); | 5760 __ bind(&do_call); |
5813 TypeofStub stub(isolate()); | 5761 TypeofStub stub(isolate()); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6203 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6151 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6204 } | 6152 } |
6205 | 6153 |
6206 | 6154 |
6207 #undef __ | 6155 #undef __ |
6208 | 6156 |
6209 } // namespace internal | 6157 } // namespace internal |
6210 } // namespace v8 | 6158 } // namespace v8 |
6211 | 6159 |
6212 #endif // V8_TARGET_ARCH_X87 | 6160 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |