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 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3309 } | 3309 } |
3310 | 3310 |
3311 | 3311 |
3312 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { | 3312 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
3313 ZoneList<Expression*>* args = expr->arguments(); | 3313 ZoneList<Expression*>* args = expr->arguments(); |
3314 DCHECK(args->length() == 1); | 3314 DCHECK(args->length() == 1); |
3315 Label done, null, function, non_function_constructor; | 3315 Label done, null, function, non_function_constructor; |
3316 | 3316 |
3317 VisitForAccumulatorValue(args->at(0)); | 3317 VisitForAccumulatorValue(args->at(0)); |
3318 | 3318 |
3319 // If the object is a smi, we return null. | 3319 // If the object is not a JSReceiver, we return null. |
3320 __ JumpIfSmi(v0, &null); | 3320 __ JumpIfSmi(v0, &null); |
3321 | 3321 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
3322 // Check that the object is a JS object but take special care of JS | |
3323 // functions to make sure they have 'Function' as their class. | |
3324 // Assume that there are only two callable types, and one of them is at | |
3325 // either end of the type range for JS object types. Saves extra comparisons. | |
3326 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
3327 __ GetObjectType(v0, v0, a1); // Map is now in v0. | 3322 __ GetObjectType(v0, v0, a1); // Map is now in v0. |
3328 __ Branch(&null, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); | 3323 __ Branch(&null, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); |
3329 | 3324 |
3330 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3325 // Return 'Function' for JSFunction objects. |
3331 LAST_JS_RECEIVER_TYPE - 1); | 3326 __ Branch(&function, eq, a1, Operand(JS_FUNCTION_TYPE)); |
3332 __ Branch(&function, eq, a1, Operand(LAST_JS_RECEIVER_TYPE)); | |
3333 // Assume that there is no larger type. | |
3334 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | |
3335 | 3327 |
3336 // Check if the constructor in the map is a JS function. | 3328 // Check if the constructor in the map is a JS function. |
3337 Register instance_type = a2; | 3329 Register instance_type = a2; |
3338 __ GetMapConstructor(v0, v0, a1, instance_type); | 3330 __ GetMapConstructor(v0, v0, a1, instance_type); |
3339 __ Branch(&non_function_constructor, ne, instance_type, | 3331 __ Branch(&non_function_constructor, ne, instance_type, |
3340 Operand(JS_FUNCTION_TYPE)); | 3332 Operand(JS_FUNCTION_TYPE)); |
3341 | 3333 |
3342 // v0 now contains the constructor function. Grab the | 3334 // v0 now contains the constructor function. Grab the |
3343 // instance class name from there. | 3335 // instance class name from there. |
3344 __ lw(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); | 3336 __ lw(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4854 reinterpret_cast<uint32_t>( | 4846 reinterpret_cast<uint32_t>( |
4855 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4847 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4856 return OSR_AFTER_STACK_CHECK; | 4848 return OSR_AFTER_STACK_CHECK; |
4857 } | 4849 } |
4858 | 4850 |
4859 | 4851 |
4860 } // namespace internal | 4852 } // namespace internal |
4861 } // namespace v8 | 4853 } // namespace v8 |
4862 | 4854 |
4863 #endif // V8_TARGET_ARCH_MIPS | 4855 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |