| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2495 DCHECK(!input.is(temp)); | 2495 DCHECK(!input.is(temp)); |
| 2496 DCHECK(!input.is(temp2)); | 2496 DCHECK(!input.is(temp2)); |
| 2497 DCHECK(!temp.is(temp2)); | 2497 DCHECK(!temp.is(temp2)); |
| 2498 | 2498 |
| 2499 __ JumpIfSmi(input, is_false); | 2499 __ JumpIfSmi(input, is_false); |
| 2500 | 2500 |
| 2501 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2501 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
| 2502 // Assuming the following assertions, we can use the same compares to test | 2502 // Assuming the following assertions, we can use the same compares to test |
| 2503 // for both being a function type and being in the object type range. | 2503 // for both being a function type and being in the object type range. |
| 2504 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2504 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 2505 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
| 2506 FIRST_JS_RECEIVER_TYPE + 1); | |
| 2507 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2505 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2508 LAST_JS_RECEIVER_TYPE - 1); | 2506 LAST_JS_RECEIVER_TYPE - 1); |
| 2509 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 2507 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 2510 __ CmpObjectType(input, FIRST_JS_RECEIVER_TYPE, temp); | 2508 __ CmpObjectType(input, FIRST_JS_RECEIVER_TYPE, temp); |
| 2511 __ j(below, is_false); | 2509 __ j(below, is_false); |
| 2512 __ j(equal, is_true); | |
| 2513 __ CmpInstanceType(temp, LAST_JS_RECEIVER_TYPE); | 2510 __ CmpInstanceType(temp, LAST_JS_RECEIVER_TYPE); |
| 2514 __ j(equal, is_true); | 2511 __ j(equal, is_true); |
| 2515 } else { | 2512 } else { |
| 2516 // Faster code path to avoid two compares: subtract lower bound from the | 2513 // Faster code path to avoid two compares: subtract lower bound from the |
| 2517 // actual type and do a signed compare with the width of the type range. | 2514 // actual type and do a signed compare with the width of the type range. |
| 2518 __ movp(temp, FieldOperand(input, HeapObject::kMapOffset)); | 2515 __ movp(temp, FieldOperand(input, HeapObject::kMapOffset)); |
| 2519 __ movzxbl(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); | 2516 __ movzxbl(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); |
| 2520 __ subp(temp2, Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2517 __ subp(temp2, Immediate(FIRST_JS_RECEIVER_TYPE)); |
| 2521 __ cmpp(temp2, Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2518 __ cmpp(temp2, Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
| 2522 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2519 FIRST_JS_RECEIVER_TYPE)); |
| 2523 __ j(above, is_false); | 2520 __ j(above, is_false); |
| 2524 } | 2521 } |
| 2525 | 2522 |
| 2526 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2523 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
| 2527 // Check if the constructor in the map is a function. | 2524 // Check if the constructor in the map is a function. |
| 2528 __ GetMapConstructor(temp, temp, kScratchRegister); | 2525 __ GetMapConstructor(temp, temp, kScratchRegister); |
| 2529 | 2526 |
| 2530 // Objects with a non-function constructor have class 'Object'. | 2527 // Objects with a non-function constructor have class 'Object'. |
| 2531 __ CmpInstanceType(kScratchRegister, JS_FUNCTION_TYPE); | 2528 __ CmpInstanceType(kScratchRegister, JS_FUNCTION_TYPE); |
| 2532 if (String::Equals(class_name, isolate()->factory()->Object_string())) { | 2529 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
| (...skipping 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5710 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5707 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5711 } | 5708 } |
| 5712 | 5709 |
| 5713 | 5710 |
| 5714 #undef __ | 5711 #undef __ |
| 5715 | 5712 |
| 5716 } // namespace internal | 5713 } // namespace internal |
| 5717 } // namespace v8 | 5714 } // namespace v8 |
| 5718 | 5715 |
| 5719 #endif // V8_TARGET_ARCH_X64 | 5716 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |