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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.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 5173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5184 } | 5184 } |
5185 | 5185 |
5186 | 5186 |
5187 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5187 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
5188 DCHECK(ToRegister(instr->value()).is(eax)); | 5188 DCHECK(ToRegister(instr->value()).is(eax)); |
5189 __ push(eax); | 5189 __ push(eax); |
5190 CallRuntime(Runtime::kToFastProperties, 1, instr); | 5190 CallRuntime(Runtime::kToFastProperties, 1, instr); |
5191 } | 5191 } |
5192 | 5192 |
5193 | 5193 |
5194 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { | |
5195 DCHECK(ToRegister(instr->context()).is(esi)); | |
5196 Label materialized; | |
5197 // Registers will be used as follows: | |
5198 // ecx = literals array. | |
5199 // ebx = regexp literal. | |
5200 // eax = regexp literal clone. | |
5201 // esi = context. | |
5202 int literal_offset = | |
5203 LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index()); | |
5204 __ LoadHeapObject(ecx, instr->hydrogen()->literals()); | |
5205 __ mov(ebx, FieldOperand(ecx, literal_offset)); | |
5206 __ cmp(ebx, factory()->undefined_value()); | |
5207 __ j(not_equal, &materialized, Label::kNear); | |
5208 | |
5209 // Create regexp literal using runtime function | |
5210 // Result will be in eax. | |
5211 __ push(ecx); | |
5212 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | |
5213 __ push(Immediate(instr->hydrogen()->pattern())); | |
5214 __ push(Immediate(instr->hydrogen()->flags())); | |
5215 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | |
5216 __ mov(ebx, eax); | |
5217 | |
5218 __ bind(&materialized); | |
5219 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | |
5220 Label allocated, runtime_allocate; | |
5221 __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); | |
5222 __ jmp(&allocated, Label::kNear); | |
5223 | |
5224 __ bind(&runtime_allocate); | |
5225 __ push(ebx); | |
5226 __ push(Immediate(Smi::FromInt(size))); | |
5227 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | |
5228 __ pop(ebx); | |
5229 | |
5230 __ bind(&allocated); | |
5231 // Copy the content into the newly allocated memory. | |
5232 // (Unroll copy loop once for better throughput). | |
5233 for (int i = 0; i < size - kPointerSize; i += 2 * kPointerSize) { | |
5234 __ mov(edx, FieldOperand(ebx, i)); | |
5235 __ mov(ecx, FieldOperand(ebx, i + kPointerSize)); | |
5236 __ mov(FieldOperand(eax, i), edx); | |
5237 __ mov(FieldOperand(eax, i + kPointerSize), ecx); | |
5238 } | |
5239 if ((size % (2 * kPointerSize)) != 0) { | |
5240 __ mov(edx, FieldOperand(ebx, size - kPointerSize)); | |
5241 __ mov(FieldOperand(eax, size - kPointerSize), edx); | |
5242 } | |
5243 } | |
5244 | |
5245 | |
5246 void LCodeGen::DoTypeof(LTypeof* instr) { | 5194 void LCodeGen::DoTypeof(LTypeof* instr) { |
5247 DCHECK(ToRegister(instr->context()).is(esi)); | 5195 DCHECK(ToRegister(instr->context()).is(esi)); |
5248 DCHECK(ToRegister(instr->value()).is(ebx)); | 5196 DCHECK(ToRegister(instr->value()).is(ebx)); |
5249 Label end, do_call; | 5197 Label end, do_call; |
5250 Register value_register = ToRegister(instr->value()); | 5198 Register value_register = ToRegister(instr->value()); |
5251 __ JumpIfNotSmi(value_register, &do_call); | 5199 __ JumpIfNotSmi(value_register, &do_call); |
5252 __ mov(eax, Immediate(isolate()->factory()->number_string())); | 5200 __ mov(eax, Immediate(isolate()->factory()->number_string())); |
5253 __ jmp(&end); | 5201 __ jmp(&end); |
5254 __ bind(&do_call); | 5202 __ bind(&do_call); |
5255 TypeofStub stub(isolate()); | 5203 TypeofStub stub(isolate()); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5642 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5590 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5643 } | 5591 } |
5644 | 5592 |
5645 | 5593 |
5646 #undef __ | 5594 #undef __ |
5647 | 5595 |
5648 } // namespace internal | 5596 } // namespace internal |
5649 } // namespace v8 | 5597 } // namespace v8 |
5650 | 5598 |
5651 #endif // V8_TARGET_ARCH_IA32 | 5599 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |