| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 *hydrogen()->class_name(), | 252 *hydrogen()->class_name(), |
| 253 true_block_id(), | 253 true_block_id(), |
| 254 false_block_id()); | 254 false_block_id()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 258 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
| 259 stream->Add("if typeof "); | 259 stream->Add("if typeof "); |
| 260 value()->PrintTo(stream); | 260 value()->PrintTo(stream); |
| 261 stream->Add(" == \"%s\" then B%d else B%d", | 261 stream->Add(" == \"%s\" then B%d else B%d", |
| 262 *hydrogen()->type_literal()->ToCString(), | 262 hydrogen()->type_literal()->ToCString().get(), |
| 263 true_block_id(), false_block_id()); | 263 true_block_id(), false_block_id()); |
| 264 } | 264 } |
| 265 | 265 |
| 266 | 266 |
| 267 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { | 267 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { |
| 268 stream->Add(" = "); | 268 stream->Add(" = "); |
| 269 function()->PrintTo(stream); | 269 function()->PrintTo(stream); |
| 270 stream->Add(".code_entry = "); | 270 stream->Add(".code_entry = "); |
| 271 code_object()->PrintTo(stream); | 271 code_object()->PrintTo(stream); |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 275 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
| 276 stream->Add(" = "); | 276 stream->Add(" = "); |
| 277 base_object()->PrintTo(stream); | 277 base_object()->PrintTo(stream); |
| 278 stream->Add(" + %d", offset()); | 278 stream->Add(" + "); |
| 279 offset()->PrintTo(stream); |
| 279 } | 280 } |
| 280 | 281 |
| 281 | 282 |
| 282 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 283 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 283 stream->Add("#%d / ", arity()); | 284 stream->Add("#%d / ", arity()); |
| 284 } | 285 } |
| 285 | 286 |
| 286 | 287 |
| 287 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 288 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 288 context()->PrintTo(stream); | 289 context()->PrintTo(stream); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 304 } | 305 } |
| 305 | 306 |
| 306 | 307 |
| 307 void LCallKeyed::PrintDataTo(StringStream* stream) { | 308 void LCallKeyed::PrintDataTo(StringStream* stream) { |
| 308 stream->Add("[rcx] #%d / ", arity()); | 309 stream->Add("[rcx] #%d / ", arity()); |
| 309 } | 310 } |
| 310 | 311 |
| 311 | 312 |
| 312 void LCallNamed::PrintDataTo(StringStream* stream) { | 313 void LCallNamed::PrintDataTo(StringStream* stream) { |
| 313 SmartArrayPointer<char> name_string = name()->ToCString(); | 314 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 314 stream->Add("%s #%d / ", *name_string, arity()); | 315 stream->Add("%s #%d / ", name_string.get(), arity()); |
| 315 } | 316 } |
| 316 | 317 |
| 317 | 318 |
| 318 void LCallGlobal::PrintDataTo(StringStream* stream) { | 319 void LCallGlobal::PrintDataTo(StringStream* stream) { |
| 319 SmartArrayPointer<char> name_string = name()->ToCString(); | 320 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 320 stream->Add("%s #%d / ", *name_string, arity()); | 321 stream->Add("%s #%d / ", name_string.get(), arity()); |
| 321 } | 322 } |
| 322 | 323 |
| 323 | 324 |
| 324 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 325 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { |
| 325 stream->Add("#%d / ", arity()); | 326 stream->Add("#%d / ", arity()); |
| 326 } | 327 } |
| 327 | 328 |
| 328 | 329 |
| 329 void LCallNew::PrintDataTo(StringStream* stream) { | 330 void LCallNew::PrintDataTo(StringStream* stream) { |
| 330 stream->Add("= "); | 331 stream->Add("= "); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 object()->PrintTo(stream); | 377 object()->PrintTo(stream); |
| 377 hydrogen()->access().PrintTo(stream); | 378 hydrogen()->access().PrintTo(stream); |
| 378 stream->Add(" <- "); | 379 stream->Add(" <- "); |
| 379 value()->PrintTo(stream); | 380 value()->PrintTo(stream); |
| 380 } | 381 } |
| 381 | 382 |
| 382 | 383 |
| 383 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { | 384 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { |
| 384 object()->PrintTo(stream); | 385 object()->PrintTo(stream); |
| 385 stream->Add("."); | 386 stream->Add("."); |
| 386 stream->Add(*String::cast(*name())->ToCString()); | 387 stream->Add(String::cast(*name())->ToCString().get()); |
| 387 stream->Add(" <- "); | 388 stream->Add(" <- "); |
| 388 value()->PrintTo(stream); | 389 value()->PrintTo(stream); |
| 389 } | 390 } |
| 390 | 391 |
| 391 | 392 |
| 392 void LLoadKeyed::PrintDataTo(StringStream* stream) { | 393 void LLoadKeyed::PrintDataTo(StringStream* stream) { |
| 393 elements()->PrintTo(stream); | 394 elements()->PrintTo(stream); |
| 394 stream->Add("["); | 395 stream->Add("["); |
| 395 key()->PrintTo(stream); | 396 key()->PrintTo(stream); |
| 396 if (hydrogen()->IsDehoisted()) { | 397 if (hydrogen()->IsDehoisted()) { |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 | 1110 |
| 1110 LInstruction* LChunkBuilder::DoStoreCodeEntry( | 1111 LInstruction* LChunkBuilder::DoStoreCodeEntry( |
| 1111 HStoreCodeEntry* store_code_entry) { | 1112 HStoreCodeEntry* store_code_entry) { |
| 1112 LOperand* function = UseRegister(store_code_entry->function()); | 1113 LOperand* function = UseRegister(store_code_entry->function()); |
| 1113 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); | 1114 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); |
| 1114 return new(zone()) LStoreCodeEntry(function, code_object); | 1115 return new(zone()) LStoreCodeEntry(function, code_object); |
| 1115 } | 1116 } |
| 1116 | 1117 |
| 1117 | 1118 |
| 1118 LInstruction* LChunkBuilder::DoInnerAllocatedObject( | 1119 LInstruction* LChunkBuilder::DoInnerAllocatedObject( |
| 1119 HInnerAllocatedObject* inner_object) { | 1120 HInnerAllocatedObject* instr) { |
| 1120 LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); | 1121 LOperand* base_object = UseRegisterAtStart(instr->base_object()); |
| 1121 LInnerAllocatedObject* result = | 1122 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset()); |
| 1122 new(zone()) LInnerAllocatedObject(base_object); | 1123 return DefineAsRegister( |
| 1123 return DefineAsRegister(result); | 1124 new(zone()) LInnerAllocatedObject(base_object, offset)); |
| 1124 } | 1125 } |
| 1125 | 1126 |
| 1126 | 1127 |
| 1127 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1128 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
| 1128 return instr->HasNoUses() | 1129 return instr->HasNoUses() |
| 1129 ? NULL | 1130 ? NULL |
| 1130 : DefineAsRegister(new(zone()) LThisFunction); | 1131 : DefineAsRegister(new(zone()) LThisFunction); |
| 1131 } | 1132 } |
| 1132 | 1133 |
| 1133 | 1134 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1180 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1180 } | 1181 } |
| 1181 | 1182 |
| 1182 | 1183 |
| 1183 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1184 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1184 switch (instr->op()) { | 1185 switch (instr->op()) { |
| 1185 case kMathFloor: return DoMathFloor(instr); | 1186 case kMathFloor: return DoMathFloor(instr); |
| 1186 case kMathRound: return DoMathRound(instr); | 1187 case kMathRound: return DoMathRound(instr); |
| 1187 case kMathAbs: return DoMathAbs(instr); | 1188 case kMathAbs: return DoMathAbs(instr); |
| 1188 case kMathLog: return DoMathLog(instr); | 1189 case kMathLog: return DoMathLog(instr); |
| 1189 case kMathSin: return DoMathSin(instr); | |
| 1190 case kMathCos: return DoMathCos(instr); | |
| 1191 case kMathTan: return DoMathTan(instr); | |
| 1192 case kMathExp: return DoMathExp(instr); | 1190 case kMathExp: return DoMathExp(instr); |
| 1193 case kMathSqrt: return DoMathSqrt(instr); | 1191 case kMathSqrt: return DoMathSqrt(instr); |
| 1194 case kMathPowHalf: return DoMathPowHalf(instr); | 1192 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1195 default: | 1193 default: |
| 1196 UNREACHABLE(); | 1194 UNREACHABLE(); |
| 1197 return NULL; | 1195 return NULL; |
| 1198 } | 1196 } |
| 1199 } | 1197 } |
| 1200 | 1198 |
| 1201 | 1199 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1223 | 1221 |
| 1224 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1222 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1225 ASSERT(instr->representation().IsDouble()); | 1223 ASSERT(instr->representation().IsDouble()); |
| 1226 ASSERT(instr->value()->representation().IsDouble()); | 1224 ASSERT(instr->value()->representation().IsDouble()); |
| 1227 LOperand* input = UseRegisterAtStart(instr->value()); | 1225 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1228 LMathLog* result = new(zone()) LMathLog(input); | 1226 LMathLog* result = new(zone()) LMathLog(input); |
| 1229 return DefineSameAsFirst(result); | 1227 return DefineSameAsFirst(result); |
| 1230 } | 1228 } |
| 1231 | 1229 |
| 1232 | 1230 |
| 1233 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) { | |
| 1234 LOperand* input = UseFixedDouble(instr->value(), xmm1); | |
| 1235 LMathSin* result = new(zone()) LMathSin(input); | |
| 1236 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | |
| 1237 } | |
| 1238 | |
| 1239 | |
| 1240 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) { | |
| 1241 LOperand* input = UseFixedDouble(instr->value(), xmm1); | |
| 1242 LMathCos* result = new(zone()) LMathCos(input); | |
| 1243 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | |
| 1244 } | |
| 1245 | |
| 1246 | |
| 1247 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) { | |
| 1248 LOperand* input = UseFixedDouble(instr->value(), xmm1); | |
| 1249 LMathTan* result = new(zone()) LMathTan(input); | |
| 1250 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | |
| 1251 } | |
| 1252 | |
| 1253 | |
| 1254 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1231 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1255 ASSERT(instr->representation().IsDouble()); | 1232 ASSERT(instr->representation().IsDouble()); |
| 1256 ASSERT(instr->value()->representation().IsDouble()); | 1233 ASSERT(instr->value()->representation().IsDouble()); |
| 1257 LOperand* value = UseTempRegister(instr->value()); | 1234 LOperand* value = UseTempRegister(instr->value()); |
| 1258 LOperand* temp1 = TempRegister(); | 1235 LOperand* temp1 = TempRegister(); |
| 1259 LOperand* temp2 = TempRegister(); | 1236 LOperand* temp2 = TempRegister(); |
| 1260 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); | 1237 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); |
| 1261 return DefineAsRegister(result); | 1238 return DefineAsRegister(result); |
| 1262 } | 1239 } |
| 1263 | 1240 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 : UseOrConstantAtStart(right_candidate); | 1527 : UseOrConstantAtStart(right_candidate); |
| 1551 LAddI* add = new(zone()) LAddI(left, right); | 1528 LAddI* add = new(zone()) LAddI(left, right); |
| 1552 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); | 1529 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); |
| 1553 LInstruction* result = use_lea | 1530 LInstruction* result = use_lea |
| 1554 ? DefineAsRegister(add) | 1531 ? DefineAsRegister(add) |
| 1555 : DefineSameAsFirst(add); | 1532 : DefineSameAsFirst(add); |
| 1556 if (can_overflow) { | 1533 if (can_overflow) { |
| 1557 result = AssignEnvironment(result); | 1534 result = AssignEnvironment(result); |
| 1558 } | 1535 } |
| 1559 return result; | 1536 return result; |
| 1537 } else if (instr->representation().IsExternal()) { |
| 1538 ASSERT(instr->left()->representation().IsExternal()); |
| 1539 ASSERT(instr->right()->representation().IsInteger32()); |
| 1540 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); |
| 1541 bool use_lea = LAddI::UseLea(instr); |
| 1542 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1543 HValue* right_candidate = instr->right(); |
| 1544 LOperand* right = use_lea |
| 1545 ? UseRegisterOrConstantAtStart(right_candidate) |
| 1546 : UseOrConstantAtStart(right_candidate); |
| 1547 LAddI* add = new(zone()) LAddI(left, right); |
| 1548 LInstruction* result = use_lea |
| 1549 ? DefineAsRegister(add) |
| 1550 : DefineSameAsFirst(add); |
| 1551 return result; |
| 1560 } else if (instr->representation().IsDouble()) { | 1552 } else if (instr->representation().IsDouble()) { |
| 1561 return DoArithmeticD(Token::ADD, instr); | 1553 return DoArithmeticD(Token::ADD, instr); |
| 1562 } else { | 1554 } else { |
| 1563 return DoArithmeticT(Token::ADD, instr); | 1555 return DoArithmeticT(Token::ADD, instr); |
| 1564 } | 1556 } |
| 1565 return NULL; | 1557 return NULL; |
| 1566 } | 1558 } |
| 1567 | 1559 |
| 1568 | 1560 |
| 1569 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1561 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 HTransitionElementsKind* instr) { | 2236 HTransitionElementsKind* instr) { |
| 2245 LOperand* object = UseRegister(instr->object()); | 2237 LOperand* object = UseRegister(instr->object()); |
| 2246 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { | 2238 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
| 2247 LOperand* object = UseRegister(instr->object()); | 2239 LOperand* object = UseRegister(instr->object()); |
| 2248 LOperand* new_map_reg = TempRegister(); | 2240 LOperand* new_map_reg = TempRegister(); |
| 2249 LOperand* temp_reg = TempRegister(); | 2241 LOperand* temp_reg = TempRegister(); |
| 2250 LTransitionElementsKind* result = new(zone()) LTransitionElementsKind( | 2242 LTransitionElementsKind* result = new(zone()) LTransitionElementsKind( |
| 2251 object, NULL, new_map_reg, temp_reg); | 2243 object, NULL, new_map_reg, temp_reg); |
| 2252 return result; | 2244 return result; |
| 2253 } else { | 2245 } else { |
| 2254 LOperand* context = UseAny(instr->context()); | 2246 LOperand* context = UseFixed(instr->context(), rsi); |
| 2255 LTransitionElementsKind* result = | 2247 LTransitionElementsKind* result = |
| 2256 new(zone()) LTransitionElementsKind(object, context, NULL, NULL); | 2248 new(zone()) LTransitionElementsKind(object, context, NULL, NULL); |
| 2257 return AssignPointerMap(result); | 2249 return AssignPointerMap(result); |
| 2258 } | 2250 } |
| 2259 } | 2251 } |
| 2260 | 2252 |
| 2261 | 2253 |
| 2262 LInstruction* LChunkBuilder::DoTrapAllocationMemento( | 2254 LInstruction* LChunkBuilder::DoTrapAllocationMemento( |
| 2263 HTrapAllocationMemento* instr) { | 2255 HTrapAllocationMemento* instr) { |
| 2264 LOperand* object = UseRegister(instr->object()); | 2256 LOperand* object = UseRegister(instr->object()); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2608 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2600 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2609 LOperand* object = UseRegister(instr->object()); | 2601 LOperand* object = UseRegister(instr->object()); |
| 2610 LOperand* index = UseTempRegister(instr->index()); | 2602 LOperand* index = UseTempRegister(instr->index()); |
| 2611 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2603 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2612 } | 2604 } |
| 2613 | 2605 |
| 2614 | 2606 |
| 2615 } } // namespace v8::internal | 2607 } } // namespace v8::internal |
| 2616 | 2608 |
| 2617 #endif // V8_TARGET_ARCH_X64 | 2609 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |