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 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 ASSERT(args->length() == 1); | 2655 ASSERT(args->length() == 1); |
2656 Label done, null, function, non_function_constructor; | 2656 Label done, null, function, non_function_constructor; |
2657 | 2657 |
2658 VisitForAccumulatorValue(args->at(0)); | 2658 VisitForAccumulatorValue(args->at(0)); |
2659 | 2659 |
2660 // If the object is a smi, we return null. | 2660 // If the object is a smi, we return null. |
2661 __ JumpIfSmi(r0, &null); | 2661 __ JumpIfSmi(r0, &null); |
2662 | 2662 |
2663 // Check that the object is a JS object but take special care of JS | 2663 // Check that the object is a JS object but take special care of JS |
2664 // functions to make sure they have 'Function' as their class. | 2664 // functions to make sure they have 'Function' as their class. |
| 2665 // Assume that there are only two callable types, and one of them is at |
| 2666 // either end of the type range for JS object types. Saves extra comparisons. |
| 2667 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2665 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); | 2668 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); |
2666 // Map is now in r0. | 2669 // Map is now in r0. |
2667 __ b(lt, &null); | 2670 __ b(lt, &null); |
| 2671 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2672 FIRST_SPEC_OBJECT_TYPE + 1); |
| 2673 __ b(eq, &function); |
2668 | 2674 |
2669 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and | 2675 __ cmp(r1, Operand(LAST_SPEC_OBJECT_TYPE)); |
2670 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after | 2676 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2671 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter. | 2677 LAST_SPEC_OBJECT_TYPE - 1); |
2672 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); | 2678 __ b(eq, &function); |
2673 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE == | 2679 // Assume that there is no larger type. |
2674 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1); | 2680 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); |
2675 __ cmp(r1, Operand(FIRST_CALLABLE_SPEC_OBJECT_TYPE)); | |
2676 __ b(ge, &function); | |
2677 | 2681 |
2678 // Check if the constructor in the map is a function. | 2682 // Check if the constructor in the map is a JS function. |
2679 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); | 2683 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); |
2680 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | 2684 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); |
2681 __ b(ne, &non_function_constructor); | 2685 __ b(ne, &non_function_constructor); |
2682 | 2686 |
2683 // r0 now contains the constructor function. Grab the | 2687 // r0 now contains the constructor function. Grab the |
2684 // instance class name from there. | 2688 // instance class name from there. |
2685 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 2689 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
2686 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); | 2690 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); |
2687 __ b(&done); | 2691 __ b(&done); |
2688 | 2692 |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3935 __ b(eq, if_true); | 3939 __ b(eq, if_true); |
3936 __ JumpIfSmi(r0, if_false); | 3940 __ JumpIfSmi(r0, if_false); |
3937 // Check for undetectable objects => true. | 3941 // Check for undetectable objects => true. |
3938 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); | 3942 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); |
3939 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); | 3943 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
3940 __ tst(r1, Operand(1 << Map::kIsUndetectable)); | 3944 __ tst(r1, Operand(1 << Map::kIsUndetectable)); |
3941 Split(ne, if_true, if_false, fall_through); | 3945 Split(ne, if_true, if_false, fall_through); |
3942 | 3946 |
3943 } else if (check->Equals(isolate()->heap()->function_symbol())) { | 3947 } else if (check->Equals(isolate()->heap()->function_symbol())) { |
3944 __ JumpIfSmi(r0, if_false); | 3948 __ JumpIfSmi(r0, if_false); |
3945 __ CompareObjectType(r0, r1, r0, FIRST_CALLABLE_SPEC_OBJECT_TYPE); | 3949 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
3946 Split(ge, if_true, if_false, fall_through); | 3950 __ CompareObjectType(r0, r0, r1, JS_FUNCTION_TYPE); |
3947 | 3951 __ b(eq, if_true); |
| 3952 __ cmp(r1, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 3953 Split(eq, if_true, if_false, fall_through); |
3948 } else if (check->Equals(isolate()->heap()->object_symbol())) { | 3954 } else if (check->Equals(isolate()->heap()->object_symbol())) { |
3949 __ JumpIfSmi(r0, if_false); | 3955 __ JumpIfSmi(r0, if_false); |
3950 if (!FLAG_harmony_typeof) { | 3956 if (!FLAG_harmony_typeof) { |
3951 __ CompareRoot(r0, Heap::kNullValueRootIndex); | 3957 __ CompareRoot(r0, Heap::kNullValueRootIndex); |
3952 __ b(eq, if_true); | 3958 __ b(eq, if_true); |
3953 } | 3959 } |
3954 // Check for JS objects => true. | 3960 // Check for JS objects => true. |
3955 __ CompareObjectType(r0, r0, r1, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | 3961 __ CompareObjectType(r0, r0, r1, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); |
3956 __ b(lt, if_false); | 3962 __ b(lt, if_false); |
3957 __ CompareInstanceType(r0, r1, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 3963 __ CompareInstanceType(r0, r1, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4219 *context_length = 0; | 4225 *context_length = 0; |
4220 return previous_; | 4226 return previous_; |
4221 } | 4227 } |
4222 | 4228 |
4223 | 4229 |
4224 #undef __ | 4230 #undef __ |
4225 | 4231 |
4226 } } // namespace v8::internal | 4232 } } // namespace v8::internal |
4227 | 4233 |
4228 #endif // V8_TARGET_ARCH_ARM | 4234 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |