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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 6055006: Fix inlining of instanceof stub for ARM (r6093). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/lithium-arm.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 #ifdef DEBUG 2887 #ifdef DEBUG
2888 if (FLAG_debug_code) { 2888 if (FLAG_debug_code) {
2889 __ mov(lr, Operand(pc)); 2889 __ mov(lr, Operand(pc));
2890 } 2890 }
2891 #endif 2891 #endif
2892 __ ldm(ia_w, sp, kCalleeSaved | pc.bit()); 2892 __ ldm(ia_w, sp, kCalleeSaved | pc.bit());
2893 } 2893 }
2894 2894
2895 2895
2896 // Uses registers r0 to r4. Expected input is 2896 // Uses registers r0 to r4. Expected input is
2897 // function in r0 (or at sp+1*ptrsz) and object in 2897 // object in r0 (or at sp+1*kPointerSize) and function in
2898 // r1 (or at sp), depending on whether or not 2898 // r1 (or at sp), depending on whether or not
2899 // args_in_registers() is true. 2899 // args_in_registers() is true.
2900 void InstanceofStub::Generate(MacroAssembler* masm) { 2900 void InstanceofStub::Generate(MacroAssembler* masm) {
2901 // Fixed register usage throughout the stub: 2901 // Fixed register usage throughout the stub:
2902 const Register object = r1; // Object (lhs). 2902 const Register object = r0; // Object (lhs).
2903 const Register map = r3; // Map of the object. 2903 const Register map = r3; // Map of the object.
2904 const Register function = r0; // Function (rhs). 2904 const Register function = r1; // Function (rhs).
2905 const Register prototype = r4; // Prototype of the function. 2905 const Register prototype = r4; // Prototype of the function.
2906 const Register scratch = r2; 2906 const Register scratch = r2;
2907 Label slow, loop, is_instance, is_not_instance, not_js_object; 2907 Label slow, loop, is_instance, is_not_instance, not_js_object;
2908 if (!args_in_registers()) { 2908 if (!args_in_registers()) {
2909 __ ldr(function, MemOperand(sp, 1 * kPointerSize)); 2909 __ ldr(object, MemOperand(sp, 1 * kPointerSize));
2910 __ ldr(object, MemOperand(sp, 0)); 2910 __ ldr(function, MemOperand(sp, 0));
2911 } 2911 }
2912 2912
2913 // Check that the left hand is a JS object and load map. 2913 // Check that the left hand is a JS object and load map.
2914 __ BranchOnSmi(object, &slow); 2914 __ BranchOnSmi(object, &not_js_object);
2915 __ IsObjectJSObjectType(object, map, scratch, &slow); 2915 __ IsObjectJSObjectType(object, map, scratch, &not_js_object);
2916 2916
2917 // Look up the function and the map in the instanceof cache. 2917 // Look up the function and the map in the instanceof cache.
2918 Label miss; 2918 Label miss;
2919 __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex); 2919 __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex);
2920 __ cmp(object, ip); 2920 __ cmp(function, ip);
2921 __ b(ne, &miss); 2921 __ b(ne, &miss);
2922 __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex); 2922 __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex);
2923 __ cmp(map, ip); 2923 __ cmp(map, ip);
2924 __ b(ne, &miss); 2924 __ b(ne, &miss);
2925 __ LoadRoot(function, Heap::kInstanceofCacheAnswerRootIndex); 2925 __ LoadRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2926 __ Ret(args_in_registers() ? 0 : 2); 2926 __ Ret(args_in_registers() ? 0 : 2);
2927 2927
2928 __ bind(&miss); 2928 __ bind(&miss);
2929 __ TryGetFunctionPrototype(object, prototype, scratch, &slow); 2929 __ TryGetFunctionPrototype(function, prototype, scratch, &slow);
2930 2930
2931 // Check that the function prototype is a JS object. 2931 // Check that the function prototype is a JS object.
2932 __ BranchOnSmi(prototype, &slow); 2932 __ BranchOnSmi(prototype, &slow);
2933 __ IsObjectJSObjectType(prototype, scratch, scratch, &slow); 2933 __ IsObjectJSObjectType(prototype, scratch, scratch, &slow);
2934 2934
2935 __ StoreRoot(object, Heap::kInstanceofCacheFunctionRootIndex); 2935 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
2936 __ StoreRoot(map, Heap::kInstanceofCacheMapRootIndex); 2936 __ StoreRoot(map, Heap::kInstanceofCacheMapRootIndex);
2937 2937
2938 // Register mapping: r3 is object map and r4 is function prototype. 2938 // Register mapping: r3 is object map and r4 is function prototype.
2939 // Get prototype of object into r2. 2939 // Get prototype of object into r2.
2940 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); 2940 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset));
2941 2941
2942 // Loop through the prototype chain looking for the function prototype. 2942 // Loop through the prototype chain looking for the function prototype.
2943 __ bind(&loop); 2943 __ bind(&loop);
2944 __ cmp(scratch, Operand(prototype)); 2944 __ cmp(scratch, Operand(prototype));
2945 __ b(eq, &is_instance); 2945 __ b(eq, &is_instance);
2946 __ LoadRoot(ip, Heap::kNullValueRootIndex); 2946 __ LoadRoot(ip, Heap::kNullValueRootIndex);
2947 __ cmp(scratch, ip); 2947 __ cmp(scratch, ip);
2948 __ b(eq, &is_not_instance); 2948 __ b(eq, &is_not_instance);
2949 __ ldr(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset)); 2949 __ ldr(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset));
2950 __ ldr(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset)); 2950 __ ldr(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset));
2951 __ jmp(&loop); 2951 __ jmp(&loop);
2952 2952
2953 __ bind(&is_instance); 2953 __ bind(&is_instance);
2954 __ mov(r0, Operand(Smi::FromInt(0))); 2954 __ mov(r0, Operand(Smi::FromInt(0)));
2955 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); 2955 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2956 __ Ret(args_in_registers() ? 0 : 2); 2956 __ Ret(args_in_registers() ? 0 : 2);
2957 2957
2958 __ bind(&is_not_instance); 2958 __ bind(&is_not_instance);
2959 __ mov(r0, Operand(Smi::FromInt(1))); 2959 __ mov(r0, Operand(Smi::FromInt(1)));
2960 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2960 __ Ret(args_in_registers() ? 0 : 2); 2961 __ Ret(args_in_registers() ? 0 : 2);
2961 2962
2962 Label object_not_null, object_not_null_or_smi; 2963 Label object_not_null, object_not_null_or_smi;
2963 __ bind(&not_js_object); 2964 __ bind(&not_js_object);
2964 // Before null, smi and string value checks, check that the rhs is a function 2965 // Before null, smi and string value checks, check that the rhs is a function
2965 // as for a non-function rhs an exception needs to be thrown. 2966 // as for a non-function rhs an exception needs to be thrown.
2966 __ BranchOnSmi(function, &slow); 2967 __ BranchOnSmi(function, &slow);
2967 __ CompareObjectType(function, map, scratch, JS_FUNCTION_TYPE); 2968 __ CompareObjectType(function, map, scratch, JS_FUNCTION_TYPE);
2968 __ b(ne, &slow); 2969 __ b(ne, &slow);
2969 2970
2970 // Null is not instance of anything. 2971 // Null is not instance of anything.
2971 __ cmp(scratch, Operand(Factory::null_value())); 2972 __ cmp(scratch, Operand(Factory::null_value()));
2972 __ b(ne, &object_not_null); 2973 __ b(ne, &object_not_null);
2973 __ mov(r0, Operand(Smi::FromInt(1))); 2974 __ mov(r0, Operand(Smi::FromInt(1)));
2974 __ Ret(args_in_registers() ? 0 : 2); 2975 __ Ret(args_in_registers() ? 0 : 2);
2975 2976
2976 __ bind(&object_not_null); 2977 __ bind(&object_not_null);
2977 // Smi values are not instances of anything. 2978 // Smi values are not instances of anything.
2978 __ BranchOnNotSmi(object, &object_not_null_or_smi); 2979 __ BranchOnNotSmi(object, &object_not_null_or_smi);
2979 __ mov(r0, Operand(Smi::FromInt(1))); 2980 __ mov(r0, Operand(Smi::FromInt(1)));
2980 __ Ret(args_in_registers() ? 0 : 2); 2981 __ Ret(args_in_registers() ? 0 : 2);
2981 2982
2982 __ bind(&object_not_null_or_smi); 2983 __ bind(&object_not_null_or_smi);
2983 // String values are not instances of anything. 2984 // String values are not instances of anything.
2984 __ IsObjectJSStringType(object, scratch, &slow); 2985 __ IsObjectJSStringType(object, scratch, &slow);
2985 __ mov(r0, Operand(Smi::FromInt(1))); 2986 __ mov(r0, Operand(Smi::FromInt(1)));
2986 __ Ret(args_in_registers() ? 0 : 2); 2987 __ Ret(args_in_registers() ? 0 : 2);
2987 2988
2988 // Slow-case. Tail call builtin. 2989 // Slow-case. Tail call builtin.
2990 if (args_in_registers()) {
2991 __ Push(r0, r1);
2992 }
2989 __ bind(&slow); 2993 __ bind(&slow);
2990 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); 2994 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS);
2991 } 2995 }
2992 2996
2993 2997
2994 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 2998 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
2995 // The displacement is the offset of the last parameter (if any) 2999 // The displacement is the offset of the last parameter (if any)
2996 // relative to the frame pointer. 3000 // relative to the frame pointer.
2997 static const int kDisplacement = 3001 static const int kDisplacement =
2998 StandardFrameConstants::kCallerSPOffset - kPointerSize; 3002 StandardFrameConstants::kCallerSPOffset - kPointerSize;
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
4976 __ pop(r1); 4980 __ pop(r1);
4977 __ Jump(r2); 4981 __ Jump(r2);
4978 } 4982 }
4979 4983
4980 4984
4981 #undef __ 4985 #undef __
4982 4986
4983 } } // namespace v8::internal 4987 } } // namespace v8::internal
4984 4988
4985 #endif // V8_TARGET_ARCH_ARM 4989 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698