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/crankshaft/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.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/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
(...skipping 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2563 Handle<String>class_name, | 2563 Handle<String>class_name, |
2564 Register input, | 2564 Register input, |
2565 Register temp, | 2565 Register temp, |
2566 Register temp2) { | 2566 Register temp2) { |
2567 DCHECK(!input.is(temp)); | 2567 DCHECK(!input.is(temp)); |
2568 DCHECK(!input.is(temp2)); | 2568 DCHECK(!input.is(temp2)); |
2569 DCHECK(!temp.is(temp2)); | 2569 DCHECK(!temp.is(temp2)); |
2570 | 2570 |
2571 __ JumpIfSmi(input, is_false); | 2571 __ JumpIfSmi(input, is_false); |
2572 | 2572 |
| 2573 __ GetObjectType(input, temp, temp2); |
2573 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2574 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2574 // Assuming the following assertions, we can use the same compares to test | 2575 __ Branch(is_true, eq, temp2, Operand(JS_FUNCTION_TYPE)); |
2575 // for both being a function type and being in the object type range. | |
2576 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
2577 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2578 LAST_JS_RECEIVER_TYPE - 1); | |
2579 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | |
2580 | |
2581 __ GetObjectType(input, temp, temp2); | |
2582 __ Branch(is_false, lt, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); | |
2583 __ Branch(is_true, eq, temp2, Operand(LAST_JS_RECEIVER_TYPE)); | |
2584 } else { | 2576 } else { |
2585 // Faster code path to avoid two compares: subtract lower bound from the | 2577 __ Branch(is_false, eq, temp2, Operand(JS_FUNCTION_TYPE)); |
2586 // actual type and do a signed compare with the width of the type range. | |
2587 __ GetObjectType(input, temp, temp2); | |
2588 __ Dsubu(temp2, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); | |
2589 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | |
2590 FIRST_JS_RECEIVER_TYPE)); | |
2591 } | 2578 } |
2592 | 2579 |
2593 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2580 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
2594 // Check if the constructor in the map is a function. | 2581 // Check if the constructor in the map is a function. |
2595 Register instance_type = scratch1(); | 2582 Register instance_type = scratch1(); |
2596 DCHECK(!instance_type.is(temp)); | 2583 DCHECK(!instance_type.is(temp)); |
2597 __ GetMapConstructor(temp, temp, temp2, instance_type); | 2584 __ GetMapConstructor(temp, temp, temp2, instance_type); |
2598 | 2585 |
2599 // Objects with a non-function constructor have class 'Object'. | 2586 // Objects with a non-function constructor have class 'Object'. |
2600 if (String::Equals(class_name, isolate()->factory()->Object_string())) { | 2587 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
(...skipping 3278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5879 __ Push(at, ToRegister(instr->function())); | 5866 __ Push(at, ToRegister(instr->function())); |
5880 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5867 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5881 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5868 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5882 } | 5869 } |
5883 | 5870 |
5884 | 5871 |
5885 #undef __ | 5872 #undef __ |
5886 | 5873 |
5887 } // namespace internal | 5874 } // namespace internal |
5888 } // namespace v8 | 5875 } // namespace v8 |
OLD | NEW |