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/crankshaft/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" |
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/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
(...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2607 DCHECK(!input.is(temp)); | 2607 DCHECK(!input.is(temp)); |
2608 DCHECK(!input.is(temp2)); | 2608 DCHECK(!input.is(temp2)); |
2609 DCHECK(!temp.is(temp2)); | 2609 DCHECK(!temp.is(temp2)); |
2610 | 2610 |
2611 __ JumpIfSmi(input, is_false); | 2611 __ JumpIfSmi(input, is_false); |
2612 | 2612 |
2613 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2613 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2614 // Assuming the following assertions, we can use the same compares to test | 2614 // Assuming the following assertions, we can use the same compares to test |
2615 // for both being a function type and being in the object type range. | 2615 // for both being a function type and being in the object type range. |
2616 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2616 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2617 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2618 FIRST_JS_RECEIVER_TYPE + 1); | |
2619 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2617 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2620 LAST_JS_RECEIVER_TYPE - 1); | 2618 LAST_JS_RECEIVER_TYPE - 1); |
2621 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 2619 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
2622 __ CompareObjectType(input, temp, temp2, FIRST_JS_RECEIVER_TYPE); | 2620 __ CompareObjectType(input, temp, temp2, FIRST_JS_RECEIVER_TYPE); |
2623 __ blt(is_false); | 2621 __ blt(is_false); |
2624 __ beq(is_true); | |
2625 __ cmpi(temp2, Operand(LAST_JS_RECEIVER_TYPE)); | 2622 __ cmpi(temp2, Operand(LAST_JS_RECEIVER_TYPE)); |
2626 __ beq(is_true); | 2623 __ beq(is_true); |
2627 } else { | 2624 } else { |
2628 // Faster code path to avoid two compares: subtract lower bound from the | 2625 // Faster code path to avoid two compares: subtract lower bound from the |
2629 // actual type and do a signed compare with the width of the type range. | 2626 // actual type and do a signed compare with the width of the type range. |
2630 __ LoadP(temp, FieldMemOperand(input, HeapObject::kMapOffset)); | 2627 __ LoadP(temp, FieldMemOperand(input, HeapObject::kMapOffset)); |
2631 __ lbz(temp2, FieldMemOperand(temp, Map::kInstanceTypeOffset)); | 2628 __ lbz(temp2, FieldMemOperand(temp, Map::kInstanceTypeOffset)); |
2632 __ subi(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2629 __ subi(temp2, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); |
2633 __ cmpi(temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2630 __ cmpi(temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
2634 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2631 FIRST_JS_RECEIVER_TYPE)); |
2635 __ bgt(is_false); | 2632 __ bgt(is_false); |
2636 } | 2633 } |
2637 | 2634 |
2638 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2635 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
2639 // Check if the constructor in the map is a function. | 2636 // Check if the constructor in the map is a function. |
2640 Register instance_type = ip; | 2637 Register instance_type = ip; |
2641 __ GetMapConstructor(temp, temp, temp2, instance_type); | 2638 __ GetMapConstructor(temp, temp, temp2, instance_type); |
2642 | 2639 |
2643 // Objects with a non-function constructor have class 'Object'. | 2640 // Objects with a non-function constructor have class 'Object'. |
2644 __ cmpi(instance_type, Operand(JS_FUNCTION_TYPE)); | 2641 __ cmpi(instance_type, Operand(JS_FUNCTION_TYPE)); |
(...skipping 3269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5914 __ Push(scope_info); | 5911 __ Push(scope_info); |
5915 __ push(ToRegister(instr->function())); | 5912 __ push(ToRegister(instr->function())); |
5916 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5913 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5917 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5914 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5918 } | 5915 } |
5919 | 5916 |
5920 | 5917 |
5921 #undef __ | 5918 #undef __ |
5922 } // namespace internal | 5919 } // namespace internal |
5923 } // namespace v8 | 5920 } // namespace v8 |
OLD | NEW |