| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2664 Label* is_false, | 2664 Label* is_false, |
| 2665 Handle<String>class_name, | 2665 Handle<String>class_name, |
| 2666 Register input, | 2666 Register input, |
| 2667 Register temp, | 2667 Register temp, |
| 2668 Register temp2) { | 2668 Register temp2) { |
| 2669 DCHECK(!input.is(temp)); | 2669 DCHECK(!input.is(temp)); |
| 2670 DCHECK(!input.is(temp2)); | 2670 DCHECK(!input.is(temp2)); |
| 2671 DCHECK(!temp.is(temp2)); | 2671 DCHECK(!temp.is(temp2)); |
| 2672 __ JumpIfSmi(input, is_false); | 2672 __ JumpIfSmi(input, is_false); |
| 2673 | 2673 |
| 2674 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) { | 2674 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
| 2675 // Assuming the following assertions, we can use the same compares to test | 2675 // Assuming the following assertions, we can use the same compares to test |
| 2676 // for both being a function type and being in the object type range. | 2676 // for both being a function type and being in the object type range. |
| 2677 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2677 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 2678 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2678 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2679 FIRST_SPEC_OBJECT_TYPE + 1); | 2679 FIRST_SPEC_OBJECT_TYPE + 1); |
| 2680 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2680 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2681 LAST_SPEC_OBJECT_TYPE - 1); | 2681 LAST_SPEC_OBJECT_TYPE - 1); |
| 2682 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2682 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 2683 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); | 2683 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); |
| 2684 __ j(below, is_false); | 2684 __ j(below, is_false); |
| 2685 __ j(equal, is_true); | 2685 __ j(equal, is_true); |
| 2686 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); | 2686 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); |
| 2687 __ j(equal, is_true); | 2687 __ j(equal, is_true); |
| 2688 } else { | 2688 } else { |
| 2689 // Faster code path to avoid two compares: subtract lower bound from the | 2689 // Faster code path to avoid two compares: subtract lower bound from the |
| 2690 // actual type and do a signed compare with the width of the type range. | 2690 // actual type and do a signed compare with the width of the type range. |
| 2691 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 2691 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
| 2692 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); | 2692 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); |
| 2693 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2693 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2694 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2694 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
| 2695 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2695 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2696 __ j(above, is_false); | 2696 __ j(above, is_false); |
| 2697 } | 2697 } |
| 2698 | 2698 |
| 2699 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2699 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
| 2700 // Check if the constructor in the map is a function. | 2700 // Check if the constructor in the map is a function. |
| 2701 __ mov(temp, FieldOperand(temp, Map::kConstructorOffset)); | 2701 __ mov(temp, FieldOperand(temp, Map::kConstructorOffset)); |
| 2702 // Objects with a non-function constructor have class 'Object'. | 2702 // Objects with a non-function constructor have class 'Object'. |
| 2703 __ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2); | 2703 __ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2); |
| 2704 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) { | 2704 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
| 2705 __ j(not_equal, is_true); | 2705 __ j(not_equal, is_true); |
| 2706 } else { | 2706 } else { |
| 2707 __ j(not_equal, is_false); | 2707 __ j(not_equal, is_false); |
| 2708 } | 2708 } |
| 2709 | 2709 |
| 2710 // temp now contains the constructor function. Grab the | 2710 // temp now contains the constructor function. Grab the |
| 2711 // instance class name from there. | 2711 // instance class name from there. |
| 2712 __ mov(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2712 __ mov(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
| 2713 __ mov(temp, FieldOperand(temp, | 2713 __ mov(temp, FieldOperand(temp, |
| 2714 SharedFunctionInfo::kInstanceClassNameOffset)); | 2714 SharedFunctionInfo::kInstanceClassNameOffset)); |
| (...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5708 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5708 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5709 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5709 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5710 } | 5710 } |
| 5711 | 5711 |
| 5712 | 5712 |
| 5713 #undef __ | 5713 #undef __ |
| 5714 | 5714 |
| 5715 } } // namespace v8::internal | 5715 } } // namespace v8::internal |
| 5716 | 5716 |
| 5717 #endif // V8_TARGET_ARCH_X87 | 5717 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |