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/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" | 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2531 Handle<String>class_name, | 2531 Handle<String>class_name, |
2532 Register input, | 2532 Register input, |
2533 Register temp, | 2533 Register temp, |
2534 Register temp2) { | 2534 Register temp2) { |
2535 DCHECK(!input.is(temp)); | 2535 DCHECK(!input.is(temp)); |
2536 DCHECK(!input.is(temp2)); | 2536 DCHECK(!input.is(temp2)); |
2537 DCHECK(!temp.is(temp2)); | 2537 DCHECK(!temp.is(temp2)); |
2538 | 2538 |
2539 __ JumpIfSmi(input, is_false); | 2539 __ JumpIfSmi(input, is_false); |
2540 | 2540 |
| 2541 __ CompareObjectType(input, temp, temp2, JS_FUNCTION_TYPE); |
2541 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2542 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2542 // Assuming the following assertions, we can use the same compares to test | |
2543 // for both being a function type and being in the object type range. | |
2544 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
2545 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2546 LAST_JS_RECEIVER_TYPE - 1); | |
2547 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | |
2548 __ CompareObjectType(input, temp, temp2, FIRST_JS_RECEIVER_TYPE); | |
2549 __ b(lt, is_false); | |
2550 __ cmp(temp2, Operand(LAST_JS_RECEIVER_TYPE)); | |
2551 __ b(eq, is_true); | 2543 __ b(eq, is_true); |
2552 } else { | 2544 } else { |
2553 // Faster code path to avoid two compares: subtract lower bound from the | 2545 __ b(eq, is_false); |
2554 // actual type and do a signed compare with the width of the type range. | |
2555 __ ldr(temp, FieldMemOperand(input, HeapObject::kMapOffset)); | |
2556 __ ldrb(temp2, FieldMemOperand(temp, Map::kInstanceTypeOffset)); | |
2557 __ sub(temp2, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); | |
2558 __ cmp(temp2, | |
2559 Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - FIRST_JS_RECEIVER_TYPE)); | |
2560 __ b(gt, is_false); | |
2561 } | 2546 } |
2562 | 2547 |
2563 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | |
2564 // Check if the constructor in the map is a function. | 2548 // Check if the constructor in the map is a function. |
2565 Register instance_type = ip; | 2549 Register instance_type = ip; |
2566 __ GetMapConstructor(temp, temp, temp2, instance_type); | 2550 __ GetMapConstructor(temp, temp, temp2, instance_type); |
2567 | 2551 |
2568 // Objects with a non-function constructor have class 'Object'. | 2552 // Objects with a non-function constructor have class 'Object'. |
2569 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); | 2553 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); |
2570 if (class_name->IsOneByteEqualTo(STATIC_CHAR_VECTOR("Object"))) { | 2554 if (String::Equals(isolate()->factory()->Object_string(), class_name)) { |
2571 __ b(ne, is_true); | 2555 __ b(ne, is_true); |
2572 } else { | 2556 } else { |
2573 __ b(ne, is_false); | 2557 __ b(ne, is_false); |
2574 } | 2558 } |
2575 | 2559 |
2576 // temp now contains the constructor function. Grab the | 2560 // temp now contains the constructor function. Grab the |
2577 // instance class name from there. | 2561 // instance class name from there. |
2578 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2562 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
2579 __ ldr(temp, FieldMemOperand(temp, | 2563 __ ldr(temp, FieldMemOperand(temp, |
2580 SharedFunctionInfo::kInstanceClassNameOffset)); | 2564 SharedFunctionInfo::kInstanceClassNameOffset)); |
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5648 __ push(ToRegister(instr->function())); | 5632 __ push(ToRegister(instr->function())); |
5649 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5633 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5650 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5634 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5651 } | 5635 } |
5652 | 5636 |
5653 | 5637 |
5654 #undef __ | 5638 #undef __ |
5655 | 5639 |
5656 } // namespace internal | 5640 } // namespace internal |
5657 } // namespace v8 | 5641 } // namespace v8 |
OLD | NEW |