Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 1306303005: Revert of [es5] Class of object is "Function" if object has [[Call]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/arm/lithium-codegen-arm.h" 5 #include "src/arm/lithium-codegen-arm.h"
6 #include "src/arm/lithium-gap-resolver-arm.h" 6 #include "src/arm/lithium-gap-resolver-arm.h"
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/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 Handle<String>class_name, 2611 Handle<String>class_name,
2612 Register input, 2612 Register input,
2613 Register temp, 2613 Register temp,
2614 Register temp2) { 2614 Register temp2) {
2615 DCHECK(!input.is(temp)); 2615 DCHECK(!input.is(temp));
2616 DCHECK(!input.is(temp2)); 2616 DCHECK(!input.is(temp2));
2617 DCHECK(!temp.is(temp2)); 2617 DCHECK(!temp.is(temp2));
2618 2618
2619 __ JumpIfSmi(input, is_false); 2619 __ JumpIfSmi(input, is_false);
2620 2620
2621 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
2622 __ CompareObjectType(input, temp, temp2, FIRST_JS_RECEIVER_TYPE);
2623 __ b(lt, is_false);
2624
2625 // Objects with [[Call]] have class 'Function'.
2626 __ ldrb(temp2, FieldMemOperand(temp, Map::kBitFieldOffset));
2627 __ tst(temp2, Operand(1 << Map::kIsCallable));
2628 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { 2621 if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2629 __ b(ne, is_true); 2622 // Assuming the following assertions, we can use the same compares to test
2623 // for both being a function type and being in the object type range.
2624 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
2625 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2626 FIRST_SPEC_OBJECT_TYPE + 1);
2627 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2628 LAST_SPEC_OBJECT_TYPE - 1);
2629 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
2630 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE);
2631 __ b(lt, is_false);
2632 __ b(eq, is_true);
2633 __ cmp(temp2, Operand(LAST_SPEC_OBJECT_TYPE));
2634 __ b(eq, is_true);
2630 } else { 2635 } else {
2631 __ b(ne, is_false); 2636 // Faster code path to avoid two compares: subtract lower bound from the
2637 // actual type and do a signed compare with the width of the type range.
2638 __ ldr(temp, FieldMemOperand(input, HeapObject::kMapOffset));
2639 __ ldrb(temp2, FieldMemOperand(temp, Map::kInstanceTypeOffset));
2640 __ sub(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
2641 __ cmp(temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
2642 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
2643 __ b(gt, is_false);
2632 } 2644 }
2633 2645
2634 // Now we are in the FIRST-LAST_JS_RECEIVER_TYPE range. 2646 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
2635 // Check if the constructor in the map is a function. 2647 // Check if the constructor in the map is a function.
2636 Register instance_type = ip; 2648 Register instance_type = ip;
2637 __ GetMapConstructor(temp, temp, temp2, instance_type); 2649 __ GetMapConstructor(temp, temp, temp2, instance_type);
2638 2650
2639 // Objects with a non-function constructor have class 'Object'. 2651 // Objects with a non-function constructor have class 'Object'.
2640 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE)); 2652 __ cmp(instance_type, Operand(JS_FUNCTION_TYPE));
2641 if (String::Equals(isolate()->factory()->Object_string(), class_name)) { 2653 if (class_name->IsOneByteEqualTo(STATIC_CHAR_VECTOR("Object"))) {
2642 __ b(ne, is_true); 2654 __ b(ne, is_true);
2643 } else { 2655 } else {
2644 __ b(ne, is_false); 2656 __ b(ne, is_false);
2645 } 2657 }
2646 2658
2647 // temp now contains the constructor function. Grab the 2659 // temp now contains the constructor function. Grab the
2648 // instance class name from there. 2660 // instance class name from there.
2649 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); 2661 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset));
2650 __ ldr(temp, FieldMemOperand(temp, 2662 __ ldr(temp, FieldMemOperand(temp,
2651 SharedFunctionInfo::kInstanceClassNameOffset)); 2663 SharedFunctionInfo::kInstanceClassNameOffset));
(...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5863 __ push(ToRegister(instr->function())); 5875 __ push(ToRegister(instr->function()));
5864 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5876 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5865 RecordSafepoint(Safepoint::kNoLazyDeopt); 5877 RecordSafepoint(Safepoint::kNoLazyDeopt);
5866 } 5878 }
5867 5879
5868 5880
5869 #undef __ 5881 #undef __
5870 5882
5871 } // namespace internal 5883 } // namespace internal
5872 } // namespace v8 5884 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698