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

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

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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/api.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 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2894 // Restore callee-saved registers and return. 2894 // Restore callee-saved registers and return.
2895 #ifdef DEBUG 2895 #ifdef DEBUG
2896 if (FLAG_debug_code) { 2896 if (FLAG_debug_code) {
2897 __ mov(lr, Operand(pc)); 2897 __ mov(lr, Operand(pc));
2898 } 2898 }
2899 #endif 2899 #endif
2900 __ ldm(ia_w, sp, kCalleeSaved | pc.bit()); 2900 __ ldm(ia_w, sp, kCalleeSaved | pc.bit());
2901 } 2901 }
2902 2902
2903 2903
2904 // This stub performs an instanceof, calling the builtin function if 2904 // Uses registers r0 to r4. Expected input is
2905 // necessary. Uses r1 for the object, r0 for the function that it may 2905 // function in r0 (or at sp+1*ptrsz) and object in
2906 // be an instance of (these are fetched from the stack). 2906 // r1 (or at sp), depending on whether or not
2907 // args_in_registers() is true.
2907 void InstanceofStub::Generate(MacroAssembler* masm) { 2908 void InstanceofStub::Generate(MacroAssembler* masm) {
2908 // Get the object - slow case for smis (we may need to throw an exception 2909 // Fixed register usage throughout the stub:
2909 // depending on the rhs). 2910 const Register object = r1; // Object (lhs).
2910 Label slow, loop, is_instance, is_not_instance; 2911 const Register map = r3; // Map of the object.
2911 __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); 2912 const Register function = r0; // Function (rhs).
2912 __ BranchOnSmi(r0, &slow); 2913 const Register prototype = r4; // Prototype of the function.
2914 const Register scratch = r2;
2915 Label slow, loop, is_instance, is_not_instance, not_js_object;
2916 if (!args_in_registers()) {
2917 __ ldr(function, MemOperand(sp, 1 * kPointerSize));
2918 __ ldr(object, MemOperand(sp, 0));
2919 }
2913 2920
2914 // Check that the left hand is a JS object and put map in r3. 2921 // Check that the left hand is a JS object and load map.
2915 __ CompareObjectType(r0, r3, r2, FIRST_JS_OBJECT_TYPE); 2922 __ BranchOnSmi(object, &slow);
2916 __ b(lt, &slow); 2923 __ IsObjectJSObjectType(object, map, scratch, &slow);
2917 __ cmp(r2, Operand(LAST_JS_OBJECT_TYPE));
2918 __ b(gt, &slow);
2919
2920 // Get the prototype of the function (r4 is result, r2 is scratch).
2921 __ ldr(r1, MemOperand(sp, 0));
2922 // r1 is function, r3 is map.
2923 2924
2924 // Look up the function and the map in the instanceof cache. 2925 // Look up the function and the map in the instanceof cache.
2925 Label miss; 2926 Label miss;
2926 __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex); 2927 __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex);
2927 __ cmp(r1, ip); 2928 __ cmp(object, ip);
2928 __ b(ne, &miss); 2929 __ b(ne, &miss);
2929 __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex); 2930 __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex);
2930 __ cmp(r3, ip); 2931 __ cmp(map, ip);
2931 __ b(ne, &miss); 2932 __ b(ne, &miss);
2932 __ LoadRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); 2933 __ LoadRoot(function, Heap::kInstanceofCacheAnswerRootIndex);
2933 __ pop(); 2934 __ Ret(args_in_registers() ? 0 : 2);
2934 __ pop();
2935 __ mov(pc, Operand(lr));
2936 2935
2937 __ bind(&miss); 2936 __ bind(&miss);
2938 __ TryGetFunctionPrototype(r1, r4, r2, &slow); 2937 __ TryGetFunctionPrototype(object, prototype, scratch, &slow);
2939 2938
2940 // Check that the function prototype is a JS object. 2939 // Check that the function prototype is a JS object.
2941 __ BranchOnSmi(r4, &slow); 2940 __ BranchOnSmi(prototype, &slow);
2942 __ CompareObjectType(r4, r5, r5, FIRST_JS_OBJECT_TYPE); 2941 __ IsObjectJSObjectType(prototype, scratch, scratch, &slow);
2943 __ b(lt, &slow);
2944 __ cmp(r5, Operand(LAST_JS_OBJECT_TYPE));
2945 __ b(gt, &slow);
2946 2942
2947 __ StoreRoot(r1, Heap::kInstanceofCacheFunctionRootIndex); 2943 __ StoreRoot(object, Heap::kInstanceofCacheFunctionRootIndex);
2948 __ StoreRoot(r3, Heap::kInstanceofCacheMapRootIndex); 2944 __ StoreRoot(map, Heap::kInstanceofCacheMapRootIndex);
2949 2945
2950 // Register mapping: r3 is object map and r4 is function prototype. 2946 // Register mapping: r3 is object map and r4 is function prototype.
2951 // Get prototype of object into r2. 2947 // Get prototype of object into r2.
2952 __ ldr(r2, FieldMemOperand(r3, Map::kPrototypeOffset)); 2948 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset));
2953 2949
2954 // Loop through the prototype chain looking for the function prototype. 2950 // Loop through the prototype chain looking for the function prototype.
2955 __ bind(&loop); 2951 __ bind(&loop);
2956 __ cmp(r2, Operand(r4)); 2952 __ cmp(scratch, Operand(prototype));
2957 __ b(eq, &is_instance); 2953 __ b(eq, &is_instance);
2958 __ LoadRoot(ip, Heap::kNullValueRootIndex); 2954 __ LoadRoot(ip, Heap::kNullValueRootIndex);
2959 __ cmp(r2, ip); 2955 __ cmp(scratch, ip);
2960 __ b(eq, &is_not_instance); 2956 __ b(eq, &is_not_instance);
2961 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); 2957 __ ldr(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset));
2962 __ ldr(r2, FieldMemOperand(r2, Map::kPrototypeOffset)); 2958 __ ldr(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset));
2963 __ jmp(&loop); 2959 __ jmp(&loop);
2964 2960
2965 __ bind(&is_instance); 2961 __ bind(&is_instance);
2966 __ mov(r0, Operand(Smi::FromInt(0))); 2962 __ mov(r0, Operand(Smi::FromInt(0)));
2967 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); 2963 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2968 __ pop(); 2964 __ Ret(args_in_registers() ? 0 : 2);
2969 __ pop();
2970 __ mov(pc, Operand(lr)); // Return.
2971 2965
2972 __ bind(&is_not_instance); 2966 __ bind(&is_not_instance);
2973 __ mov(r0, Operand(Smi::FromInt(1))); 2967 __ mov(r0, Operand(Smi::FromInt(1)));
2974 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); 2968 __ Ret(args_in_registers() ? 0 : 2);
2975 __ pop(); 2969
2976 __ pop(); 2970 Label object_not_null, object_not_null_or_smi;
2977 __ mov(pc, Operand(lr)); // Return. 2971 __ bind(&not_js_object);
2972 // Before null, smi and string value checks, check that the rhs is a function
2973 // as for a non-function rhs an exception needs to be thrown.
2974 __ BranchOnSmi(function, &slow);
2975 __ CompareObjectType(function, map, scratch, JS_FUNCTION_TYPE);
2976 __ b(ne, &slow);
2977
2978 // Null is not instance of anything.
2979 __ cmp(scratch, Operand(FACTORY->null_value()));
2980 __ b(ne, &object_not_null);
2981 __ mov(r0, Operand(Smi::FromInt(1)));
2982 __ Ret(args_in_registers() ? 0 : 2);
2983
2984 __ bind(&object_not_null);
2985 // Smi values are not instances of anything.
2986 __ BranchOnNotSmi(object, &object_not_null_or_smi);
2987 __ mov(r0, Operand(Smi::FromInt(1)));
2988 __ Ret(args_in_registers() ? 0 : 2);
2989
2990 __ bind(&object_not_null_or_smi);
2991 // String values are not instances of anything.
2992 __ IsObjectJSStringType(object, scratch, &slow);
2993 __ mov(r0, Operand(Smi::FromInt(1)));
2994 __ Ret(args_in_registers() ? 0 : 2);
2978 2995
2979 // Slow-case. Tail call builtin. 2996 // Slow-case. Tail call builtin.
2980 __ bind(&slow); 2997 __ bind(&slow);
2981 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); 2998 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS);
2982 } 2999 }
2983 3000
2984 3001
2985 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 3002 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
2986 // The displacement is the offset of the last parameter (if any) 3003 // The displacement is the offset of the last parameter (if any)
2987 // relative to the frame pointer. 3004 // relative to the frame pointer.
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
4969 __ pop(r1); 4986 __ pop(r1);
4970 __ Jump(r2); 4987 __ Jump(r2);
4971 } 4988 }
4972 4989
4973 4990
4974 #undef __ 4991 #undef __
4975 4992
4976 } } // namespace v8::internal 4993 } } // namespace v8::internal
4977 4994
4978 #endif // V8_TARGET_ARCH_ARM 4995 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698