| OLD | NEW | 
|---|
| 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  Loading... | 
| 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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1116 | 1105 | 
| 1117 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1106 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 
| 1118   LOperand* function = UseFixed(instr->function(), a1); | 1107   LOperand* function = UseFixed(instr->function(), a1); | 
| 1119   argument_count_ -= instr->argument_count(); | 1108   argument_count_ -= instr->argument_count(); | 
| 1120   LInvokeFunction* result = new(zone()) LInvokeFunction(function); | 1109   LInvokeFunction* result = new(zone()) LInvokeFunction(function); | 
| 1121   return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1110   return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 
| 1122 } | 1111 } | 
| 1123 | 1112 | 
| 1124 | 1113 | 
| 1125 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1114 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 
| 1126   BuiltinFunctionId op = instr->op(); | 1115   switch (instr->op()) { | 
| 1127   if (op == kMathLog || op == kMathSin || op == kMathCos || op == kMathTan) { | 1116     case kMathFloor: return DoMathFloor(instr); | 
| 1128     LOperand* input = UseFixedDouble(instr->value(), f4); | 1117     case kMathRound: return DoMathRound(instr); | 
| 1129     LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, NULL); | 1118     case kMathAbs: return DoMathAbs(instr); | 
| 1130     return MarkAsCall(DefineFixedDouble(result, f4), instr); | 1119     case kMathLog: return DoMathLog(instr); | 
| 1131   } else if (op == kMathExp) { | 1120     case kMathSin: return DoMathSin(instr); | 
| 1132     ASSERT(instr->representation().IsDouble()); | 1121     case kMathCos: return DoMathCos(instr); | 
| 1133     ASSERT(instr->value()->representation().IsDouble()); | 1122     case kMathTan: return DoMathTan(instr); | 
| 1134     LOperand* input = UseTempRegister(instr->value()); | 1123     case kMathExp: return DoMathExp(instr); | 
| 1135     LOperand* temp1 = TempRegister(); | 1124     case kMathSqrt: return DoMathSqrt(instr); | 
| 1136     LOperand* temp2 = TempRegister(); | 1125     case kMathPowHalf: return DoMathPowHalf(instr); | 
| 1137     LOperand* double_temp = FixedTemp(f6);  // Chosen by fair dice roll. | 1126     default: | 
| 1138     LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1127       UNREACHABLE(); | 
| 1139     return DefineAsRegister(result); | 1128       return NULL; | 
| 1140   } else if (op == kMathPowHalf) { | 1129   } | 
| 1141     // Input cannot be the same as the result. | 1130 } | 
| 1142     // See lithium-codegen-mips.cc::DoMathPowHalf. |  | 
| 1143     LOperand* input = UseFixedDouble(instr->value(), f8); |  | 
| 1144     LOperand* temp = FixedTemp(f6); |  | 
| 1145     LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); |  | 
| 1146     return DefineFixedDouble(result, f4); |  | 
| 1147   } else { |  | 
| 1148     LOperand* input = UseRegister(instr->value()); |  | 
| 1149 | 1131 | 
| 1150     LOperand* temp = (op == kMathRound) ? FixedTemp(f6) : | 1132 | 
| 1151         (op == kMathFloor) ? TempRegister() : NULL; | 1133 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 
| 1152     LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp); | 1134   LOperand* input = UseFixedDouble(instr->value(), f4); | 
| 1153     switch (op) { | 1135   LMathLog* result = new(zone()) LMathLog(input); | 
| 1154       case kMathAbs: | 1136   return MarkAsCall(DefineFixedDouble(result, f4), instr); | 
| 1155         return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1137 } | 
| 1156       case kMathFloor: | 1138 | 
| 1157         return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1139 | 
| 1158       case kMathSqrt: | 1140 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) { | 
| 1159         return DefineAsRegister(result); | 1141   LOperand* input = UseFixedDouble(instr->value(), f4); | 
| 1160       case kMathRound: | 1142   LMathSin* result = new(zone()) LMathSin(input); | 
| 1161         return AssignEnvironment(DefineAsRegister(result)); | 1143   return MarkAsCall(DefineFixedDouble(result, f4), instr); | 
| 1162       default: | 1144 } | 
| 1163         UNREACHABLE(); | 1145 | 
| 1164         return NULL; | 1146 | 
| 1165     } | 1147 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) { | 
| 1166   } | 1148   LOperand* input = UseFixedDouble(instr->value(), f4); | 
|  | 1149   LMathCos* result = new(zone()) LMathCos(input); | 
|  | 1150   return MarkAsCall(DefineFixedDouble(result, f4), instr); | 
|  | 1151 } | 
|  | 1152 | 
|  | 1153 | 
|  | 1154 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) { | 
|  | 1155   LOperand* input = UseFixedDouble(instr->value(), f4); | 
|  | 1156   LMathTan* result = new(zone()) LMathTan(input); | 
|  | 1157   return MarkAsCall(DefineFixedDouble(result, f4), instr); | 
|  | 1158 } | 
|  | 1159 | 
|  | 1160 | 
|  | 1161 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 
|  | 1162   ASSERT(instr->representation().IsDouble()); | 
|  | 1163   ASSERT(instr->value()->representation().IsDouble()); | 
|  | 1164   LOperand* input = UseTempRegister(instr->value()); | 
|  | 1165   LOperand* temp1 = TempRegister(); | 
|  | 1166   LOperand* temp2 = TempRegister(); | 
|  | 1167   LOperand* double_temp = FixedTemp(f6);  // Chosen by fair dice roll. | 
|  | 1168   LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 
|  | 1169   return DefineAsRegister(result); | 
|  | 1170 } | 
|  | 1171 | 
|  | 1172 | 
|  | 1173 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 
|  | 1174   // Input cannot be the same as the result, see LCodeGen::DoMathPowHalf. | 
|  | 1175   LOperand* input = UseFixedDouble(instr->value(), f8); | 
|  | 1176   LOperand* temp = FixedTemp(f6); | 
|  | 1177   LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); | 
|  | 1178   return DefineFixedDouble(result, f4); | 
|  | 1179 } | 
|  | 1180 | 
|  | 1181 | 
|  | 1182 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 
|  | 1183   LOperand* input = UseRegister(instr->value()); | 
|  | 1184   LMathAbs* result = new(zone()) LMathAbs(input); | 
|  | 1185   return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 
|  | 1186 } | 
|  | 1187 | 
|  | 1188 | 
|  | 1189 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { | 
|  | 1190   LOperand* input = UseRegister(instr->value()); | 
|  | 1191   LOperand* temp = TempRegister(); | 
|  | 1192   LMathFloor* result = new(zone()) LMathFloor(input, temp); | 
|  | 1193   return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 
|  | 1194 } | 
|  | 1195 | 
|  | 1196 | 
|  | 1197 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { | 
|  | 1198   LOperand* input = UseRegister(instr->value()); | 
|  | 1199   LMathSqrt* result = new(zone()) LMathSqrt(input); | 
|  | 1200   return DefineAsRegister(result); | 
|  | 1201 } | 
|  | 1202 | 
|  | 1203 | 
|  | 1204 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { | 
|  | 1205   LOperand* input = UseRegister(instr->value()); | 
|  | 1206   LOperand* temp = FixedTemp(f6); | 
|  | 1207   LMathRound* result = new(zone()) LMathRound(input, temp); | 
|  | 1208   return AssignEnvironment(DefineAsRegister(result)); | 
| 1167 } | 1209 } | 
| 1168 | 1210 | 
| 1169 | 1211 | 
| 1170 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1212 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 
| 1171   ASSERT(instr->key()->representation().IsTagged()); | 1213   ASSERT(instr->key()->representation().IsTagged()); | 
| 1172   argument_count_ -= instr->argument_count(); | 1214   argument_count_ -= instr->argument_count(); | 
| 1173   LOperand* key = UseFixed(instr->key(), a2); | 1215   LOperand* key = UseFixed(instr->key(), a2); | 
| 1174   return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), v0), instr); | 1216   return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), v0), instr); | 
| 1175 } | 1217 } | 
| 1176 | 1218 | 
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2436 | 2478 | 
| 2437 | 2479 | 
| 2438 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2480 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 
| 2439   LOperand* object = UseRegister(instr->object()); | 2481   LOperand* object = UseRegister(instr->object()); | 
| 2440   LOperand* index = UseRegister(instr->index()); | 2482   LOperand* index = UseRegister(instr->index()); | 
| 2441   return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2483   return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 
| 2442 } | 2484 } | 
| 2443 | 2485 | 
| 2444 | 2486 | 
| 2445 } }  // namespace v8::internal | 2487 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|