| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 6 | 6 |
| 7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
| 8 // | 8 // |
| 9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
| 10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
| (...skipping 3669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3680 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { | 3680 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
| 3681 ZoneList<Expression*>* args = expr->arguments(); | 3681 ZoneList<Expression*>* args = expr->arguments(); |
| 3682 DCHECK(args->length() == 1); | 3682 DCHECK(args->length() == 1); |
| 3683 Label done, null, function, non_function_constructor; | 3683 Label done, null, function, non_function_constructor; |
| 3684 | 3684 |
| 3685 VisitForAccumulatorValue(args->at(0)); | 3685 VisitForAccumulatorValue(args->at(0)); |
| 3686 | 3686 |
| 3687 // If the object is a smi, we return null. | 3687 // If the object is a smi, we return null. |
| 3688 __ JumpIfSmi(v0, &null); | 3688 __ JumpIfSmi(v0, &null); |
| 3689 | 3689 |
| 3690 // Check that the object is a JS object but take special care of JS | 3690 // If the object is not a receiver, we return null. |
| 3691 // functions to make sure they have 'Function' as their class. | 3691 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 3692 // Assume that there are only two callable types, and one of them is at | |
| 3693 // either end of the type range for JS object types. Saves extra comparisons. | |
| 3694 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
| 3695 __ GetObjectType(v0, v0, a1); // Map is now in v0. | 3692 __ GetObjectType(v0, v0, a1); // Map is now in v0. |
| 3696 __ Branch(&null, lt, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); | 3693 __ Branch(&null, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); |
| 3697 | 3694 |
| 3698 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3695 // According to ES5 section 15 Standard Built-in ECMAScript Objects, the |
| 3699 FIRST_SPEC_OBJECT_TYPE + 1); | 3696 // [[Class]] of builtin objects is "Function" if a [[Call]] internal |
| 3700 __ Branch(&function, eq, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); | 3697 // method is present. |
| 3701 | 3698 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); |
| 3702 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3699 __ And(a1, a1, Operand(1 << Map::kIsCallable)); |
| 3703 LAST_SPEC_OBJECT_TYPE - 1); | 3700 __ Branch(&function, ne, a1, Operand(zero_reg)); |
| 3704 __ Branch(&function, eq, a1, Operand(LAST_SPEC_OBJECT_TYPE)); | |
| 3705 // Assume that there is no larger type. | |
| 3706 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | |
| 3707 | 3701 |
| 3708 // Check if the constructor in the map is a JS function. | 3702 // Check if the constructor in the map is a JS function. |
| 3709 Register instance_type = a2; | 3703 Register instance_type = a2; |
| 3710 __ GetMapConstructor(v0, v0, a1, instance_type); | 3704 __ GetMapConstructor(v0, v0, a1, instance_type); |
| 3711 __ Branch(&non_function_constructor, ne, instance_type, | 3705 __ Branch(&non_function_constructor, ne, instance_type, |
| 3712 Operand(JS_FUNCTION_TYPE)); | 3706 Operand(JS_FUNCTION_TYPE)); |
| 3713 | 3707 |
| 3714 // v0 now contains the constructor function. Grab the | 3708 // v0 now contains the constructor function. Grab the |
| 3715 // instance class name from there. | 3709 // instance class name from there. |
| 3716 __ ld(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); | 3710 __ ld(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5328 reinterpret_cast<uint64_t>( | 5322 reinterpret_cast<uint64_t>( |
| 5329 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5323 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5330 return OSR_AFTER_STACK_CHECK; | 5324 return OSR_AFTER_STACK_CHECK; |
| 5331 } | 5325 } |
| 5332 | 5326 |
| 5333 | 5327 |
| 5334 } // namespace internal | 5328 } // namespace internal |
| 5335 } // namespace v8 | 5329 } // namespace v8 |
| 5336 | 5330 |
| 5337 #endif // V8_TARGET_ARCH_MIPS64 | 5331 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |