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

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

Issue 7937004: Fix a harmless assert and a genuine bug in the GC-safety of stub (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } else { 852 } else {
853 __ Strd(r0, r1, FieldMemOperand(heap_number_result, 853 __ Strd(r0, r1, FieldMemOperand(heap_number_result,
854 HeapNumber::kValueOffset)); 854 HeapNumber::kValueOffset));
855 } 855 }
856 // Place heap_number_result in r0 and return to the pushed return address. 856 // Place heap_number_result in r0 and return to the pushed return address.
857 __ mov(r0, Operand(heap_number_result)); 857 __ mov(r0, Operand(heap_number_result));
858 __ pop(pc); 858 __ pop(pc);
859 } 859 }
860 860
861 861
862 bool WriteInt32ToHeapNumberStub::CompilingCallsToThisStubIsGCSafe() {
863 // These variants are compiled ahead of time. See next method.
864 if (the_int_.is(r1) && the_heap_number_.is(r0) && scratch_.is(r2)) {
865 return true;
866 }
867 if (the_int_.is(r2) && the_heap_number_.is(r0) && scratch_.is(r3)) {
868 return true;
869 }
870 // Other register combinations are generated as and when they are needed,
871 // so it is unsafe to call them from stubs (we can't generate a stub while
872 // we are generating a stub).
873 return false;
874 }
875
876
877 void WriteInt32ToHeapNumberStub::GenerateStubsAheadOfTime() {
878 WriteInt32ToHeapNumberStub stub1(r1, r0, r2);
879 WriteInt32ToHeapNumberStub stub2(r2, r0, r3);
880 Handle<Code> code1 = stub1.GetCode();
881 Handle<Code> code2 = stub2.GetCode();
882 }
883
884
862 // See comment for class. 885 // See comment for class.
863 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { 886 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
864 Label max_negative_int; 887 Label max_negative_int;
865 // the_int_ has the answer which is a signed int32 but not a Smi. 888 // the_int_ has the answer which is a signed int32 but not a Smi.
866 // We test for the special value that has a different exponent. This test 889 // We test for the special value that has a different exponent. This test
867 // has the neat side effect of setting the flags according to the sign. 890 // has the neat side effect of setting the flags according to the sign.
868 STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u); 891 STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u);
869 __ cmp(the_int_, Operand(0x80000000u)); 892 __ cmp(the_int_, Operand(0x80000000u));
870 __ b(eq, &max_negative_int); 893 __ b(eq, &max_negative_int);
871 // Set up the correct exponent in scratch_. All non-Smi int32s have the same. 894 // Set up the correct exponent in scratch_. All non-Smi int32s have the same.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 } else { 1215 } else {
1193 // Call a native function to do a comparison between two non-NaNs. 1216 // Call a native function to do a comparison between two non-NaNs.
1194 // Call C routine that may not cause GC or other trouble. 1217 // Call C routine that may not cause GC or other trouble.
1195 __ push(lr); 1218 __ push(lr);
1196 __ PrepareCallCFunction(0, 2, r5); 1219 __ PrepareCallCFunction(0, 2, r5);
1197 if (masm->use_eabi_hardfloat()) { 1220 if (masm->use_eabi_hardfloat()) {
1198 CpuFeatures::Scope scope(VFP3); 1221 CpuFeatures::Scope scope(VFP3);
1199 __ vmov(d0, r0, r1); 1222 __ vmov(d0, r0, r1);
1200 __ vmov(d1, r2, r3); 1223 __ vmov(d1, r2, r3);
1201 } 1224 }
1225
1226 AllowExternalCallThatCantCauseGC scope(masm);
1202 __ CallCFunction(ExternalReference::compare_doubles(masm->isolate()), 1227 __ CallCFunction(ExternalReference::compare_doubles(masm->isolate()),
1203 0, 2); 1228 0, 2);
1204 __ pop(pc); // Return. 1229 __ pop(pc); // Return.
1205 } 1230 }
1206 } 1231 }
1207 1232
1208 1233
1209 // See comment at call site. 1234 // See comment at call site.
1210 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, 1235 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
1211 Register lhs, 1236 Register lhs,
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3334 } 3359 }
3335 3360
3336 3361
3337 bool CEntryStub::CompilingCallsToThisStubIsGCSafe() { 3362 bool CEntryStub::CompilingCallsToThisStubIsGCSafe() {
3338 return (!save_doubles_ || ISOLATE->fp_stubs_generated()) && 3363 return (!save_doubles_ || ISOLATE->fp_stubs_generated()) &&
3339 result_size_ == 1; 3364 result_size_ == 1;
3340 } 3365 }
3341 3366
3342 3367
3343 void CodeStub::GenerateStubsAheadOfTime() { 3368 void CodeStub::GenerateStubsAheadOfTime() {
3369 WriteInt32ToHeapNumberStub::GenerateStubsAheadOfTime();
3344 } 3370 }
3345 3371
3346 3372
3347 void CodeStub::GenerateFPStubs() { 3373 void CodeStub::GenerateFPStubs() {
3348 CEntryStub save_doubles(1); 3374 CEntryStub save_doubles(1);
3349 save_doubles.SaveDoubles(); 3375 save_doubles.SaveDoubles();
3350 Handle<Code> code = save_doubles.GetCode(); 3376 Handle<Code> code = save_doubles.GetCode();
3351 code->GetIsolate()->set_fp_stubs_generated(true); 3377 code->GetIsolate()->set_fp_stubs_generated(true);
3352 } 3378 }
3353 3379
(...skipping 3384 matching lines...) Expand 10 before | Expand all | Expand 10 after
6738 __ mov(result, Operand::Zero()); 6764 __ mov(result, Operand::Zero());
6739 __ Ret(); 6765 __ Ret();
6740 } 6766 }
6741 6767
6742 6768
6743 #undef __ 6769 #undef __
6744 6770
6745 } } // namespace v8::internal 6771 } } // namespace v8::internal
6746 6772
6747 #endif // V8_TARGET_ARCH_ARM 6773 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698