| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2591 Handle<String>class_name, | 2591 Handle<String>class_name, |
| 2592 Register input, | 2592 Register input, |
| 2593 Register temp, | 2593 Register temp, |
| 2594 Register temp2) { | 2594 Register temp2) { |
| 2595 DCHECK(!input.is(temp)); | 2595 DCHECK(!input.is(temp)); |
| 2596 DCHECK(!input.is(temp2)); | 2596 DCHECK(!input.is(temp2)); |
| 2597 DCHECK(!temp.is(temp2)); | 2597 DCHECK(!temp.is(temp2)); |
| 2598 | 2598 |
| 2599 __ JumpIfSmi(input, is_false); | 2599 __ JumpIfSmi(input, is_false); |
| 2600 | 2600 |
| 2601 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) { | 2601 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
| 2602 // Assuming the following assertions, we can use the same compares to test | 2602 // Assuming the following assertions, we can use the same compares to test |
| 2603 // for both being a function type and being in the object type range. | 2603 // for both being a function type and being in the object type range. |
| 2604 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2604 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 2605 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2605 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2606 FIRST_SPEC_OBJECT_TYPE + 1); | 2606 FIRST_SPEC_OBJECT_TYPE + 1); |
| 2607 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2607 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2608 LAST_SPEC_OBJECT_TYPE - 1); | 2608 LAST_SPEC_OBJECT_TYPE - 1); |
| 2609 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2609 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 2610 | 2610 |
| 2611 __ GetObjectType(input, temp, temp2); | 2611 __ GetObjectType(input, temp, temp2); |
| 2612 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2612 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 2613 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2613 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 2614 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); | 2614 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); |
| 2615 } else { | 2615 } else { |
| 2616 // Faster code path to avoid two compares: subtract lower bound from the | 2616 // Faster code path to avoid two compares: subtract lower bound from the |
| 2617 // actual type and do a signed compare with the width of the type range. | 2617 // actual type and do a signed compare with the width of the type range. |
| 2618 __ GetObjectType(input, temp, temp2); | 2618 __ GetObjectType(input, temp, temp2); |
| 2619 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2619 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2620 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2620 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
| 2621 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2621 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2622 } | 2622 } |
| 2623 | 2623 |
| 2624 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2624 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
| 2625 // Check if the constructor in the map is a function. | 2625 // Check if the constructor in the map is a function. |
| 2626 __ lw(temp, FieldMemOperand(temp, Map::kConstructorOffset)); | 2626 __ lw(temp, FieldMemOperand(temp, Map::kConstructorOffset)); |
| 2627 | 2627 |
| 2628 // Objects with a non-function constructor have class 'Object'. | 2628 // Objects with a non-function constructor have class 'Object'. |
| 2629 __ GetObjectType(temp, temp2, temp2); | 2629 __ GetObjectType(temp, temp2, temp2); |
| 2630 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) { | 2630 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
| 2631 __ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2631 __ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE)); |
| 2632 } else { | 2632 } else { |
| 2633 __ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2633 __ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE)); |
| 2634 } | 2634 } |
| 2635 | 2635 |
| 2636 // temp now contains the constructor function. Grab the | 2636 // temp now contains the constructor function. Grab the |
| 2637 // instance class name from there. | 2637 // instance class name from there. |
| 2638 __ lw(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2638 __ lw(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
| 2639 __ lw(temp, FieldMemOperand(temp, | 2639 __ lw(temp, FieldMemOperand(temp, |
| 2640 SharedFunctionInfo::kInstanceClassNameOffset)); | 2640 SharedFunctionInfo::kInstanceClassNameOffset)); |
| (...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5901 __ li(at, scope_info); | 5901 __ li(at, scope_info); |
| 5902 __ Push(at, ToRegister(instr->function())); | 5902 __ Push(at, ToRegister(instr->function())); |
| 5903 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5903 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5904 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5904 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5905 } | 5905 } |
| 5906 | 5906 |
| 5907 | 5907 |
| 5908 #undef __ | 5908 #undef __ |
| 5909 | 5909 |
| 5910 } } // namespace v8::internal | 5910 } } // namespace v8::internal |
| OLD | NEW |