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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 } | 3315 } |
3316 | 3316 |
3317 | 3317 |
3318 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { | 3318 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
3319 ZoneList<Expression*>* args = expr->arguments(); | 3319 ZoneList<Expression*>* args = expr->arguments(); |
3320 DCHECK(args->length() == 1); | 3320 DCHECK(args->length() == 1); |
3321 Label done, null, function, non_function_constructor; | 3321 Label done, null, function, non_function_constructor; |
3322 | 3322 |
3323 VisitForAccumulatorValue(args->at(0)); | 3323 VisitForAccumulatorValue(args->at(0)); |
3324 | 3324 |
3325 // If the object is a smi, we return null. | 3325 // If the object is not a JSReceiver, we return null. |
3326 __ JumpIfSmi(r0, &null); | 3326 __ JumpIfSmi(r0, &null); |
3327 | 3327 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
3328 // Check that the object is a JS object but take special care of JS | |
3329 // functions to make sure they have 'Function' as their class. | |
3330 // Assume that there are only two callable types, and one of them is at | |
3331 // either end of the type range for JS object types. Saves extra comparisons. | |
3332 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
3333 __ CompareObjectType(r0, r0, r1, FIRST_JS_RECEIVER_TYPE); | 3328 __ CompareObjectType(r0, r0, r1, FIRST_JS_RECEIVER_TYPE); |
3334 // Map is now in r0. | 3329 // Map is now in r0. |
3335 __ b(lt, &null); | 3330 __ b(lt, &null); |
3336 | 3331 |
3337 __ cmp(r1, Operand(LAST_JS_RECEIVER_TYPE)); | 3332 // Return 'Function' for JSFunction objects. |
3338 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3333 __ cmp(r1, Operand(JS_FUNCTION_TYPE)); |
3339 LAST_JS_RECEIVER_TYPE - 1); | |
3340 __ b(eq, &function); | 3334 __ b(eq, &function); |
3341 // Assume that there is no larger type. | |
3342 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | |
3343 | 3335 |
3344 // Check if the constructor in the map is a JS function. | 3336 // Check if the constructor in the map is a JS function. |
3345 Register instance_type = r2; | 3337 Register instance_type = r2; |
3346 __ GetMapConstructor(r0, r0, r1, instance_type); | 3338 __ GetMapConstructor(r0, r0, r1, instance_type); |
3347 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); | 3339 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); |
3348 __ b(ne, &non_function_constructor); | 3340 __ b(ne, &non_function_constructor); |
3349 | 3341 |
3350 // r0 now contains the constructor function. Grab the | 3342 // r0 now contains the constructor function. Grab the |
3351 // instance class name from there. | 3343 // instance class name from there. |
3352 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 3344 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4906 DCHECK(interrupt_address == | 4898 DCHECK(interrupt_address == |
4907 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4899 isolate->builtins()->OsrAfterStackCheck()->entry()); |
4908 return OSR_AFTER_STACK_CHECK; | 4900 return OSR_AFTER_STACK_CHECK; |
4909 } | 4901 } |
4910 | 4902 |
4911 | 4903 |
4912 } // namespace internal | 4904 } // namespace internal |
4913 } // namespace v8 | 4905 } // namespace v8 |
4914 | 4906 |
4915 #endif // V8_TARGET_ARCH_ARM | 4907 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |