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

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

Issue 6113004: Version 3.0.7 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/codegen-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 2887 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = r0; // 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 = r1; // 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 (!HasArgsInRegisters()) {
2909 __ ldr(object, MemOperand(sp, 1 * kPointerSize)); 2909 __ ldr(object, MemOperand(sp, 1 * kPointerSize));
2910 __ ldr(function, 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, &not_js_object); 2914 __ BranchOnSmi(object, &not_js_object);
2915 __ IsObjectJSObjectType(object, map, scratch, &not_js_object); 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(function, 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(r0, Heap::kInstanceofCacheAnswerRootIndex); 2925 __ LoadRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2926 __ Ret(args_in_registers() ? 0 : 2); 2926 __ Ret(HasArgsInRegisters() ? 0 : 2);
2927 2927
2928 __ bind(&miss); 2928 __ bind(&miss);
2929 __ TryGetFunctionPrototype(function, 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(function, 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(HasArgsInRegisters() ? 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 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2961 __ Ret(args_in_registers() ? 0 : 2); 2961 __ Ret(HasArgsInRegisters() ? 0 : 2);
2962 2962
2963 Label object_not_null, object_not_null_or_smi; 2963 Label object_not_null, object_not_null_or_smi;
2964 __ bind(&not_js_object); 2964 __ bind(&not_js_object);
2965 // 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
2966 // 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.
2967 __ BranchOnSmi(function, &slow); 2967 __ BranchOnSmi(function, &slow);
2968 __ CompareObjectType(function, map, scratch, JS_FUNCTION_TYPE); 2968 __ CompareObjectType(function, map, scratch, JS_FUNCTION_TYPE);
2969 __ b(ne, &slow); 2969 __ b(ne, &slow);
2970 2970
2971 // Null is not instance of anything. 2971 // Null is not instance of anything.
2972 __ cmp(scratch, Operand(Factory::null_value())); 2972 __ cmp(scratch, Operand(Factory::null_value()));
2973 __ b(ne, &object_not_null); 2973 __ b(ne, &object_not_null);
2974 __ mov(r0, Operand(Smi::FromInt(1))); 2974 __ mov(r0, Operand(Smi::FromInt(1)));
2975 __ Ret(args_in_registers() ? 0 : 2); 2975 __ Ret(HasArgsInRegisters() ? 0 : 2);
2976 2976
2977 __ bind(&object_not_null); 2977 __ bind(&object_not_null);
2978 // Smi values are not instances of anything. 2978 // Smi values are not instances of anything.
2979 __ BranchOnNotSmi(object, &object_not_null_or_smi); 2979 __ BranchOnNotSmi(object, &object_not_null_or_smi);
2980 __ mov(r0, Operand(Smi::FromInt(1))); 2980 __ mov(r0, Operand(Smi::FromInt(1)));
2981 __ Ret(args_in_registers() ? 0 : 2); 2981 __ Ret(HasArgsInRegisters() ? 0 : 2);
2982 2982
2983 __ bind(&object_not_null_or_smi); 2983 __ bind(&object_not_null_or_smi);
2984 // String values are not instances of anything. 2984 // String values are not instances of anything.
2985 __ IsObjectJSStringType(object, scratch, &slow); 2985 __ IsObjectJSStringType(object, scratch, &slow);
2986 __ mov(r0, Operand(Smi::FromInt(1))); 2986 __ mov(r0, Operand(Smi::FromInt(1)));
2987 __ Ret(args_in_registers() ? 0 : 2); 2987 __ Ret(HasArgsInRegisters() ? 0 : 2);
2988 2988
2989 // Slow-case. Tail call builtin. 2989 // Slow-case. Tail call builtin.
2990 if (args_in_registers()) { 2990 __ bind(&slow);
2991 if (HasArgsInRegisters()) {
2991 __ Push(r0, r1); 2992 __ Push(r0, r1);
2992 } 2993 }
2993 __ bind(&slow);
2994 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); 2994 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS);
2995 } 2995 }
2996 2996
2997 2997
2998 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 2998 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
2999 // The displacement is the offset of the last parameter (if any) 2999 // The displacement is the offset of the last parameter (if any)
3000 // relative to the frame pointer. 3000 // relative to the frame pointer.
3001 static const int kDisplacement = 3001 static const int kDisplacement =
3002 StandardFrameConstants::kCallerSPOffset - kPointerSize; 3002 StandardFrameConstants::kCallerSPOffset - kPointerSize;
3003 3003
3004 // Check that the key is a smi. 3004 // Check that the key is a smi.
3005 Label slow; 3005 Label slow;
3006 __ BranchOnNotSmi(r1, &slow); 3006 __ BranchOnNotSmi(r1, &slow);
3007 3007
3008 // Check if the calling frame is an arguments adaptor frame. 3008 // Check if the calling frame is an arguments adaptor frame.
3009 Label adaptor; 3009 Label adaptor;
3010 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 3010 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
3011 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); 3011 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
3012 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 3012 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
3013 __ b(eq, &adaptor); 3013 __ b(eq, &adaptor);
3014 3014
3015 // Check index against formal parameters count limit passed in 3015 // Check index against formal parameters count limit passed in
3016 // through register r0. Use unsigned comparison to get negative 3016 // through register r0. Use unsigned comparison to get negative
3017 // check for free. 3017 // check for free.
3018 __ cmp(r1, r0); 3018 __ cmp(r1, r0);
3019 __ b(cs, &slow); 3019 __ b(hs, &slow);
3020 3020
3021 // Read the argument from the stack and return it. 3021 // Read the argument from the stack and return it.
3022 __ sub(r3, r0, r1); 3022 __ sub(r3, r0, r1);
3023 __ add(r3, fp, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize)); 3023 __ add(r3, fp, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize));
3024 __ ldr(r0, MemOperand(r3, kDisplacement)); 3024 __ ldr(r0, MemOperand(r3, kDisplacement));
3025 __ Jump(lr); 3025 __ Jump(lr);
3026 3026
3027 // Arguments adaptor case: Check index against actual arguments 3027 // Arguments adaptor case: Check index against actual arguments
3028 // limit found in the arguments adaptor frame. Use unsigned 3028 // limit found in the arguments adaptor frame. Use unsigned
3029 // comparison to get negative check for free. 3029 // comparison to get negative check for free.
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
4980 __ pop(r1); 4980 __ pop(r1);
4981 __ Jump(r2); 4981 __ Jump(r2);
4982 } 4982 }
4983 4983
4984 4984
4985 #undef __ 4985 #undef __
4986 4986
4987 } } // namespace v8::internal 4987 } } // namespace v8::internal
4988 4988
4989 #endif // V8_TARGET_ARCH_ARM 4989 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698