OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/cpu-profiler.h" | 8 #include "src/cpu-profiler.h" |
9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 __ cmp(scratch, r0); | 2518 __ cmp(scratch, r0); |
2519 __ bne(&skip); | 2519 __ bne(&skip); |
2520 __ cmpi(ip, Operand::Zero()); | 2520 __ cmpi(ip, Operand::Zero()); |
2521 __ bind(&skip); | 2521 __ bind(&skip); |
2522 #endif | 2522 #endif |
2523 EmitBranch(instr, eq); | 2523 EmitBranch(instr, eq); |
2524 } | 2524 } |
2525 } | 2525 } |
2526 | 2526 |
2527 | 2527 |
2528 Condition LCodeGen::EmitIsObject(Register input, Register temp1, | |
2529 Label* is_not_object, Label* is_object) { | |
2530 Register temp2 = scratch0(); | |
2531 __ JumpIfSmi(input, is_not_object); | |
2532 | |
2533 __ LoadRoot(temp2, Heap::kNullValueRootIndex); | |
2534 __ cmp(input, temp2); | |
2535 __ beq(is_object); | |
2536 | |
2537 // Load map. | |
2538 __ LoadP(temp1, FieldMemOperand(input, HeapObject::kMapOffset)); | |
2539 // Undetectable objects behave like undefined. | |
2540 __ lbz(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset)); | |
2541 __ TestBit(temp2, Map::kIsUndetectable, r0); | |
2542 __ bne(is_not_object, cr0); | |
2543 | |
2544 // Load instance type and check that it is in object type range. | |
2545 __ lbz(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset)); | |
2546 __ cmpi(temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
2547 __ blt(is_not_object); | |
2548 __ cmpi(temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
2549 return le; | |
2550 } | |
2551 | |
2552 | |
2553 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { | |
2554 Register reg = ToRegister(instr->value()); | |
2555 Register temp1 = ToRegister(instr->temp()); | |
2556 | |
2557 Condition true_cond = EmitIsObject(reg, temp1, instr->FalseLabel(chunk_), | |
2558 instr->TrueLabel(chunk_)); | |
2559 | |
2560 EmitBranch(instr, true_cond); | |
2561 } | |
2562 | |
2563 | |
2564 Condition LCodeGen::EmitIsString(Register input, Register temp1, | 2528 Condition LCodeGen::EmitIsString(Register input, Register temp1, |
2565 Label* is_not_string, | 2529 Label* is_not_string, |
2566 SmiCheck check_needed = INLINE_SMI_CHECK) { | 2530 SmiCheck check_needed = INLINE_SMI_CHECK) { |
2567 if (check_needed == INLINE_SMI_CHECK) { | 2531 if (check_needed == INLINE_SMI_CHECK) { |
2568 __ JumpIfSmi(input, is_not_string); | 2532 __ JumpIfSmi(input, is_not_string); |
2569 } | 2533 } |
2570 __ CompareObjectType(input, temp1, temp1, FIRST_NONSTRING_TYPE); | 2534 __ CompareObjectType(input, temp1, temp1, FIRST_NONSTRING_TYPE); |
2571 | 2535 |
2572 return lt; | 2536 return lt; |
2573 } | 2537 } |
(...skipping 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6324 __ Push(scope_info); | 6288 __ Push(scope_info); |
6325 __ push(ToRegister(instr->function())); | 6289 __ push(ToRegister(instr->function())); |
6326 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6290 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6327 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6291 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6328 } | 6292 } |
6329 | 6293 |
6330 | 6294 |
6331 #undef __ | 6295 #undef __ |
6332 } // namespace internal | 6296 } // namespace internal |
6333 } // namespace v8 | 6297 } // namespace v8 |
OLD | NEW |