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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 __ cmpl(FieldOperand(value, HeapNumber::kExponentOffset), | 2420 __ cmpl(FieldOperand(value, HeapNumber::kExponentOffset), |
2421 Immediate(0x1)); | 2421 Immediate(0x1)); |
2422 EmitFalseBranch(instr, no_overflow); | 2422 EmitFalseBranch(instr, no_overflow); |
2423 __ cmpl(FieldOperand(value, HeapNumber::kMantissaOffset), | 2423 __ cmpl(FieldOperand(value, HeapNumber::kMantissaOffset), |
2424 Immediate(0x00000000)); | 2424 Immediate(0x00000000)); |
2425 EmitBranch(instr, equal); | 2425 EmitBranch(instr, equal); |
2426 } | 2426 } |
2427 } | 2427 } |
2428 | 2428 |
2429 | 2429 |
2430 Condition LCodeGen::EmitIsObject(Register input, | |
2431 Label* is_not_object, | |
2432 Label* is_object) { | |
2433 DCHECK(!input.is(kScratchRegister)); | |
2434 | |
2435 __ JumpIfSmi(input, is_not_object); | |
2436 | |
2437 __ CompareRoot(input, Heap::kNullValueRootIndex); | |
2438 __ j(equal, is_object); | |
2439 | |
2440 __ movp(kScratchRegister, FieldOperand(input, HeapObject::kMapOffset)); | |
2441 // Undetectable objects behave like undefined. | |
2442 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset), | |
2443 Immediate(1 << Map::kIsUndetectable)); | |
2444 __ j(not_zero, is_not_object); | |
2445 | |
2446 __ movzxbl(kScratchRegister, | |
2447 FieldOperand(kScratchRegister, Map::kInstanceTypeOffset)); | |
2448 __ cmpb(kScratchRegister, Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
2449 __ j(below, is_not_object); | |
2450 __ cmpb(kScratchRegister, Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
2451 return below_equal; | |
2452 } | |
2453 | |
2454 | |
2455 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { | |
2456 Register reg = ToRegister(instr->value()); | |
2457 | |
2458 Condition true_cond = EmitIsObject( | |
2459 reg, instr->FalseLabel(chunk_), instr->TrueLabel(chunk_)); | |
2460 | |
2461 EmitBranch(instr, true_cond); | |
2462 } | |
2463 | |
2464 | |
2465 Condition LCodeGen::EmitIsString(Register input, | 2430 Condition LCodeGen::EmitIsString(Register input, |
2466 Register temp1, | 2431 Register temp1, |
2467 Label* is_not_string, | 2432 Label* is_not_string, |
2468 SmiCheck check_needed = INLINE_SMI_CHECK) { | 2433 SmiCheck check_needed = INLINE_SMI_CHECK) { |
2469 if (check_needed == INLINE_SMI_CHECK) { | 2434 if (check_needed == INLINE_SMI_CHECK) { |
2470 __ JumpIfSmi(input, is_not_string); | 2435 __ JumpIfSmi(input, is_not_string); |
2471 } | 2436 } |
2472 | 2437 |
2473 Condition cond = masm_->IsObjectStringType(input, temp1, temp1); | 2438 Condition cond = masm_->IsObjectStringType(input, temp1, temp1); |
2474 | 2439 |
(...skipping 3499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5974 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5939 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5975 } | 5940 } |
5976 | 5941 |
5977 | 5942 |
5978 #undef __ | 5943 #undef __ |
5979 | 5944 |
5980 } // namespace internal | 5945 } // namespace internal |
5981 } // namespace v8 | 5946 } // namespace v8 |
5982 | 5947 |
5983 #endif // V8_TARGET_ARCH_X64 | 5948 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |