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

Side by Side Diff: src/x64/lithium-x64.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/x64/lithium-x64.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 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 base_object()->PrintTo(stream); 297 base_object()->PrintTo(stream);
298 stream->Add(" + %d", offset()); 298 stream->Add(" + %d", offset());
299 } 299 }
300 300
301 301
302 void LCallConstantFunction::PrintDataTo(StringStream* stream) { 302 void LCallConstantFunction::PrintDataTo(StringStream* stream) {
303 stream->Add("#%d / ", arity()); 303 stream->Add("#%d / ", arity());
304 } 304 }
305 305
306 306
307 void LUnaryMathOperation::PrintDataTo(StringStream* stream) {
308 stream->Add("/%s ", hydrogen()->OpName());
309 value()->PrintTo(stream);
310 }
311
312
313 void LMathExp::PrintDataTo(StringStream* stream) {
314 value()->PrintTo(stream);
315 }
316
317
318 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 307 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
319 context()->PrintTo(stream); 308 context()->PrintTo(stream);
320 stream->Add("[%d]", slot_index()); 309 stream->Add("[%d]", slot_index());
321 } 310 }
322 311
323 312
324 void LStoreContextSlot::PrintDataTo(StringStream* stream) { 313 void LStoreContextSlot::PrintDataTo(StringStream* stream) {
325 context()->PrintTo(stream); 314 context()->PrintTo(stream);
326 stream->Add("[%d] <- ", slot_index()); 315 stream->Add("[%d] <- ", slot_index());
327 value()->PrintTo(stream); 316 value()->PrintTo(stream);
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 1112
1124 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1113 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1125 LOperand* function = UseFixed(instr->function(), rdi); 1114 LOperand* function = UseFixed(instr->function(), rdi);
1126 argument_count_ -= instr->argument_count(); 1115 argument_count_ -= instr->argument_count();
1127 LInvokeFunction* result = new(zone()) LInvokeFunction(function); 1116 LInvokeFunction* result = new(zone()) LInvokeFunction(function);
1128 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1117 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1129 } 1118 }
1130 1119
1131 1120
1132 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1121 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1133 BuiltinFunctionId op = instr->op(); 1122 switch (instr->op()) {
1134 if (op == kMathLog || op == kMathSin || op == kMathCos || op == kMathTan) { 1123 case kMathFloor: return DoMathFloor(instr);
1135 LOperand* input = UseFixedDouble(instr->value(), xmm1); 1124 case kMathRound: return DoMathRound(instr);
1136 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input); 1125 case kMathAbs: return DoMathAbs(instr);
1137 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); 1126 case kMathLog: return DoMathLog(instr);
1138 } else if (op == kMathExp) { 1127 case kMathSin: return DoMathSin(instr);
1139 ASSERT(instr->representation().IsDouble()); 1128 case kMathCos: return DoMathCos(instr);
1140 ASSERT(instr->value()->representation().IsDouble()); 1129 case kMathTan: return DoMathTan(instr);
1141 LOperand* value = UseTempRegister(instr->value()); 1130 case kMathExp: return DoMathExp(instr);
1142 LOperand* temp1 = TempRegister(); 1131 case kMathSqrt: return DoMathSqrt(instr);
1143 LOperand* temp2 = TempRegister(); 1132 case kMathPowHalf: return DoMathPowHalf(instr);
1144 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); 1133 default:
1145 return DefineAsRegister(result); 1134 UNREACHABLE();
1146 } else { 1135 return NULL;
1147 LOperand* input = UseRegisterAtStart(instr->value());
1148 LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input);
1149 switch (op) {
1150 case kMathAbs:
1151 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1152 case kMathFloor:
1153 return AssignEnvironment(DefineAsRegister(result));
1154 case kMathRound:
1155 return AssignEnvironment(DefineAsRegister(result));
1156 case kMathSqrt:
1157 return DefineSameAsFirst(result);
1158 case kMathPowHalf:
1159 return DefineSameAsFirst(result);
1160 default:
1161 UNREACHABLE();
1162 return NULL;
1163 }
1164 } 1136 }
1165 } 1137 }
1166 1138
1167 1139
1140 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1141 LOperand* input = UseRegisterAtStart(instr->value());
1142 LMathFloor* result = new(zone()) LMathFloor(input);
1143 return AssignEnvironment(DefineAsRegister(result));
1144 }
1145
1146
1147 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1148 LOperand* input = UseRegisterAtStart(instr->value());
1149 LMathRound* result = new(zone()) LMathRound(input);
1150 return AssignEnvironment(DefineAsRegister(result));
1151 }
1152
1153 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1154 LOperand* input = UseRegisterAtStart(instr->value());
1155 LMathAbs* result = new(zone()) LMathAbs(input);
1156 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1157 }
1158
1159
1160 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1161 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1162 LMathLog* result = new(zone()) LMathLog(input);
1163 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1164 }
1165
1166
1167 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1168 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1169 LMathSin* result = new(zone()) LMathSin(input);
1170 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1171 }
1172
1173
1174 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1175 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1176 LMathCos* result = new(zone()) LMathCos(input);
1177 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1178 }
1179
1180
1181 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1182 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1183 LMathTan* result = new(zone()) LMathTan(input);
1184 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1185 }
1186
1187
1188 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1189 ASSERT(instr->representation().IsDouble());
1190 ASSERT(instr->value()->representation().IsDouble());
1191 LOperand* value = UseTempRegister(instr->value());
1192 LOperand* temp1 = TempRegister();
1193 LOperand* temp2 = TempRegister();
1194 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2);
1195 return DefineAsRegister(result);
1196 }
1197
1198
1199 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1200 LOperand* input = UseRegisterAtStart(instr->value());
1201 LMathSqrt* result = new(zone()) LMathSqrt(input);
1202 return DefineSameAsFirst(result);
1203 }
1204
1205
1206 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1207 LOperand* input = UseRegisterAtStart(instr->value());
1208 LMathPowHalf* result = new(zone()) LMathPowHalf(input);
1209 return DefineSameAsFirst(result);
1210 }
1211
1212
1168 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1213 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1169 ASSERT(instr->key()->representation().IsTagged()); 1214 ASSERT(instr->key()->representation().IsTagged());
1170 LOperand* key = UseFixed(instr->key(), rcx); 1215 LOperand* key = UseFixed(instr->key(), rcx);
1171 argument_count_ -= instr->argument_count(); 1216 argument_count_ -= instr->argument_count();
1172 LCallKeyed* result = new(zone()) LCallKeyed(key); 1217 LCallKeyed* result = new(zone()) LCallKeyed(key);
1173 return MarkAsCall(DefineFixed(result, rax), instr); 1218 return MarkAsCall(DefineFixed(result, rax), instr);
1174 } 1219 }
1175 1220
1176 1221
1177 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { 1222 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2520 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2476 LOperand* object = UseRegister(instr->object()); 2521 LOperand* object = UseRegister(instr->object());
2477 LOperand* index = UseTempRegister(instr->index()); 2522 LOperand* index = UseTempRegister(instr->index());
2478 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2523 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2479 } 2524 }
2480 2525
2481 2526
2482 } } // namespace v8::internal 2527 } } // namespace v8::internal
2483 2528
2484 #endif // V8_TARGET_ARCH_X64 2529 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698