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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2611 // Faster code path to avoid two compares: subtract lower bound from the | 2611 // Faster code path to avoid two compares: subtract lower bound from the |
2612 // actual type and do a signed compare with the width of the type range. | 2612 // actual type and do a signed compare with the width of the type range. |
2613 __ GetObjectType(input, temp, temp2); | 2613 __ GetObjectType(input, temp, temp2); |
2614 __ Dsubu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2614 __ Dsubu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2615 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2615 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
2616 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2616 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2617 } | 2617 } |
2618 | 2618 |
2619 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2619 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
2620 // Check if the constructor in the map is a function. | 2620 // Check if the constructor in the map is a function. |
2621 __ ld(temp, FieldMemOperand(temp, Map::kConstructorOffset)); | 2621 Register instance_type = scratch1(); |
| 2622 DCHECK(!instance_type.is(temp)); |
| 2623 DCHECK(!instance_type.is(temp2)); |
| 2624 __ GetMapConstructor(temp, temp, temp2, instance_type); |
2622 | 2625 |
2623 // Objects with a non-function constructor have class 'Object'. | 2626 // Objects with a non-function constructor have class 'Object'. |
2624 __ GetObjectType(temp, temp2, temp2); | |
2625 if (String::Equals(class_name, isolate()->factory()->Object_string())) { | 2627 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
2626 __ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2628 __ Branch(is_true, ne, instance_type, Operand(JS_FUNCTION_TYPE)); |
2627 } else { | 2629 } else { |
2628 __ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2630 __ Branch(is_false, ne, instance_type, Operand(JS_FUNCTION_TYPE)); |
2629 } | 2631 } |
2630 | 2632 |
2631 // temp now contains the constructor function. Grab the | 2633 // temp now contains the constructor function. Grab the |
2632 // instance class name from there. | 2634 // instance class name from there. |
2633 __ ld(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2635 __ ld(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
2634 __ ld(temp, FieldMemOperand(temp, | 2636 __ ld(temp, FieldMemOperand(temp, |
2635 SharedFunctionInfo::kInstanceClassNameOffset)); | 2637 SharedFunctionInfo::kInstanceClassNameOffset)); |
2636 // The class name we are testing against is internalized since it's a literal. | 2638 // The class name we are testing against is internalized since it's a literal. |
2637 // The name in the constructor is internalized because of the way the context | 2639 // The name in the constructor is internalized because of the way the context |
2638 // is booted. This routine isn't expected to work for random API-created | 2640 // is booted. This routine isn't expected to work for random API-created |
(...skipping 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6051 __ li(at, scope_info); | 6053 __ li(at, scope_info); |
6052 __ Push(at, ToRegister(instr->function())); | 6054 __ Push(at, ToRegister(instr->function())); |
6053 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6055 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6054 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6056 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6055 } | 6057 } |
6056 | 6058 |
6057 | 6059 |
6058 #undef __ | 6060 #undef __ |
6059 | 6061 |
6060 } } // namespace v8::internal | 6062 } } // namespace v8::internal |
OLD | NEW |