| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3669 // adaptor frame. | 3669 // adaptor frame. |
| 3670 __ lw(v0, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 3670 __ lw(v0, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 3671 | 3671 |
| 3672 __ bind(&exit); | 3672 __ bind(&exit); |
| 3673 context()->Plug(v0); | 3673 context()->Plug(v0); |
| 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_EQ(1, args->length()); | 3679 DCHECK(args->length() == 1); |
| 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(v0, &null); | 3685 __ JumpIfSmi(v0, &null); |
| 3686 | 3686 |
| 3687 // If the object is not a receiver, we return null. | 3687 // Check that the object is a JS object but take special care of JS |
| 3688 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 3688 // functions to make sure they have 'Function' as their class. |
| 3689 // Assume that there are only two callable types, and one of them is at |
| 3690 // either end of the type range for JS object types. Saves extra comparisons. |
| 3691 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 3689 __ GetObjectType(v0, v0, a1); // Map is now in v0. | 3692 __ GetObjectType(v0, v0, a1); // Map is now in v0. |
| 3690 __ Branch(&null, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); | 3693 __ Branch(&null, lt, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 3691 | 3694 |
| 3692 // According to ES5 section 15 Standard Built-in ECMAScript Objects, the | 3695 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 3693 // [[Class]] of builtin objects is "Function" if a [[Call]] internal | 3696 FIRST_SPEC_OBJECT_TYPE + 1); |
| 3694 // method is present. | 3697 __ Branch(&function, eq, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 3695 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); | 3698 |
| 3696 __ And(a1, a1, Operand(1 << Map::kIsCallable)); | 3699 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 3697 __ Branch(&function, ne, a1, Operand(zero_reg)); | 3700 LAST_SPEC_OBJECT_TYPE - 1); |
| 3701 __ Branch(&function, eq, a1, Operand(LAST_SPEC_OBJECT_TYPE)); |
| 3702 // Assume that there is no larger type. |
| 3703 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); |
| 3698 | 3704 |
| 3699 // Check if the constructor in the map is a JS function. | 3705 // Check if the constructor in the map is a JS function. |
| 3700 Register instance_type = a2; | 3706 Register instance_type = a2; |
| 3701 __ GetMapConstructor(v0, v0, a1, instance_type); | 3707 __ GetMapConstructor(v0, v0, a1, instance_type); |
| 3702 __ Branch(&non_function_constructor, ne, instance_type, | 3708 __ Branch(&non_function_constructor, ne, instance_type, |
| 3703 Operand(JS_FUNCTION_TYPE)); | 3709 Operand(JS_FUNCTION_TYPE)); |
| 3704 | 3710 |
| 3705 // v0 now contains the constructor function. Grab the | 3711 // v0 now contains the constructor function. Grab the |
| 3706 // instance class name from there. | 3712 // instance class name from there. |
| 3707 __ lw(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); | 3713 __ lw(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5315 reinterpret_cast<uint32_t>( | 5321 reinterpret_cast<uint32_t>( |
| 5316 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5322 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5317 return OSR_AFTER_STACK_CHECK; | 5323 return OSR_AFTER_STACK_CHECK; |
| 5318 } | 5324 } |
| 5319 | 5325 |
| 5320 | 5326 |
| 5321 } // namespace internal | 5327 } // namespace internal |
| 5322 } // namespace v8 | 5328 } // namespace v8 |
| 5323 | 5329 |
| 5324 #endif // V8_TARGET_ARCH_MIPS | 5330 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |