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

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

Issue 13841003: Separate Math Lithium operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 8 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/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 base_object()->PrintTo(stream); 295 base_object()->PrintTo(stream);
296 stream->Add(" + %d", offset()); 296 stream->Add(" + %d", offset());
297 } 297 }
298 298
299 299
300 void LCallConstantFunction::PrintDataTo(StringStream* stream) { 300 void LCallConstantFunction::PrintDataTo(StringStream* stream) {
301 stream->Add("#%d / ", arity()); 301 stream->Add("#%d / ", arity());
302 } 302 }
303 303
304 304
305 void LUnaryMathOperation::PrintDataTo(StringStream* stream) {
306 stream->Add("/%s ", hydrogen()->OpName());
307 value()->PrintTo(stream);
308 }
309
310
311 void LMathExp::PrintDataTo(StringStream* stream) {
312 value()->PrintTo(stream);
313 }
314
315
316 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 305 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
317 context()->PrintTo(stream); 306 context()->PrintTo(stream);
318 stream->Add("[%d]", slot_index()); 307 stream->Add("[%d]", slot_index());
319 } 308 }
320 309
321 310
322 void LStoreContextSlot::PrintDataTo(StringStream* stream) { 311 void LStoreContextSlot::PrintDataTo(StringStream* stream) {
323 context()->PrintTo(stream); 312 context()->PrintTo(stream);
324 stream->Add("[%d] <- ", slot_index()); 313 stream->Add("[%d] <- ", slot_index());
325 value()->PrintTo(stream); 314 value()->PrintTo(stream);
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 1106
1118 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1107 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1119 LOperand* function = UseFixed(instr->function(), r1); 1108 LOperand* function = UseFixed(instr->function(), r1);
1120 argument_count_ -= instr->argument_count(); 1109 argument_count_ -= instr->argument_count();
1121 LInvokeFunction* result = new(zone()) LInvokeFunction(function); 1110 LInvokeFunction* result = new(zone()) LInvokeFunction(function);
1122 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1111 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1123 } 1112 }
1124 1113
1125 1114
1126 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1115 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1127 BuiltinFunctionId op = instr->op(); 1116 switch (instr->op()) {
1128 if (op == kMathLog || op == kMathSin || op == kMathCos || op == kMathTan) { 1117 case kMathFloor: return DoMathFloor(instr);
1129 LOperand* input = UseFixedDouble(instr->value(), d2); 1118 case kMathRound: return DoMathRound(instr);
1130 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, NULL); 1119 case kMathAbs: return DoMathAbs(instr);
1131 return MarkAsCall(DefineFixedDouble(result, d2), instr); 1120 case kMathLog: return DoMathLog(instr);
1132 } else if (op == kMathExp) { 1121 case kMathSin: return DoMathSin(instr);
1133 ASSERT(instr->representation().IsDouble()); 1122 case kMathCos: return DoMathCos(instr);
1134 ASSERT(instr->value()->representation().IsDouble()); 1123 case kMathTan: return DoMathTan(instr);
1135 LOperand* input = UseTempRegister(instr->value()); 1124 case kMathExp: return DoMathExp(instr);
1136 LOperand* temp1 = TempRegister(); 1125 case kMathSqrt: return DoMathSqrt(instr);
1137 LOperand* temp2 = TempRegister(); 1126 case kMathPowHalf: return DoMathPowHalf(instr);
1138 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. 1127 default:
1139 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); 1128 UNREACHABLE();
1140 return DefineAsRegister(result); 1129 return NULL;
1141 } else if (op == kMathPowHalf) { 1130 }
1142 LOperand* input = UseFixedDouble(instr->value(), d2); 1131 }
1143 LOperand* temp = FixedTemp(d3);
1144 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
1145 return DefineFixedDouble(result, d2);
1146 } else {
1147 LOperand* input = UseRegister(instr->value());
1148 1132
1149 LOperand* temp = (op == kMathRound) ? FixedTemp(d3) : NULL; 1133
1150 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); 1134 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1151 switch (op) { 1135 LOperand* input = UseRegister(instr->value());
1152 case kMathAbs: 1136 LMathFloor* result = new(zone()) LMathFloor(input);
1153 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1137 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1154 case kMathFloor: 1138 }
1155 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1139
1156 case kMathSqrt: 1140
1157 return DefineAsRegister(result); 1141 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1158 case kMathRound: 1142 LOperand* input = UseRegister(instr->value());
1159 return AssignEnvironment(DefineAsRegister(result)); 1143 LOperand* temp = FixedTemp(d3);
1160 default: 1144 LMathRound* result = new(zone()) LMathRound(input, temp);
1161 UNREACHABLE(); 1145 return AssignEnvironment(DefineAsRegister(result));
1162 return NULL; 1146 }
1163 } 1147
1164 } 1148
1149 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1150 LOperand* input = UseRegister(instr->value());
1151 LMathAbs* result = new(zone()) LMathAbs(input);
1152 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1153 }
1154
1155
1156 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1157 LOperand* input = UseFixedDouble(instr->value(), d2);
1158 LMathLog* result = new(zone()) LMathLog(input);
1159 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1160 }
1161
1162
1163 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1164 LOperand* input = UseFixedDouble(instr->value(), d2);
1165 LMathSin* result = new(zone()) LMathSin(input);
1166 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1167 }
1168
1169
1170 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1171 LOperand* input = UseFixedDouble(instr->value(), d2);
1172 LMathCos* result = new(zone()) LMathCos(input);
1173 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1174 }
1175
1176
1177 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1178 LOperand* input = UseFixedDouble(instr->value(), d2);
1179 LMathTan* result = new(zone()) LMathTan(input);
1180 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1181 }
1182
1183
1184 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1185 ASSERT(instr->representation().IsDouble());
1186 ASSERT(instr->value()->representation().IsDouble());
1187 LOperand* input = UseTempRegister(instr->value());
1188 LOperand* temp1 = TempRegister();
1189 LOperand* temp2 = TempRegister();
1190 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll.
1191 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2);
1192 return DefineAsRegister(result);
1193 }
1194
1195
1196 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1197 LOperand* input = UseRegister(instr->value());
1198 LMathSqrt* result = new(zone()) LMathSqrt(input);
1199 return DefineAsRegister(result);
1200 }
1201
1202
1203 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1204 LOperand* input = UseFixedDouble(instr->value(), d2);
1205 LOperand* temp = FixedTemp(d3);
1206 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp);
1207 return DefineFixedDouble(result, d2);
1165 } 1208 }
1166 1209
1167 1210
1168 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1211 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1169 ASSERT(instr->key()->representation().IsTagged()); 1212 ASSERT(instr->key()->representation().IsTagged());
1170 argument_count_ -= instr->argument_count(); 1213 argument_count_ -= instr->argument_count();
1171 LOperand* key = UseFixed(instr->key(), r2); 1214 LOperand* key = UseFixed(instr->key(), r2);
1172 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), r0), instr); 1215 return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), r0), instr);
1173 } 1216 }
1174 1217
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 2594
2552 2595
2553 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2596 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2554 LOperand* object = UseRegister(instr->object()); 2597 LOperand* object = UseRegister(instr->object());
2555 LOperand* index = UseRegister(instr->index()); 2598 LOperand* index = UseRegister(instr->index());
2556 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2599 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2557 } 2600 }
2558 2601
2559 2602
2560 } } // namespace v8::internal 2603 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698