| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3669 // Arguments adaptor case: Read the arguments length from the | 3669 // Arguments adaptor case: Read the arguments length from the |
| 3670 // adaptor frame. | 3670 // adaptor frame. |
| 3671 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset), eq); | 3671 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset), eq); |
| 3672 | 3672 |
| 3673 context()->Plug(r0); | 3673 context()->Plug(r0); |
| 3674 } | 3674 } |
| 3675 | 3675 |
| 3676 | 3676 |
| 3677 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { | 3677 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
| 3678 ZoneList<Expression*>* args = expr->arguments(); | 3678 ZoneList<Expression*>* args = expr->arguments(); |
| 3679 DCHECK(args->length() == 1); | 3679 DCHECK_EQ(1, args->length()); |
| 3680 Label done, null, function, non_function_constructor; | 3680 Label done, null, function, non_function_constructor; |
| 3681 | 3681 |
| 3682 VisitForAccumulatorValue(args->at(0)); | 3682 VisitForAccumulatorValue(args->at(0)); |
| 3683 | 3683 |
| 3684 // If the object is a smi, we return null. | 3684 // If the object is a smi, we return null. |
| 3685 __ JumpIfSmi(r0, &null); | 3685 __ JumpIfSmi(r0, &null); |
| 3686 | 3686 |
| 3687 // Check that the object is a JS object but take special care of JS | 3687 // If the object is not a receiver, we return null. |
| 3688 // functions to make sure they have 'Function' as their class. | 3688 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 3689 // Assume that there are only two callable types, and one of them is at | 3689 __ CompareObjectType(r0, r0, r1, FIRST_JS_RECEIVER_TYPE); |
| 3690 // either end of the type range for JS object types. Saves extra comparisons. | |
| 3691 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
| 3692 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); | |
| 3693 // Map is now in r0. | |
| 3694 __ b(lt, &null); | 3690 __ b(lt, &null); |
| 3695 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
| 3696 FIRST_SPEC_OBJECT_TYPE + 1); | |
| 3697 __ b(eq, &function); | |
| 3698 | 3691 |
| 3699 __ cmp(r1, Operand(LAST_SPEC_OBJECT_TYPE)); | 3692 // According to ES5 section 15 Standard Built-in ECMAScript Objects, the |
| 3700 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3693 // [[Class]] of builtin objects is "Function" if a [[Call]] internal |
| 3701 LAST_SPEC_OBJECT_TYPE - 1); | 3694 // method is present. |
| 3702 __ b(eq, &function); | 3695 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
| 3703 // Assume that there is no larger type. | 3696 __ tst(r1, Operand(1 << Map::kIsCallable)); |
| 3704 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | 3697 __ b(ne, &function); |
| 3705 | 3698 |
| 3706 // Check if the constructor in the map is a JS function. | 3699 // Check if the constructor in the map is a JS function. |
| 3707 Register instance_type = r2; | 3700 Register instance_type = r2; |
| 3708 __ GetMapConstructor(r0, r0, r1, instance_type); | 3701 __ GetMapConstructor(r0, r0, r1, instance_type); |
| 3709 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); | 3702 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); |
| 3710 __ b(ne, &non_function_constructor); | 3703 __ b(ne, &non_function_constructor); |
| 3711 | 3704 |
| 3712 // r0 now contains the constructor function. Grab the | 3705 // r0 now contains the constructor function. Grab the |
| 3713 // instance class name from there. | 3706 // instance class name from there. |
| 3714 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 3707 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5351 DCHECK(interrupt_address == | 5344 DCHECK(interrupt_address == |
| 5352 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5345 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5353 return OSR_AFTER_STACK_CHECK; | 5346 return OSR_AFTER_STACK_CHECK; |
| 5354 } | 5347 } |
| 5355 | 5348 |
| 5356 | 5349 |
| 5357 } // namespace internal | 5350 } // namespace internal |
| 5358 } // namespace v8 | 5351 } // namespace v8 |
| 5359 | 5352 |
| 5360 #endif // V8_TARGET_ARCH_ARM | 5353 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |