| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.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/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 3016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3027 | 3027 |
| 3028 | 3028 |
| 3029 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { | 3029 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
| 3030 ASM_LOCATION("FullCodeGenerator::EmitClassOf"); | 3030 ASM_LOCATION("FullCodeGenerator::EmitClassOf"); |
| 3031 ZoneList<Expression*>* args = expr->arguments(); | 3031 ZoneList<Expression*>* args = expr->arguments(); |
| 3032 DCHECK(args->length() == 1); | 3032 DCHECK(args->length() == 1); |
| 3033 Label done, null, function, non_function_constructor; | 3033 Label done, null, function, non_function_constructor; |
| 3034 | 3034 |
| 3035 VisitForAccumulatorValue(args->at(0)); | 3035 VisitForAccumulatorValue(args->at(0)); |
| 3036 | 3036 |
| 3037 // If the object is a smi, we return null. | 3037 // If the object is not a JSReceiver, we return null. |
| 3038 __ JumpIfSmi(x0, &null); | 3038 __ JumpIfSmi(x0, &null); |
| 3039 | 3039 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 3040 // Check that the object is a JS object but take special care of JS | |
| 3041 // functions to make sure they have 'Function' as their class. | |
| 3042 // Assume that there are only two callable types, and one of them is at | |
| 3043 // either end of the type range for JS object types. Saves extra comparisons. | |
| 3044 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
| 3045 __ CompareObjectType(x0, x10, x11, FIRST_JS_RECEIVER_TYPE); | 3040 __ CompareObjectType(x0, x10, x11, FIRST_JS_RECEIVER_TYPE); |
| 3046 // x10: object's map. | 3041 // x10: object's map. |
| 3047 // x11: object's type. | 3042 // x11: object's type. |
| 3048 __ B(lt, &null); | 3043 __ B(lt, &null); |
| 3049 | 3044 |
| 3050 __ Cmp(x11, LAST_JS_RECEIVER_TYPE); | 3045 // Return 'Function' for JSFunction objects. |
| 3051 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3046 __ Cmp(x11, JS_FUNCTION_TYPE); |
| 3052 LAST_JS_RECEIVER_TYPE - 1); | |
| 3053 __ B(eq, &function); | 3047 __ B(eq, &function); |
| 3054 // Assume that there is no larger type. | |
| 3055 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | |
| 3056 | 3048 |
| 3057 // Check if the constructor in the map is a JS function. | 3049 // Check if the constructor in the map is a JS function. |
| 3058 Register instance_type = x14; | 3050 Register instance_type = x14; |
| 3059 __ GetMapConstructor(x12, x10, x13, instance_type); | 3051 __ GetMapConstructor(x12, x10, x13, instance_type); |
| 3060 __ Cmp(instance_type, JS_FUNCTION_TYPE); | 3052 __ Cmp(instance_type, JS_FUNCTION_TYPE); |
| 3061 __ B(ne, &non_function_constructor); | 3053 __ B(ne, &non_function_constructor); |
| 3062 | 3054 |
| 3063 // x12 now contains the constructor function. Grab the | 3055 // x12 now contains the constructor function. Grab the |
| 3064 // instance class name from there. | 3056 // instance class name from there. |
| 3065 __ Ldr(x13, FieldMemOperand(x12, JSFunction::kSharedFunctionInfoOffset)); | 3057 __ Ldr(x13, FieldMemOperand(x12, JSFunction::kSharedFunctionInfoOffset)); |
| (...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4881 } | 4873 } |
| 4882 | 4874 |
| 4883 return INTERRUPT; | 4875 return INTERRUPT; |
| 4884 } | 4876 } |
| 4885 | 4877 |
| 4886 | 4878 |
| 4887 } // namespace internal | 4879 } // namespace internal |
| 4888 } // namespace v8 | 4880 } // namespace v8 |
| 4889 | 4881 |
| 4890 #endif // V8_TARGET_ARCH_ARM64 | 4882 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |