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

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

Issue 6066010: Merge 6095:6198 from bleeding_edge to experimental/gc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
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/code-stubs-arm.h ('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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 GenerateLookupNumberStringCache(masm, r1, r0, r2, r3, r4, false, &runtime); 910 GenerateLookupNumberStringCache(masm, r1, r0, r2, r3, r4, false, &runtime);
911 __ add(sp, sp, Operand(1 * kPointerSize)); 911 __ add(sp, sp, Operand(1 * kPointerSize));
912 __ Ret(); 912 __ Ret();
913 913
914 __ bind(&runtime); 914 __ bind(&runtime);
915 // Handle number to string in the runtime system if not found in the cache. 915 // Handle number to string in the runtime system if not found in the cache.
916 __ TailCallRuntime(Runtime::kNumberToStringSkipCache, 1, 1); 916 __ TailCallRuntime(Runtime::kNumberToStringSkipCache, 1, 1);
917 } 917 }
918 918
919 919
920 void RecordWriteStub::Generate(MacroAssembler* masm) {
921 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
922 __ add(offset_, object_, Operand(offset_));
923 __ RecordWriteHelper(object_, offset_, scratch_);
924 #endif
925 __ Ret();
926 }
927
928
929 // On entry lhs_ and rhs_ are the values to be compared. 920 // On entry lhs_ and rhs_ are the values to be compared.
930 // On exit r0 is 0, positive or negative to indicate the result of 921 // On exit r0 is 0, positive or negative to indicate the result of
931 // the comparison. 922 // the comparison.
932 void CompareStub::Generate(MacroAssembler* masm) { 923 void CompareStub::Generate(MacroAssembler* masm) {
933 ASSERT((lhs_.is(r0) && rhs_.is(r1)) || 924 ASSERT((lhs_.is(r0) && rhs_.is(r1)) ||
934 (lhs_.is(r1) && rhs_.is(r0))); 925 (lhs_.is(r1) && rhs_.is(r0)));
935 926
936 Label slow; // Call builtin. 927 Label slow; // Call builtin.
937 Label not_smis, both_loaded_as_doubles, lhs_not_nan; 928 Label not_smis, both_loaded_as_doubles, lhs_not_nan;
938 929
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 // After this point we have the left hand side in r1 and the right hand side 1215 // After this point we have the left hand side in r1 and the right hand side
1225 // in r0. 1216 // in r0.
1226 if (lhs.is(r0)) { 1217 if (lhs.is(r0)) {
1227 __ Swap(r0, r1, ip); 1218 __ Swap(r0, r1, ip);
1228 } 1219 }
1229 1220
1230 // The type transition also calculates the answer. 1221 // The type transition also calculates the answer.
1231 bool generate_code_to_calculate_answer = true; 1222 bool generate_code_to_calculate_answer = true;
1232 1223
1233 if (ShouldGenerateFPCode()) { 1224 if (ShouldGenerateFPCode()) {
1225 // DIV has neither SmiSmi fast code nor specialized slow code.
1226 // So don't try to patch a DIV Stub.
1234 if (runtime_operands_type_ == BinaryOpIC::DEFAULT) { 1227 if (runtime_operands_type_ == BinaryOpIC::DEFAULT) {
1235 switch (op_) { 1228 switch (op_) {
1236 case Token::ADD: 1229 case Token::ADD:
1237 case Token::SUB: 1230 case Token::SUB:
1238 case Token::MUL: 1231 case Token::MUL:
1239 case Token::DIV:
1240 GenerateTypeTransition(masm); // Tail call. 1232 GenerateTypeTransition(masm); // Tail call.
1241 generate_code_to_calculate_answer = false; 1233 generate_code_to_calculate_answer = false;
1242 break; 1234 break;
1243 1235
1236 case Token::DIV:
1237 // DIV has neither SmiSmi fast code nor specialized slow code.
1238 // So don't try to patch a DIV Stub.
1239 break;
1240
1244 default: 1241 default:
1245 break; 1242 break;
1246 } 1243 }
1247 } 1244 }
1248 1245
1249 if (generate_code_to_calculate_answer) { 1246 if (generate_code_to_calculate_answer) {
1250 Label r0_is_smi, r1_is_smi, finished_loading_r0, finished_loading_r1; 1247 Label r0_is_smi, r1_is_smi, finished_loading_r0, finished_loading_r1;
1251 if (mode_ == NO_OVERWRITE) { 1248 if (mode_ == NO_OVERWRITE) {
1252 // In the case where there is no chance of an overwritable float we may 1249 // In the case where there is no chance of an overwritable float we may
1253 // as well do the allocation immediately while r0 and r1 are untouched. 1250 // as well do the allocation immediately while r0 and r1 are untouched.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 __ mov(r7, Operand(r0)); 1291 __ mov(r7, Operand(r0));
1295 ConvertToDoubleStub stub3(r3, r2, r7, r4); 1292 ConvertToDoubleStub stub3(r3, r2, r7, r4);
1296 __ push(lr); 1293 __ push(lr);
1297 __ Call(stub3.GetCode(), RelocInfo::CODE_TARGET); 1294 __ Call(stub3.GetCode(), RelocInfo::CODE_TARGET);
1298 __ pop(lr); 1295 __ pop(lr);
1299 } 1296 }
1300 1297
1301 // HEAP_NUMBERS stub is slower than GENERIC on a pair of smis. 1298 // HEAP_NUMBERS stub is slower than GENERIC on a pair of smis.
1302 // r0 is known to be a smi. If r1 is also a smi then switch to GENERIC. 1299 // r0 is known to be a smi. If r1 is also a smi then switch to GENERIC.
1303 Label r1_is_not_smi; 1300 Label r1_is_not_smi;
1304 if (runtime_operands_type_ == BinaryOpIC::HEAP_NUMBERS) { 1301 if ((runtime_operands_type_ == BinaryOpIC::HEAP_NUMBERS) &&
1302 HasSmiSmiFastPath()) {
1305 __ tst(r1, Operand(kSmiTagMask)); 1303 __ tst(r1, Operand(kSmiTagMask));
1306 __ b(ne, &r1_is_not_smi); 1304 __ b(ne, &r1_is_not_smi);
1307 GenerateTypeTransition(masm); // Tail call. 1305 GenerateTypeTransition(masm); // Tail call.
1308 } 1306 }
1309 1307
1310 __ bind(&finished_loading_r0); 1308 __ bind(&finished_loading_r0);
1311 1309
1312 // Move r1 to a double in r0-r1. 1310 // Move r1 to a double in r0-r1.
1313 __ tst(r1, Operand(kSmiTagMask)); 1311 __ tst(r1, Operand(kSmiTagMask));
1314 __ b(eq, &r1_is_smi); // It's a Smi so don't check it's a heap number. 1312 __ b(eq, &r1_is_smi); // It's a Smi so don't check it's a heap number.
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2889 #ifdef DEBUG 2887 #ifdef DEBUG
2890 if (FLAG_debug_code) { 2888 if (FLAG_debug_code) {
2891 __ mov(lr, Operand(pc)); 2889 __ mov(lr, Operand(pc));
2892 } 2890 }
2893 #endif 2891 #endif
2894 __ ldm(ia_w, sp, kCalleeSaved | pc.bit()); 2892 __ ldm(ia_w, sp, kCalleeSaved | pc.bit());
2895 } 2893 }
2896 2894
2897 2895
2898 // Uses registers r0 to r4. Expected input is 2896 // Uses registers r0 to r4. Expected input is
2899 // function in r0 (or at sp+1*ptrsz) and object in 2897 // object in r0 (or at sp+1*kPointerSize) and function in
2900 // r1 (or at sp), depending on whether or not 2898 // r1 (or at sp), depending on whether or not
2901 // args_in_registers() is true. 2899 // args_in_registers() is true.
2902 void InstanceofStub::Generate(MacroAssembler* masm) { 2900 void InstanceofStub::Generate(MacroAssembler* masm) {
2903 // Fixed register usage throughout the stub: 2901 // Fixed register usage throughout the stub:
2904 const Register object = r1; // Object (lhs). 2902 const Register object = r0; // Object (lhs).
2905 const Register map = r3; // Map of the object. 2903 const Register map = r3; // Map of the object.
2906 const Register function = r0; // Function (rhs). 2904 const Register function = r1; // Function (rhs).
2907 const Register prototype = r4; // Prototype of the function. 2905 const Register prototype = r4; // Prototype of the function.
2908 const Register scratch = r2; 2906 const Register scratch = r2;
2909 Label slow, loop, is_instance, is_not_instance, not_js_object; 2907 Label slow, loop, is_instance, is_not_instance, not_js_object;
2910 if (!args_in_registers()) { 2908 if (!args_in_registers()) {
2911 __ ldr(function, MemOperand(sp, 1 * kPointerSize)); 2909 __ ldr(object, MemOperand(sp, 1 * kPointerSize));
2912 __ ldr(object, MemOperand(sp, 0)); 2910 __ ldr(function, MemOperand(sp, 0));
2913 } 2911 }
2914 2912
2915 // 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.
2916 __ BranchOnSmi(object, &slow); 2914 __ BranchOnSmi(object, &not_js_object);
2917 __ IsObjectJSObjectType(object, map, scratch, &slow); 2915 __ IsObjectJSObjectType(object, map, scratch, &not_js_object);
2918 2916
2919 // Look up the function and the map in the instanceof cache. 2917 // Look up the function and the map in the instanceof cache.
2920 Label miss; 2918 Label miss;
2921 __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex); 2919 __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex);
2922 __ cmp(object, ip); 2920 __ cmp(function, ip);
2923 __ b(ne, &miss); 2921 __ b(ne, &miss);
2924 __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex); 2922 __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex);
2925 __ cmp(map, ip); 2923 __ cmp(map, ip);
2926 __ b(ne, &miss); 2924 __ b(ne, &miss);
2927 __ LoadRoot(function, Heap::kInstanceofCacheAnswerRootIndex); 2925 __ LoadRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2928 __ Ret(args_in_registers() ? 0 : 2); 2926 __ Ret(args_in_registers() ? 0 : 2);
2929 2927
2930 __ bind(&miss); 2928 __ bind(&miss);
2931 __ TryGetFunctionPrototype(object, prototype, scratch, &slow); 2929 __ TryGetFunctionPrototype(function, prototype, scratch, &slow);
2932 2930
2933 // Check that the function prototype is a JS object. 2931 // Check that the function prototype is a JS object.
2934 __ BranchOnSmi(prototype, &slow); 2932 __ BranchOnSmi(prototype, &slow);
2935 __ IsObjectJSObjectType(prototype, scratch, scratch, &slow); 2933 __ IsObjectJSObjectType(prototype, scratch, scratch, &slow);
2936 2934
2937 __ StoreRoot(object, Heap::kInstanceofCacheFunctionRootIndex); 2935 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
2938 __ StoreRoot(map, Heap::kInstanceofCacheMapRootIndex); 2936 __ StoreRoot(map, Heap::kInstanceofCacheMapRootIndex);
2939 2937
2940 // Register mapping: r3 is object map and r4 is function prototype. 2938 // Register mapping: r3 is object map and r4 is function prototype.
2941 // Get prototype of object into r2. 2939 // Get prototype of object into r2.
2942 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); 2940 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset));
2943 2941
2944 // Loop through the prototype chain looking for the function prototype. 2942 // Loop through the prototype chain looking for the function prototype.
2945 __ bind(&loop); 2943 __ bind(&loop);
2946 __ cmp(scratch, Operand(prototype)); 2944 __ cmp(scratch, Operand(prototype));
2947 __ b(eq, &is_instance); 2945 __ b(eq, &is_instance);
2948 __ LoadRoot(ip, Heap::kNullValueRootIndex); 2946 __ LoadRoot(ip, Heap::kNullValueRootIndex);
2949 __ cmp(scratch, ip); 2947 __ cmp(scratch, ip);
2950 __ b(eq, &is_not_instance); 2948 __ b(eq, &is_not_instance);
2951 __ ldr(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset)); 2949 __ ldr(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset));
2952 __ ldr(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset)); 2950 __ ldr(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset));
2953 __ jmp(&loop); 2951 __ jmp(&loop);
2954 2952
2955 __ bind(&is_instance); 2953 __ bind(&is_instance);
2956 __ mov(r0, Operand(Smi::FromInt(0))); 2954 __ mov(r0, Operand(Smi::FromInt(0)));
2957 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); 2955 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2958 __ Ret(args_in_registers() ? 0 : 2); 2956 __ Ret(args_in_registers() ? 0 : 2);
2959 2957
2960 __ bind(&is_not_instance); 2958 __ bind(&is_not_instance);
2961 __ mov(r0, Operand(Smi::FromInt(1))); 2959 __ mov(r0, Operand(Smi::FromInt(1)));
2960 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
2962 __ Ret(args_in_registers() ? 0 : 2); 2961 __ Ret(args_in_registers() ? 0 : 2);
2963 2962
2964 Label object_not_null, object_not_null_or_smi; 2963 Label object_not_null, object_not_null_or_smi;
2965 __ bind(&not_js_object); 2964 __ bind(&not_js_object);
2966 // 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
2967 // 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.
2968 __ BranchOnSmi(function, &slow); 2967 __ BranchOnSmi(function, &slow);
2969 __ CompareObjectType(function, map, scratch, JS_FUNCTION_TYPE); 2968 __ CompareObjectType(function, map, scratch, JS_FUNCTION_TYPE);
2970 __ b(ne, &slow); 2969 __ b(ne, &slow);
2971 2970
2972 // Null is not instance of anything. 2971 // Null is not instance of anything.
2973 __ cmp(scratch, Operand(Factory::null_value())); 2972 __ cmp(scratch, Operand(Factory::null_value()));
2974 __ b(ne, &object_not_null); 2973 __ b(ne, &object_not_null);
2975 __ mov(r0, Operand(Smi::FromInt(1))); 2974 __ mov(r0, Operand(Smi::FromInt(1)));
2976 __ Ret(args_in_registers() ? 0 : 2); 2975 __ Ret(args_in_registers() ? 0 : 2);
2977 2976
2978 __ bind(&object_not_null); 2977 __ bind(&object_not_null);
2979 // Smi values are not instances of anything. 2978 // Smi values are not instances of anything.
2980 __ BranchOnNotSmi(object, &object_not_null_or_smi); 2979 __ BranchOnNotSmi(object, &object_not_null_or_smi);
2981 __ mov(r0, Operand(Smi::FromInt(1))); 2980 __ mov(r0, Operand(Smi::FromInt(1)));
2982 __ Ret(args_in_registers() ? 0 : 2); 2981 __ Ret(args_in_registers() ? 0 : 2);
2983 2982
2984 __ bind(&object_not_null_or_smi); 2983 __ bind(&object_not_null_or_smi);
2985 // String values are not instances of anything. 2984 // String values are not instances of anything.
2986 __ IsObjectJSStringType(object, scratch, &slow); 2985 __ IsObjectJSStringType(object, scratch, &slow);
2987 __ mov(r0, Operand(Smi::FromInt(1))); 2986 __ mov(r0, Operand(Smi::FromInt(1)));
2988 __ Ret(args_in_registers() ? 0 : 2); 2987 __ Ret(args_in_registers() ? 0 : 2);
2989 2988
2990 // Slow-case. Tail call builtin. 2989 // Slow-case. Tail call builtin.
2990 if (args_in_registers()) {
2991 __ Push(r0, r1);
2992 }
2991 __ bind(&slow); 2993 __ bind(&slow);
2992 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); 2994 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS);
2993 } 2995 }
2994 2996
2995 2997
2996 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 2998 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
2997 // The displacement is the offset of the last parameter (if any) 2999 // The displacement is the offset of the last parameter (if any)
2998 // relative to the frame pointer. 3000 // relative to the frame pointer.
2999 static const int kDisplacement = 3001 static const int kDisplacement =
3000 StandardFrameConstants::kCallerSPOffset - kPointerSize; 3002 StandardFrameConstants::kCallerSPOffset - kPointerSize;
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
4982 __ pop(r1); 4984 __ pop(r1);
4983 __ Jump(r2); 4985 __ Jump(r2);
4984 } 4986 }
4985 4987
4986 4988
4987 #undef __ 4989 #undef __
4988 4990
4989 } } // namespace v8::internal 4991 } } // namespace v8::internal
4990 4992
4991 #endif // V8_TARGET_ARCH_ARM 4993 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698