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 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(v0, &null); | 3326 __ JumpIfSmi(v0, &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 __ GetObjectType(v0, v0, a1); // Map is now in v0. | 3328 __ GetObjectType(v0, v0, a1); // Map is now in v0. |
3334 __ Branch(&null, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); | 3329 __ Branch(&null, lt, a1, Operand(FIRST_JS_RECEIVER_TYPE)); |
3335 | 3330 |
3336 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3331 // Return 'Function' for JSFunction objects. |
3337 LAST_JS_RECEIVER_TYPE - 1); | 3332 __ Branch(&function, eq, a1, Operand(JS_FUNCTION_TYPE)); |
3338 __ Branch(&function, eq, a1, Operand(LAST_JS_RECEIVER_TYPE)); | |
3339 // Assume that there is no larger type. | |
3340 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | |
3341 | 3333 |
3342 // Check if the constructor in the map is a JS function. | 3334 // Check if the constructor in the map is a JS function. |
3343 Register instance_type = a2; | 3335 Register instance_type = a2; |
3344 __ GetMapConstructor(v0, v0, a1, instance_type); | 3336 __ GetMapConstructor(v0, v0, a1, instance_type); |
3345 __ Branch(&non_function_constructor, ne, instance_type, | 3337 __ Branch(&non_function_constructor, ne, instance_type, |
3346 Operand(JS_FUNCTION_TYPE)); | 3338 Operand(JS_FUNCTION_TYPE)); |
3347 | 3339 |
3348 // v0 now contains the constructor function. Grab the | 3340 // v0 now contains the constructor function. Grab the |
3349 // instance class name from there. | 3341 // instance class name from there. |
3350 __ ld(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); | 3342 __ ld(v0, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4868 reinterpret_cast<uint64_t>( | 4860 reinterpret_cast<uint64_t>( |
4869 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4861 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4870 return OSR_AFTER_STACK_CHECK; | 4862 return OSR_AFTER_STACK_CHECK; |
4871 } | 4863 } |
4872 | 4864 |
4873 | 4865 |
4874 } // namespace internal | 4866 } // namespace internal |
4875 } // namespace v8 | 4867 } // namespace v8 |
4876 | 4868 |
4877 #endif // V8_TARGET_ARCH_MIPS64 | 4869 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |