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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6331005: ARM: Implement fast code for ModI. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 | « no previous file | 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1031 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1032 Label ok; 1032 Label ok;
1033 __ tst(left, Operand(left)); 1033 __ tst(left, Operand(left));
1034 __ b(ne, &ok); 1034 __ b(ne, &ok);
1035 __ tst(right, Operand(right)); 1035 __ tst(right, Operand(right));
1036 __ b(pl, &ok); 1036 __ b(pl, &ok);
1037 __ b(al, &deoptimize); 1037 __ b(al, &deoptimize);
1038 __ bind(&ok); 1038 __ bind(&ok);
1039 } 1039 }
1040 1040
1041 // Try a few common cases before using the generic stub.
Søren Thygesen Gjesse 2011/01/18 15:58:38 Maybe extend this comment a bit (it took me some t
Karl Klose 2011/01/20 02:12:12 Done.
1042 const int kUnfolds = 3;
1043 __ mov(scratch, left);
1044 for (int i = 0; i < kUnfolds; i++) {
1045 // Check if the left hand side is less or equal.
1046 if (i == 0) __ cmp(scratch, right);
1047 __ mov(result, scratch, LeaveCC, le);
1048 __ b(le, &done);
1049 if (i < kUnfolds - 1) __ sub(scratch, left, right);
Søren Thygesen Gjesse 2011/01/18 15:58:38 Shouldn't this be __ sub(scratch, scratch, right,
Karl Klose 2011/01/20 02:12:12 Thanks for the catch. On 2011/01/18 15:58:38, Søre
1050 }
1051
1052 // Check for power of two on the right hand side.
Søren Thygesen Gjesse 2011/01/18 15:58:38 I think the code we have in GenericBinaryOpStub do
Karl Klose 2011/01/20 02:12:12 Done.
1053 const int kMaxPowerOfTwo = 32;
1054 for (int i = 2; i <= kMaxPowerOfTwo; i <<= 1) {
1055 __ cmp(right, Operand(i));
1056 __ and_(result, left, Operand(i-1), LeaveCC, eq);
1057 __ b(&done, eq);
1058 }
1059
1041 // Call the generic stub. The numbers in r0 and r1 have 1060 // Call the generic stub. The numbers in r0 and r1 have
1042 // to be tagged to Smis. If that is not possible, deoptimize. 1061 // to be tagged to Smis. If that is not possible, deoptimize.
1043 DeferredModI* deferred = new DeferredModI(this, instr); 1062 DeferredModI* deferred = new DeferredModI(this, instr);
1044 __ TrySmiTag(left, &deoptimize, scratch); 1063 __ TrySmiTag(left, &deoptimize, scratch);
1045 __ TrySmiTag(right, &deoptimize, scratch); 1064 __ TrySmiTag(right, &deoptimize, scratch);
1046 1065
1047 __ b(al, deferred->entry()); 1066 __ b(al, deferred->entry());
1048 __ bind(deferred->exit()); 1067 __ bind(deferred->exit());
1049 1068
1050 // If the result in r0 is a Smi, untag it, else deoptimize. 1069 // If the result in r0 is a Smi, untag it, else deoptimize.
1051 __ BranchOnNotSmi(result, &deoptimize); 1070 __ BranchOnNotSmi(result, &deoptimize);
1052 __ mov(result, Operand(result, ASR, 1)); 1071 __ SmiUntag(result);
1053 1072
1054 __ b(al, &done); 1073 __ b(al, &done);
1055 __ bind(&deoptimize); 1074 __ bind(&deoptimize);
1056 DeoptimizeIf(al, instr->environment()); 1075 DeoptimizeIf(al, instr->environment());
1057 __ bind(&done); 1076 __ bind(&done);
1058 } 1077 }
1059 1078
1060 1079
1061 void LCodeGen::DoDivI(LDivI* instr) { 1080 void LCodeGen::DoDivI(LDivI* instr) {
1062 class DeferredDivI: public LDeferredCode { 1081 class DeferredDivI: public LDeferredCode {
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 3221
3203 3222
3204 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 3223 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
3205 Abort("DoOsrEntry unimplemented."); 3224 Abort("DoOsrEntry unimplemented.");
3206 } 3225 }
3207 3226
3208 3227
3209 #undef __ 3228 #undef __
3210 3229
3211 } } // namespace v8::internal 3230 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698