| 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-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/hydrogen-osr.h" | 8 #include "src/hydrogen-osr.h" |
| 9 #include "src/mips64/lithium-codegen-mips64.h" | 9 #include "src/mips64/lithium-codegen-mips64.h" |
| 10 #include "src/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/mips64/lithium-gap-resolver-mips64.h" |
| (...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2570 Handle<String>class_name, | 2570 Handle<String>class_name, |
| 2571 Register input, | 2571 Register input, |
| 2572 Register temp, | 2572 Register temp, |
| 2573 Register temp2) { | 2573 Register temp2) { |
| 2574 DCHECK(!input.is(temp)); | 2574 DCHECK(!input.is(temp)); |
| 2575 DCHECK(!input.is(temp2)); | 2575 DCHECK(!input.is(temp2)); |
| 2576 DCHECK(!temp.is(temp2)); | 2576 DCHECK(!temp.is(temp2)); |
| 2577 | 2577 |
| 2578 __ JumpIfSmi(input, is_false); | 2578 __ JumpIfSmi(input, is_false); |
| 2579 | 2579 |
| 2580 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) { | 2580 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
| 2581 // Assuming the following assertions, we can use the same compares to test | 2581 // Assuming the following assertions, we can use the same compares to test |
| 2582 // for both being a function type and being in the object type range. | 2582 // for both being a function type and being in the object type range. |
| 2583 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2583 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 2584 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2584 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2585 FIRST_SPEC_OBJECT_TYPE + 1); | 2585 FIRST_SPEC_OBJECT_TYPE + 1); |
| 2586 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2586 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2587 LAST_SPEC_OBJECT_TYPE - 1); | 2587 LAST_SPEC_OBJECT_TYPE - 1); |
| 2588 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2588 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 2589 | 2589 |
| 2590 __ GetObjectType(input, temp, temp2); | 2590 __ GetObjectType(input, temp, temp2); |
| 2591 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2591 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 2592 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2592 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 2593 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); | 2593 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); |
| 2594 } else { | 2594 } else { |
| 2595 // Faster code path to avoid two compares: subtract lower bound from the | 2595 // Faster code path to avoid two compares: subtract lower bound from the |
| 2596 // actual type and do a signed compare with the width of the type range. | 2596 // actual type and do a signed compare with the width of the type range. |
| 2597 __ GetObjectType(input, temp, temp2); | 2597 __ GetObjectType(input, temp, temp2); |
| 2598 __ Dsubu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2598 __ Dsubu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2599 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2599 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
| 2600 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2600 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2601 } | 2601 } |
| 2602 | 2602 |
| 2603 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2603 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
| 2604 // Check if the constructor in the map is a function. | 2604 // Check if the constructor in the map is a function. |
| 2605 __ ld(temp, FieldMemOperand(temp, Map::kConstructorOffset)); | 2605 __ ld(temp, FieldMemOperand(temp, Map::kConstructorOffset)); |
| 2606 | 2606 |
| 2607 // Objects with a non-function constructor have class 'Object'. | 2607 // Objects with a non-function constructor have class 'Object'. |
| 2608 __ GetObjectType(temp, temp2, temp2); | 2608 __ GetObjectType(temp, temp2, temp2); |
| 2609 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) { | 2609 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
| 2610 __ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2610 __ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE)); |
| 2611 } else { | 2611 } else { |
| 2612 __ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE)); | 2612 __ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE)); |
| 2613 } | 2613 } |
| 2614 | 2614 |
| 2615 // temp now contains the constructor function. Grab the | 2615 // temp now contains the constructor function. Grab the |
| 2616 // instance class name from there. | 2616 // instance class name from there. |
| 2617 __ ld(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2617 __ ld(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
| 2618 __ ld(temp, FieldMemOperand(temp, | 2618 __ ld(temp, FieldMemOperand(temp, |
| 2619 SharedFunctionInfo::kInstanceClassNameOffset)); | 2619 SharedFunctionInfo::kInstanceClassNameOffset)); |
| (...skipping 3321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5941 __ li(at, scope_info); | 5941 __ li(at, scope_info); |
| 5942 __ Push(at, ToRegister(instr->function())); | 5942 __ Push(at, ToRegister(instr->function())); |
| 5943 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5943 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5944 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5944 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5945 } | 5945 } |
| 5946 | 5946 |
| 5947 | 5947 |
| 5948 #undef __ | 5948 #undef __ |
| 5949 | 5949 |
| 5950 } } // namespace v8::internal | 5950 } } // namespace v8::internal |
| OLD | NEW |