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

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

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 HInstruction* hinstr, 672 HInstruction* hinstr,
673 CanDeoptimize can_deoptimize) { 673 CanDeoptimize can_deoptimize) {
674 info()->MarkAsNonDeferredCalling(); 674 info()->MarkAsNonDeferredCalling();
675 675
676 #ifdef DEBUG 676 #ifdef DEBUG
677 instr->VerifyCall(); 677 instr->VerifyCall();
678 #endif 678 #endif
679 instr->MarkAsCall(); 679 instr->MarkAsCall();
680 instr = AssignPointerMap(instr); 680 instr = AssignPointerMap(instr);
681 681
682 if (hinstr->HasObservableSideEffects()) {
683 ASSERT(hinstr->next()->IsSimulate());
684 HSimulate* sim = HSimulate::cast(hinstr->next());
685 ASSERT(instruction_pending_deoptimization_environment_ == NULL);
686 ASSERT(pending_deoptimization_ast_id_.IsNone());
687 instruction_pending_deoptimization_environment_ = instr;
688 pending_deoptimization_ast_id_ = sim->ast_id();
689 }
690
691 // If instruction does not have side-effects lazy deoptimization 682 // If instruction does not have side-effects lazy deoptimization
692 // after the call will try to deoptimize to the point before the call. 683 // after the call will try to deoptimize to the point before the call.
693 // Thus we still need to attach environment to this call even if 684 // Thus we still need to attach environment to this call even if
694 // call sequence can not deoptimize eagerly. 685 // call sequence can not deoptimize eagerly.
695 bool needs_environment = 686 bool needs_environment =
696 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || 687 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) ||
697 !hinstr->HasObservableSideEffects(); 688 !hinstr->HasObservableSideEffects();
698 if (needs_environment && !instr->HasEnvironment()) { 689 if (needs_environment && !instr->HasEnvironment()) {
699 instr = AssignEnvironment(instr); 690 instr = AssignEnvironment(instr);
700 } 691 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 LGoto::cast(instr)->jumps_to_join()) { 964 LGoto::cast(instr)->jumps_to_join()) {
974 // TODO(olivf) Since phis of spilled values are joined as registers 965 // TODO(olivf) Since phis of spilled values are joined as registers
975 // (not in the stack slot), we need to allow the goto gaps to keep one 966 // (not in the stack slot), we need to allow the goto gaps to keep one
976 // x87 register alive. To ensure all other values are still spilled, we 967 // x87 register alive. To ensure all other values are still spilled, we
977 // insert a fpu register barrier right before. 968 // insert a fpu register barrier right before.
978 LClobberDoubles* clobber = new(zone()) LClobberDoubles(); 969 LClobberDoubles* clobber = new(zone()) LClobberDoubles();
979 clobber->set_hydrogen_value(current); 970 clobber->set_hydrogen_value(current);
980 chunk_->AddInstruction(clobber, current_block_); 971 chunk_->AddInstruction(clobber, current_block_);
981 } 972 }
982 chunk_->AddInstruction(instr, current_block_); 973 chunk_->AddInstruction(instr, current_block_);
974
975 if (instr->IsCall()) {
976 HValue* hydrogen_value_for_lazy_bailout = current;
977 LInstruction* instruction_needing_environment = NULL;
978 if (current->HasObservableSideEffects()) {
979 HSimulate* sim = HSimulate::cast(current->next());
980 instruction_needing_environment = instr;
981 sim->ReplayEnvironment(current_block_->last_environment());
982 hydrogen_value_for_lazy_bailout = sim;
983 }
984 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
985 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
986 chunk_->AddInstruction(bailout, current_block_);
987 if (instruction_needing_environment != NULL) {
988 // Store the lazy deopt environment with the instruction if needed.
989 // Right now it is only used for LInstanceOfKnownGlobal.
990 instruction_needing_environment->
991 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
992 }
993 }
983 } 994 }
984 current_instruction_ = old_current; 995 current_instruction_ = old_current;
985 } 996 }
986 997
987 998
988 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 999 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
989 return new(zone()) LGoto(instr->FirstSuccessor()); 1000 return new(zone()) LGoto(instr->FirstSuccessor());
990 } 1001 }
991 1002
992 1003
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1325
1315 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); 1326 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1316 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); 1327 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1317 return DefineSameAsFirst(new(zone()) LBitI(left, right)); 1328 return DefineSameAsFirst(new(zone()) LBitI(left, right));
1318 } else { 1329 } else {
1319 return DoArithmeticT(instr->op(), instr); 1330 return DoArithmeticT(instr->op(), instr);
1320 } 1331 }
1321 } 1332 }
1322 1333
1323 1334
1335 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
1336 ASSERT(instr->representation().IsSmiOrInteger32());
1337 ASSERT(instr->left()->representation().Equals(instr->representation()));
1338 ASSERT(instr->right()->representation().Equals(instr->representation()));
1339 LOperand* dividend = UseRegister(instr->left());
1340 int32_t divisor = instr->right()->GetInteger32Constant();
1341 LInstruction* result = DefineAsRegister(new(zone()) LDivByPowerOf2I(
1342 dividend, divisor));
1343 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1344 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) ||
1345 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
1346 divisor != 1 && divisor != -1)) {
1347 result = AssignEnvironment(result);
1348 }
1349 return result;
1350 }
1351
1352
1353 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
1354 ASSERT(instr->representation().IsInteger32());
1355 ASSERT(instr->left()->representation().Equals(instr->representation()));
1356 ASSERT(instr->right()->representation().Equals(instr->representation()));
1357 LOperand* dividend = UseRegister(instr->left());
1358 int32_t divisor = instr->right()->GetInteger32Constant();
1359 LOperand* temp1 = FixedTemp(eax);
1360 LOperand* temp2 = FixedTemp(edx);
1361 LInstruction* result = DefineFixed(new(zone()) LDivByConstI(
1362 dividend, divisor, temp1, temp2), edx);
1363 if (divisor == 0 ||
1364 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1365 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1366 result = AssignEnvironment(result);
1367 }
1368 return result;
1369 }
1370
1371
1372 LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
1373 ASSERT(instr->representation().IsSmiOrInteger32());
1374 ASSERT(instr->left()->representation().Equals(instr->representation()));
1375 ASSERT(instr->right()->representation().Equals(instr->representation()));
1376 LOperand* dividend = UseFixed(instr->left(), eax);
1377 LOperand* divisor = UseRegister(instr->right());
1378 LOperand* temp = FixedTemp(edx);
1379 LInstruction* result = DefineFixed(new(zone()) LDivI(
1380 dividend, divisor, temp), eax);
1381 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1382 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1383 instr->CheckFlag(HValue::kCanOverflow) ||
1384 (!instr->IsMathFloorOfDiv() &&
1385 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) {
1386 result = AssignEnvironment(result);
1387 }
1388 return result;
1389 }
1390
1391
1324 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1392 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1325 if (instr->representation().IsSmiOrInteger32()) { 1393 if (instr->representation().IsSmiOrInteger32()) {
1326 ASSERT(instr->left()->representation().Equals(instr->representation()));
1327 ASSERT(instr->right()->representation().Equals(instr->representation()));
1328 if (instr->RightIsPowerOf2()) { 1394 if (instr->RightIsPowerOf2()) {
1329 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1395 return DoDivByPowerOf2I(instr);
1330 LOperand* value = UseRegister(instr->left()); 1396 } else if (instr->right()->IsConstant()) {
1331 LDivI* div = 1397 return DoDivByConstI(instr);
1332 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); 1398 } else {
1333 return AssignEnvironment(DefineAsRegister(div)); 1399 return DoDivI(instr);
1334 } 1400 }
1335 // The temporary operand is necessary to ensure that right is not allocated
1336 // into edx.
1337 LOperand* temp = FixedTemp(edx);
1338 LOperand* dividend = UseFixed(instr->left(), eax);
1339 LOperand* divisor = UseRegister(instr->right());
1340 LDivI* result = new(zone()) LDivI(dividend, divisor, temp);
1341 return AssignEnvironment(DefineFixed(result, eax));
1342 } else if (instr->representation().IsDouble()) { 1401 } else if (instr->representation().IsDouble()) {
1343 return DoArithmeticD(Token::DIV, instr); 1402 return DoArithmeticD(Token::DIV, instr);
1344 } else { 1403 } else {
1345 return DoArithmeticT(Token::DIV, instr); 1404 return DoArithmeticT(Token::DIV, instr);
1346 } 1405 }
1347 } 1406 }
1348 1407
1349 1408
1409 LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
1410 LOperand* dividend = UseRegisterAtStart(instr->left());
1411 int32_t divisor = instr->right()->GetInteger32Constant();
1412 LInstruction* result = DefineSameAsFirst(new(zone()) LFlooringDivByPowerOf2I(
1413 dividend, divisor));
1414 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1415 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) {
1416 result = AssignEnvironment(result);
1417 }
1418 return result;
1419 }
1420
1421
1422 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
1423 ASSERT(instr->representation().IsInteger32());
1424 ASSERT(instr->left()->representation().Equals(instr->representation()));
1425 ASSERT(instr->right()->representation().Equals(instr->representation()));
1426 LOperand* dividend = UseRegister(instr->left());
1427 int32_t divisor = instr->right()->GetInteger32Constant();
1428 LOperand* temp1 = FixedTemp(eax);
1429 LOperand* temp2 = FixedTemp(edx);
1430 LInstruction* result =
1431 DefineFixed(new(zone()) LFlooringDivByConstI(dividend,
1432 divisor,
1433 temp1,
1434 temp2),
1435 edx);
1436 bool can_deopt =
1437 divisor == 0 ||
1438 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0);
1439 return can_deopt ? AssignEnvironment(result) : result;
1440 }
1441
1442
1350 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { 1443 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1351 HValue* right = instr->right(); 1444 if (instr->RightIsPowerOf2()) {
1352 if (!right->IsConstant()) { 1445 return DoFlooringDivByPowerOf2I(instr);
1353 ASSERT(right->representation().IsInteger32()); 1446 } else if (false && instr->right()->IsConstant()) {
1354 // The temporary operand is necessary to ensure that right is not allocated 1447 return DoFlooringDivByConstI(instr); // TODO(svenpanne) Fix and re-enable.
1355 // into edx.
1356 LOperand* temp = FixedTemp(edx);
1357 LOperand* dividend = UseFixed(instr->left(), eax);
1358 LOperand* divisor = UseRegister(instr->right());
1359 LDivI* flooring_div = new(zone()) LDivI(dividend, divisor, temp);
1360 return AssignEnvironment(DefineFixed(flooring_div, eax));
1361 }
1362
1363 ASSERT(right->IsConstant() && HConstant::cast(right)->HasInteger32Value());
1364 LOperand* divisor = chunk_->DefineConstantOperand(HConstant::cast(right));
1365 int32_t divisor_si = HConstant::cast(right)->Integer32Value();
1366 if (divisor_si == 0) {
1367 LOperand* dividend = UseRegister(instr->left());
1368 return AssignEnvironment(DefineAsRegister(
1369 new(zone()) LMathFloorOfDiv(dividend, divisor, NULL)));
1370 } else if (IsPowerOf2(abs(divisor_si))) {
1371 // use dividend as temp if divisor < 0 && divisor != -1
1372 LOperand* dividend = divisor_si < -1 ? UseTempRegister(instr->left()) :
1373 UseRegisterAtStart(instr->left());
1374 LInstruction* result = DefineAsRegister(
1375 new(zone()) LMathFloorOfDiv(dividend, divisor, NULL));
1376 return divisor_si < 0 ? AssignEnvironment(result) : result;
1377 } else { 1448 } else {
1378 // needs edx:eax, plus a temp 1449 return DoDivI(instr);
1379 LOperand* dividend = UseFixed(instr->left(), eax);
1380 LOperand* temp = TempRegister();
1381 LInstruction* result = DefineFixed(
1382 new(zone()) LMathFloorOfDiv(dividend, divisor, temp), edx);
1383 return divisor_si < 0 ? AssignEnvironment(result) : result;
1384 } 1450 }
1385 } 1451 }
1386 1452
1387 1453
1454 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1455 ASSERT(instr->representation().IsSmiOrInteger32());
1456 ASSERT(instr->left()->representation().Equals(instr->representation()));
1457 ASSERT(instr->right()->representation().Equals(instr->representation()));
1458 LOperand* dividend = UseRegisterAtStart(instr->left());
1459 int32_t divisor = instr->right()->GetInteger32Constant();
1460 LInstruction* result = DefineSameAsFirst(new(zone()) LModByPowerOf2I(
1461 dividend, divisor));
1462 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1463 result = AssignEnvironment(result);
1464 }
1465 return result;
1466 }
1467
1468
1469 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
1470 ASSERT(instr->representation().IsSmiOrInteger32());
1471 ASSERT(instr->left()->representation().Equals(instr->representation()));
1472 ASSERT(instr->right()->representation().Equals(instr->representation()));
1473 LOperand* dividend = UseRegister(instr->left());
1474 int32_t divisor = instr->right()->GetInteger32Constant();
1475 LOperand* temp1 = FixedTemp(eax);
1476 LOperand* temp2 = FixedTemp(edx);
1477 LInstruction* result = DefineFixed(new(zone()) LModByConstI(
1478 dividend, divisor, temp1, temp2), eax);
1479 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1480 result = AssignEnvironment(result);
1481 }
1482 return result;
1483 }
1484
1485
1486 LInstruction* LChunkBuilder::DoModI(HMod* instr) {
1487 ASSERT(instr->representation().IsSmiOrInteger32());
1488 ASSERT(instr->left()->representation().Equals(instr->representation()));
1489 ASSERT(instr->right()->representation().Equals(instr->representation()));
1490 LOperand* dividend = UseFixed(instr->left(), eax);
1491 LOperand* divisor = UseRegister(instr->right());
1492 LOperand* temp = FixedTemp(edx);
1493 LInstruction* result = DefineFixed(new(zone()) LModI(
1494 dividend, divisor, temp), edx);
1495 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1496 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1497 result = AssignEnvironment(result);
1498 }
1499 return result;
1500 }
1501
1502
1388 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1503 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1389 HValue* left = instr->left();
1390 HValue* right = instr->right();
1391 if (instr->representation().IsSmiOrInteger32()) { 1504 if (instr->representation().IsSmiOrInteger32()) {
1392 ASSERT(instr->left()->representation().Equals(instr->representation()));
1393 ASSERT(instr->right()->representation().Equals(instr->representation()));
1394
1395 if (instr->RightIsPowerOf2()) { 1505 if (instr->RightIsPowerOf2()) {
1396 ASSERT(!right->CanBeZero()); 1506 return DoModByPowerOf2I(instr);
1397 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), 1507 } else if (instr->right()->IsConstant()) {
1398 UseOrConstant(right), 1508 return DoModByConstI(instr);
1399 NULL);
1400 LInstruction* result = DefineSameAsFirst(mod);
1401 return (left->CanBeNegative() &&
1402 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1403 ? AssignEnvironment(result)
1404 : result;
1405 return AssignEnvironment(DefineSameAsFirst(mod));
1406 } else { 1509 } else {
1407 // The temporary operand is necessary to ensure that right is not 1510 return DoModI(instr);
1408 // allocated into edx.
1409 LModI* mod = new(zone()) LModI(UseFixed(left, eax),
1410 UseRegister(right),
1411 FixedTemp(edx));
1412 LInstruction* result = DefineFixed(mod, edx);
1413 return (right->CanBeZero() ||
1414 (left->RangeCanInclude(kMinInt) &&
1415 right->RangeCanInclude(-1) &&
1416 instr->CheckFlag(HValue::kBailoutOnMinusZero)) ||
1417 (left->CanBeNegative() &&
1418 instr->CanBeZero() &&
1419 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1420 ? AssignEnvironment(result)
1421 : result;
1422 } 1511 }
1423 } else if (instr->representation().IsDouble()) { 1512 } else if (instr->representation().IsDouble()) {
1424 return DoArithmeticD(Token::MOD, instr); 1513 return DoArithmeticD(Token::MOD, instr);
1425 } else { 1514 } else {
1426 return DoArithmeticT(Token::MOD, instr); 1515 return DoArithmeticT(Token::MOD, instr);
1427 } 1516 }
1428 } 1517 }
1429 1518
1430 1519
1431 LInstruction* LChunkBuilder::DoMul(HMul* instr) { 1520 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 UseTempRegister(instr->value()) : UseRegister(instr->value()); 1941 UseTempRegister(instr->value()) : UseRegister(instr->value());
1853 LOperand* temp = needs_temp ? TempRegister() : NULL; 1942 LOperand* temp = needs_temp ? TempRegister() : NULL;
1854 return AssignEnvironment( 1943 return AssignEnvironment(
1855 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); 1944 DefineAsRegister(new(zone()) LDoubleToI(value, temp)));
1856 } 1945 }
1857 } else if (from.IsInteger32()) { 1946 } else if (from.IsInteger32()) {
1858 info()->MarkAsDeferredCalling(); 1947 info()->MarkAsDeferredCalling();
1859 if (to.IsTagged()) { 1948 if (to.IsTagged()) {
1860 HValue* val = instr->value(); 1949 HValue* val = instr->value();
1861 LOperand* value = UseRegister(val); 1950 LOperand* value = UseRegister(val);
1862 if (val->HasRange() && val->range()->IsInSmiRange()) { 1951 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1863 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1952 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1864 } else if (val->CheckFlag(HInstruction::kUint32)) { 1953 } else if (val->CheckFlag(HInstruction::kUint32)) {
1865 LOperand* temp = CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1) 1954 LOperand* temp1 = TempRegister();
1866 : NULL; 1955 LOperand* temp2 = CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1)
1867 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); 1956 : NULL;
1957 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
1868 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1958 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1869 } else { 1959 } else {
1870 LNumberTagI* result = new(zone()) LNumberTagI(value); 1960 LOperand* temp = TempRegister();
1961 LNumberTagI* result = new(zone()) LNumberTagI(value, temp);
1871 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1962 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1872 } 1963 }
1873 } else if (to.IsSmi()) { 1964 } else if (to.IsSmi()) {
1874 HValue* val = instr->value(); 1965 HValue* val = instr->value();
1875 LOperand* value = UseRegister(val); 1966 LOperand* value = UseRegister(val);
1876 LInstruction* result = val->CheckFlag(HInstruction::kUint32) 1967 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value));
1877 ? DefineSameAsFirst(new(zone()) LUint32ToSmi(value)) 1968 if (instr->CheckFlag(HValue::kCanOverflow)) {
1878 : DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); 1969 result = AssignEnvironment(result);
1879 if (val->HasRange() && val->range()->IsInSmiRange()) {
1880 return result;
1881 } 1970 }
1882 return AssignEnvironment(result); 1971 return result;
1883 } else { 1972 } else {
1884 ASSERT(to.IsDouble()); 1973 ASSERT(to.IsDouble());
1885 if (instr->value()->CheckFlag(HInstruction::kUint32)) { 1974 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1886 LOperand* temp = FixedTemp(xmm1); 1975 LOperand* temp = FixedTemp(xmm1);
1887 return DefineAsRegister( 1976 return DefineAsRegister(
1888 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); 1977 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp));
1889 } else { 1978 } else {
1890 return DefineAsRegister( 1979 return DefineAsRegister(
1891 new(zone()) LInteger32ToDouble(Use(instr->value()))); 1980 new(zone()) LInteger32ToDouble(Use(instr->value())));
1892 } 1981 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 LOperand* value = UseRegister(instr->value()); 2054 LOperand* value = UseRegister(instr->value());
1966 LClampTToUint8NoSSE2* res = 2055 LClampTToUint8NoSSE2* res =
1967 new(zone()) LClampTToUint8NoSSE2(value, TempRegister(), 2056 new(zone()) LClampTToUint8NoSSE2(value, TempRegister(),
1968 TempRegister(), TempRegister()); 2057 TempRegister(), TempRegister());
1969 return AssignEnvironment(DefineFixed(res, ecx)); 2058 return AssignEnvironment(DefineFixed(res, ecx));
1970 } 2059 }
1971 } 2060 }
1972 } 2061 }
1973 2062
1974 2063
2064 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
2065 HValue* value = instr->value();
2066 ASSERT(value->representation().IsDouble());
2067 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value)));
2068 }
2069
2070
2071 LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
2072 LOperand* lo = UseRegister(instr->lo());
2073 LOperand* hi = UseRegister(instr->hi());
2074 return DefineAsRegister(new(zone()) LConstructDouble(hi, lo));
2075 }
2076
2077
1975 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { 2078 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1976 LOperand* context = info()->IsStub() ? UseFixed(instr->context(), esi) : NULL; 2079 LOperand* context = info()->IsStub() ? UseFixed(instr->context(), esi) : NULL;
1977 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); 2080 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1978 return new(zone()) LReturn( 2081 return new(zone()) LReturn(
1979 UseFixed(instr->value(), eax), context, parameter_count); 2082 UseFixed(instr->value(), eax), context, parameter_count);
1980 } 2083 }
1981 2084
1982 2085
1983 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 2086 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1984 Representation r = instr->representation(); 2087 Representation r = instr->representation();
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 ASSERT(!needs_write_barrier_for_map); 2367 ASSERT(!needs_write_barrier_for_map);
2265 obj = UseRegisterOrConstant(instr->object()); 2368 obj = UseRegisterOrConstant(instr->object());
2266 } else { 2369 } else {
2267 obj = needs_write_barrier_for_map 2370 obj = needs_write_barrier_for_map
2268 ? UseRegister(instr->object()) 2371 ? UseRegister(instr->object())
2269 : UseRegisterAtStart(instr->object()); 2372 : UseRegisterAtStart(instr->object());
2270 } 2373 }
2271 2374
2272 bool can_be_constant = instr->value()->IsConstant() && 2375 bool can_be_constant = instr->value()->IsConstant() &&
2273 HConstant::cast(instr->value())->NotInNewSpace() && 2376 HConstant::cast(instr->value())->NotInNewSpace() &&
2274 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); 2377 !instr->field_representation().IsDouble();
2275 2378
2276 LOperand* val; 2379 LOperand* val;
2277 if (instr->field_representation().IsInteger8() || 2380 if (instr->field_representation().IsInteger8() ||
2278 instr->field_representation().IsUInteger8()) { 2381 instr->field_representation().IsUInteger8()) {
2279 // mov_b requires a byte register (i.e. any of eax, ebx, ecx, edx). 2382 // mov_b requires a byte register (i.e. any of eax, ebx, ecx, edx).
2280 // Just force the value to be in eax and we're safe here. 2383 // Just force the value to be in eax and we're safe here.
2281 val = UseFixed(instr->value(), eax); 2384 val = UseFixed(instr->value(), eax);
2282 } else if (needs_write_barrier) { 2385 } else if (needs_write_barrier) {
2283 val = UseTempRegister(instr->value()); 2386 val = UseTempRegister(instr->value());
2284 } else if (can_be_constant) { 2387 } else if (can_be_constant) {
2285 val = UseRegisterOrConstant(instr->value()); 2388 val = UseRegisterOrConstant(instr->value());
2286 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { 2389 } else if (instr->field_representation().IsSmi()) {
2287 val = UseTempRegister(instr->value()); 2390 val = UseTempRegister(instr->value());
2288 } else if (FLAG_track_double_fields && 2391 } else if (instr->field_representation().IsDouble()) {
2289 instr->field_representation().IsDouble()) {
2290 val = UseRegisterAtStart(instr->value()); 2392 val = UseRegisterAtStart(instr->value());
2291 } else { 2393 } else {
2292 val = UseRegister(instr->value()); 2394 val = UseRegister(instr->value());
2293 } 2395 }
2294 2396
2295 // We only need a scratch register if we have a write barrier or we 2397 // We only need a scratch register if we have a write barrier or we
2296 // have a store into the properties array (not in-object-property). 2398 // have a store into the properties array (not in-object-property).
2297 LOperand* temp = (!is_in_object || needs_write_barrier || 2399 LOperand* temp = (!is_in_object || needs_write_barrier ||
2298 needs_write_barrier_for_map) ? TempRegister() : NULL; 2400 needs_write_barrier_for_map) ? TempRegister() : NULL;
2299 2401
2300 // We need a temporary register for write barrier of the map field. 2402 // We need a temporary register for write barrier of the map field.
2301 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL; 2403 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL;
2302 2404
2303 LStoreNamedField* result = 2405 LStoreNamedField* result =
2304 new(zone()) LStoreNamedField(obj, val, temp, temp_map); 2406 new(zone()) LStoreNamedField(obj, val, temp, temp_map);
2305 if (FLAG_track_heap_object_fields && 2407 if (instr->field_representation().IsHeapObject()) {
2306 instr->field_representation().IsHeapObject()) {
2307 if (!instr->value()->type().IsHeapObject()) { 2408 if (!instr->value()->type().IsHeapObject()) {
2308 return AssignEnvironment(result); 2409 return AssignEnvironment(result);
2309 } 2410 }
2310 } 2411 }
2311 return result; 2412 return result;
2312 } 2413 }
2313 2414
2314 2415
2315 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 2416 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2316 LOperand* context = UseFixed(instr->context(), esi); 2417 LOperand* context = UseFixed(instr->context(), esi);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 2588
2488 2589
2489 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( 2590 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch(
2490 HIsConstructCallAndBranch* instr) { 2591 HIsConstructCallAndBranch* instr) {
2491 return new(zone()) LIsConstructCallAndBranch(TempRegister()); 2592 return new(zone()) LIsConstructCallAndBranch(TempRegister());
2492 } 2593 }
2493 2594
2494 2595
2495 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { 2596 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2496 instr->ReplayEnvironment(current_block_->last_environment()); 2597 instr->ReplayEnvironment(current_block_->last_environment());
2497
2498 // If there is an instruction pending deoptimization environment create a
2499 // lazy bailout instruction to capture the environment.
2500 if (!pending_deoptimization_ast_id_.IsNone()) {
2501 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
2502 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout;
2503 LInstruction* result = AssignEnvironment(lazy_bailout);
2504 // Store the lazy deopt environment with the instruction if needed. Right
2505 // now it is only used for LInstanceOfKnownGlobal.
2506 instruction_pending_deoptimization_environment_->
2507 SetDeferredLazyDeoptimizationEnvironment(result->environment());
2508 instruction_pending_deoptimization_environment_ = NULL;
2509 pending_deoptimization_ast_id_ = BailoutId::None();
2510 return result;
2511 }
2512
2513 return NULL; 2598 return NULL;
2514 } 2599 }
2515 2600
2516 2601
2517 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2602 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2518 info()->MarkAsDeferredCalling(); 2603 info()->MarkAsDeferredCalling();
2519 if (instr->is_function_entry()) { 2604 if (instr->is_function_entry()) {
2520 LOperand* context = UseFixed(instr->context(), esi); 2605 LOperand* context = UseFixed(instr->context(), esi);
2521 return MarkAsCall(new(zone()) LStackCheck(context), instr); 2606 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2522 } else { 2607 } else {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2675 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2591 LOperand* object = UseRegister(instr->object()); 2676 LOperand* object = UseRegister(instr->object());
2592 LOperand* index = UseTempRegister(instr->index()); 2677 LOperand* index = UseTempRegister(instr->index());
2593 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2678 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2594 } 2679 }
2595 2680
2596 2681
2597 } } // namespace v8::internal 2682 } } // namespace v8::internal
2598 2683
2599 #endif // V8_TARGET_ARCH_IA32 2684 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698