OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "x64/lithium-codegen-x64.h" | 9 #include "x64/lithium-codegen-x64.h" |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 | 2407 |
2408 return cond; | 2408 return cond; |
2409 } | 2409 } |
2410 | 2410 |
2411 | 2411 |
2412 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { | 2412 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { |
2413 Register reg = ToRegister(instr->value()); | 2413 Register reg = ToRegister(instr->value()); |
2414 Register temp = ToRegister(instr->temp()); | 2414 Register temp = ToRegister(instr->temp()); |
2415 | 2415 |
2416 SmiCheck check_needed = | 2416 SmiCheck check_needed = |
2417 instr->hydrogen()->value()->IsHeapObject() | 2417 instr->hydrogen()->value()->type().IsHeapObject() |
2418 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2418 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2419 | 2419 |
2420 Condition true_cond = EmitIsString( | 2420 Condition true_cond = EmitIsString( |
2421 reg, temp, instr->FalseLabel(chunk_), check_needed); | 2421 reg, temp, instr->FalseLabel(chunk_), check_needed); |
2422 | 2422 |
2423 EmitBranch(instr, true_cond); | 2423 EmitBranch(instr, true_cond); |
2424 } | 2424 } |
2425 | 2425 |
2426 | 2426 |
2427 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 2427 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
2428 Condition is_smi; | 2428 Condition is_smi; |
2429 if (instr->value()->IsRegister()) { | 2429 if (instr->value()->IsRegister()) { |
2430 Register input = ToRegister(instr->value()); | 2430 Register input = ToRegister(instr->value()); |
2431 is_smi = masm()->CheckSmi(input); | 2431 is_smi = masm()->CheckSmi(input); |
2432 } else { | 2432 } else { |
2433 Operand input = ToOperand(instr->value()); | 2433 Operand input = ToOperand(instr->value()); |
2434 is_smi = masm()->CheckSmi(input); | 2434 is_smi = masm()->CheckSmi(input); |
2435 } | 2435 } |
2436 EmitBranch(instr, is_smi); | 2436 EmitBranch(instr, is_smi); |
2437 } | 2437 } |
2438 | 2438 |
2439 | 2439 |
2440 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { | 2440 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { |
2441 Register input = ToRegister(instr->value()); | 2441 Register input = ToRegister(instr->value()); |
2442 Register temp = ToRegister(instr->temp()); | 2442 Register temp = ToRegister(instr->temp()); |
2443 | 2443 |
2444 if (!instr->hydrogen()->value()->IsHeapObject()) { | 2444 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
2445 __ JumpIfSmi(input, instr->FalseLabel(chunk_)); | 2445 __ JumpIfSmi(input, instr->FalseLabel(chunk_)); |
2446 } | 2446 } |
2447 __ movp(temp, FieldOperand(input, HeapObject::kMapOffset)); | 2447 __ movp(temp, FieldOperand(input, HeapObject::kMapOffset)); |
2448 __ testb(FieldOperand(temp, Map::kBitFieldOffset), | 2448 __ testb(FieldOperand(temp, Map::kBitFieldOffset), |
2449 Immediate(1 << Map::kIsUndetectable)); | 2449 Immediate(1 << Map::kIsUndetectable)); |
2450 EmitBranch(instr, not_zero); | 2450 EmitBranch(instr, not_zero); |
2451 } | 2451 } |
2452 | 2452 |
2453 | 2453 |
2454 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | 2454 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
(...skipping 26 matching lines...) Expand all Loading... |
2481 if (to == LAST_TYPE) return above_equal; | 2481 if (to == LAST_TYPE) return above_equal; |
2482 if (from == FIRST_TYPE) return below_equal; | 2482 if (from == FIRST_TYPE) return below_equal; |
2483 UNREACHABLE(); | 2483 UNREACHABLE(); |
2484 return equal; | 2484 return equal; |
2485 } | 2485 } |
2486 | 2486 |
2487 | 2487 |
2488 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { | 2488 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { |
2489 Register input = ToRegister(instr->value()); | 2489 Register input = ToRegister(instr->value()); |
2490 | 2490 |
2491 if (!instr->hydrogen()->value()->IsHeapObject()) { | 2491 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
2492 __ JumpIfSmi(input, instr->FalseLabel(chunk_)); | 2492 __ JumpIfSmi(input, instr->FalseLabel(chunk_)); |
2493 } | 2493 } |
2494 | 2494 |
2495 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister); | 2495 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister); |
2496 EmitBranch(instr, BranchCondition(instr->hydrogen())); | 2496 EmitBranch(instr, BranchCondition(instr->hydrogen())); |
2497 } | 2497 } |
2498 | 2498 |
2499 | 2499 |
2500 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { | 2500 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { |
2501 Register input = ToRegister(instr->value()); | 2501 Register input = ToRegister(instr->value()); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2870 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2871 DeoptimizeIf(equal, instr->environment()); | 2871 DeoptimizeIf(equal, instr->environment()); |
2872 } else { | 2872 } else { |
2873 __ j(not_equal, &skip_assignment); | 2873 __ j(not_equal, &skip_assignment); |
2874 } | 2874 } |
2875 } | 2875 } |
2876 __ movp(target, value); | 2876 __ movp(target, value); |
2877 | 2877 |
2878 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2878 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2879 SmiCheck check_needed = | 2879 SmiCheck check_needed = |
2880 instr->hydrogen()->value()->IsHeapObject() | 2880 instr->hydrogen()->value()->type().IsHeapObject() |
2881 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2881 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2882 int offset = Context::SlotOffset(instr->slot_index()); | 2882 int offset = Context::SlotOffset(instr->slot_index()); |
2883 Register scratch = ToRegister(instr->temp()); | 2883 Register scratch = ToRegister(instr->temp()); |
2884 __ RecordWriteContextSlot(context, | 2884 __ RecordWriteContextSlot(context, |
2885 offset, | 2885 offset, |
2886 value, | 2886 value, |
2887 scratch, | 2887 scratch, |
2888 kSaveFPRegs, | 2888 kSaveFPRegs, |
2889 EMIT_REMEMBERED_SET, | 2889 EMIT_REMEMBERED_SET, |
2890 check_needed); | 2890 check_needed); |
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4298 Handle<Object> handle_value = ToHandle(operand_value); | 4298 Handle<Object> handle_value = ToHandle(operand_value); |
4299 __ Move(operand, handle_value); | 4299 __ Move(operand, handle_value); |
4300 } | 4300 } |
4301 } | 4301 } |
4302 | 4302 |
4303 if (hinstr->NeedsWriteBarrier()) { | 4303 if (hinstr->NeedsWriteBarrier()) { |
4304 Register elements = ToRegister(instr->elements()); | 4304 Register elements = ToRegister(instr->elements()); |
4305 ASSERT(instr->value()->IsRegister()); | 4305 ASSERT(instr->value()->IsRegister()); |
4306 Register value = ToRegister(instr->value()); | 4306 Register value = ToRegister(instr->value()); |
4307 ASSERT(!key->IsConstantOperand()); | 4307 ASSERT(!key->IsConstantOperand()); |
4308 SmiCheck check_needed = hinstr->value()->IsHeapObject() | 4308 SmiCheck check_needed = hinstr->value()->type().IsHeapObject() |
4309 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4309 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4310 // Compute address of modified element and store it into key register. | 4310 // Compute address of modified element and store it into key register. |
4311 Register key_reg(ToRegister(key)); | 4311 Register key_reg(ToRegister(key)); |
4312 __ leap(key_reg, operand); | 4312 __ leap(key_reg, operand); |
4313 __ RecordWrite(elements, | 4313 __ RecordWrite(elements, |
4314 key_reg, | 4314 key_reg, |
4315 value, | 4315 value, |
4316 kSaveFPRegs, | 4316 kSaveFPRegs, |
4317 EMIT_REMEMBERED_SET, | 4317 EMIT_REMEMBERED_SET, |
4318 check_needed); | 4318 check_needed); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4902 | 4902 |
4903 | 4903 |
4904 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { | 4904 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { |
4905 LOperand* input = instr->value(); | 4905 LOperand* input = instr->value(); |
4906 Condition cc = masm()->CheckSmi(ToRegister(input)); | 4906 Condition cc = masm()->CheckSmi(ToRegister(input)); |
4907 DeoptimizeIf(NegateCondition(cc), instr->environment()); | 4907 DeoptimizeIf(NegateCondition(cc), instr->environment()); |
4908 } | 4908 } |
4909 | 4909 |
4910 | 4910 |
4911 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { | 4911 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { |
4912 if (!instr->hydrogen()->value()->IsHeapObject()) { | 4912 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
4913 LOperand* input = instr->value(); | 4913 LOperand* input = instr->value(); |
4914 Condition cc = masm()->CheckSmi(ToRegister(input)); | 4914 Condition cc = masm()->CheckSmi(ToRegister(input)); |
4915 DeoptimizeIf(cc, instr->environment()); | 4915 DeoptimizeIf(cc, instr->environment()); |
4916 } | 4916 } |
4917 } | 4917 } |
4918 | 4918 |
4919 | 4919 |
4920 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { | 4920 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
4921 Register input = ToRegister(instr->value()); | 4921 Register input = ToRegister(instr->value()); |
4922 | 4922 |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5694 __ bind(deferred->exit()); | 5694 __ bind(deferred->exit()); |
5695 __ bind(&done); | 5695 __ bind(&done); |
5696 } | 5696 } |
5697 | 5697 |
5698 | 5698 |
5699 #undef __ | 5699 #undef __ |
5700 | 5700 |
5701 } } // namespace v8::internal | 5701 } } // namespace v8::internal |
5702 | 5702 |
5703 #endif // V8_TARGET_ARCH_X64 | 5703 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |