OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2732 ASSERT(args->length() == 1); | 2732 ASSERT(args->length() == 1); |
2733 Label done, null, function, non_function_constructor; | 2733 Label done, null, function, non_function_constructor; |
2734 | 2734 |
2735 VisitForAccumulatorValue(args->at(0)); | 2735 VisitForAccumulatorValue(args->at(0)); |
2736 | 2736 |
2737 // If the object is a smi, we return null. | 2737 // If the object is a smi, we return null. |
2738 __ JumpIfSmi(r0, &null); | 2738 __ JumpIfSmi(r0, &null); |
2739 | 2739 |
2740 // Check that the object is a JS object but take special care of JS | 2740 // Check that the object is a JS object but take special care of JS |
2741 // functions to make sure they have 'Function' as their class. | 2741 // functions to make sure they have 'Function' as their class. |
| 2742 // Assume that there are only two callable types, and one of them is at |
| 2743 // either end of the type range for JS object types. Saves extra comparisons. |
| 2744 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2742 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); | 2745 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); |
2743 // Map is now in r0. | 2746 // Map is now in r0. |
2744 __ b(lt, &null); | 2747 __ b(lt, &null); |
| 2748 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2749 FIRST_SPEC_OBJECT_TYPE + 1); |
| 2750 __ b(eq, &function); |
2745 | 2751 |
2746 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and | 2752 __ cmp(r1, Operand(LAST_SPEC_OBJECT_TYPE)); |
2747 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after | 2753 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2748 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter. | 2754 LAST_SPEC_OBJECT_TYPE - 1); |
2749 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); | 2755 __ b(eq, &function); |
2750 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE == | 2756 // Assume that there is no larger type. |
2751 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1); | 2757 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); |
2752 __ cmp(r1, Operand(FIRST_CALLABLE_SPEC_OBJECT_TYPE)); | |
2753 __ b(ge, &function); | |
2754 | 2758 |
2755 // Check if the constructor in the map is a function. | 2759 // Check if the constructor in the map is a JS function. |
2756 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); | 2760 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); |
2757 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | 2761 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); |
2758 __ b(ne, &non_function_constructor); | 2762 __ b(ne, &non_function_constructor); |
2759 | 2763 |
2760 // r0 now contains the constructor function. Grab the | 2764 // r0 now contains the constructor function. Grab the |
2761 // instance class name from there. | 2765 // instance class name from there. |
2762 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 2766 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
2763 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); | 2767 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); |
2764 __ b(&done); | 2768 __ b(&done); |
2765 | 2769 |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4017 __ b(eq, if_true); | 4021 __ b(eq, if_true); |
4018 __ JumpIfSmi(r0, if_false); | 4022 __ JumpIfSmi(r0, if_false); |
4019 // Check for undetectable objects => true. | 4023 // Check for undetectable objects => true. |
4020 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); | 4024 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); |
4021 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); | 4025 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
4022 __ tst(r1, Operand(1 << Map::kIsUndetectable)); | 4026 __ tst(r1, Operand(1 << Map::kIsUndetectable)); |
4023 Split(ne, if_true, if_false, fall_through); | 4027 Split(ne, if_true, if_false, fall_through); |
4024 | 4028 |
4025 } else if (check->Equals(isolate()->heap()->function_symbol())) { | 4029 } else if (check->Equals(isolate()->heap()->function_symbol())) { |
4026 __ JumpIfSmi(r0, if_false); | 4030 __ JumpIfSmi(r0, if_false); |
4027 __ CompareObjectType(r0, r1, r0, FIRST_CALLABLE_SPEC_OBJECT_TYPE); | 4031 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
4028 Split(ge, if_true, if_false, fall_through); | 4032 __ CompareObjectType(r0, r0, r1, JS_FUNCTION_TYPE); |
4029 | 4033 __ b(eq, if_true); |
| 4034 __ cmp(r1, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 4035 Split(eq, if_true, if_false, fall_through); |
4030 } else if (check->Equals(isolate()->heap()->object_symbol())) { | 4036 } else if (check->Equals(isolate()->heap()->object_symbol())) { |
4031 __ JumpIfSmi(r0, if_false); | 4037 __ JumpIfSmi(r0, if_false); |
4032 if (!FLAG_harmony_typeof) { | 4038 if (!FLAG_harmony_typeof) { |
4033 __ CompareRoot(r0, Heap::kNullValueRootIndex); | 4039 __ CompareRoot(r0, Heap::kNullValueRootIndex); |
4034 __ b(eq, if_true); | 4040 __ b(eq, if_true); |
4035 } | 4041 } |
4036 // Check for JS objects => true. | 4042 // Check for JS objects => true. |
4037 __ CompareObjectType(r0, r0, r1, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | 4043 __ CompareObjectType(r0, r0, r1, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); |
4038 __ b(lt, if_false); | 4044 __ b(lt, if_false); |
4039 __ CompareInstanceType(r0, r1, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 4045 __ CompareInstanceType(r0, r1, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4273 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4279 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4274 __ add(pc, r1, Operand(masm_->CodeObject())); | 4280 __ add(pc, r1, Operand(masm_->CodeObject())); |
4275 } | 4281 } |
4276 | 4282 |
4277 | 4283 |
4278 #undef __ | 4284 #undef __ |
4279 | 4285 |
4280 } } // namespace v8::internal | 4286 } } // namespace v8::internal |
4281 | 4287 |
4282 #endif // V8_TARGET_ARCH_ARM | 4288 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |