OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 816 |
817 | 817 |
818 LInstruction* LChunkBuilder::DoBit(Token::Value op, | 818 LInstruction* LChunkBuilder::DoBit(Token::Value op, |
819 HBitwiseBinaryOperation* instr) { | 819 HBitwiseBinaryOperation* instr) { |
820 if (instr->representation().IsInteger32()) { | 820 if (instr->representation().IsInteger32()) { |
821 ASSERT(instr->left()->representation().IsInteger32()); | 821 ASSERT(instr->left()->representation().IsInteger32()); |
822 ASSERT(instr->right()->representation().IsInteger32()); | 822 ASSERT(instr->right()->representation().IsInteger32()); |
823 | 823 |
824 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 824 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
825 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 825 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
826 return DefineSameAsFirst(new LBitI(op, left, right)); | 826 return DefineAsRegister(new LBitI(op, left, right)); |
827 } else { | 827 } else { |
828 ASSERT(instr->representation().IsTagged()); | 828 ASSERT(instr->representation().IsTagged()); |
829 ASSERT(instr->left()->representation().IsTagged()); | 829 ASSERT(instr->left()->representation().IsTagged()); |
830 ASSERT(instr->right()->representation().IsTagged()); | 830 ASSERT(instr->right()->representation().IsTagged()); |
831 | 831 |
832 LOperand* left = UseFixed(instr->left(), r1); | 832 LOperand* left = UseFixed(instr->left(), r1); |
833 LOperand* right = UseFixed(instr->right(), r0); | 833 LOperand* right = UseFixed(instr->right(), r0); |
834 LArithmeticT* result = new LArithmeticT(op, left, right); | 834 LArithmeticT* result = new LArithmeticT(op, left, right); |
835 return MarkAsCall(DefineFixed(result, r0), instr); | 835 return MarkAsCall(DefineFixed(result, r0), instr); |
836 } | 836 } |
(...skipping 18 matching lines...) Expand all Loading... |
855 LOperand* left = UseRegisterAtStart(instr->OperandAt(0)); | 855 LOperand* left = UseRegisterAtStart(instr->OperandAt(0)); |
856 | 856 |
857 HValue* right_value = instr->OperandAt(1); | 857 HValue* right_value = instr->OperandAt(1); |
858 LOperand* right = NULL; | 858 LOperand* right = NULL; |
859 int constant_value = 0; | 859 int constant_value = 0; |
860 if (right_value->IsConstant()) { | 860 if (right_value->IsConstant()) { |
861 HConstant* constant = HConstant::cast(right_value); | 861 HConstant* constant = HConstant::cast(right_value); |
862 right = chunk_->DefineConstantOperand(constant); | 862 right = chunk_->DefineConstantOperand(constant); |
863 constant_value = constant->Integer32Value() & 0x1f; | 863 constant_value = constant->Integer32Value() & 0x1f; |
864 } else { | 864 } else { |
865 right = UseRegister(right_value); | 865 right = UseRegisterAtStart(right_value); |
866 } | 866 } |
867 | 867 |
868 // Shift operations can only deoptimize if we do a logical shift | 868 // Shift operations can only deoptimize if we do a logical shift |
869 // by 0 and the result cannot be truncated to int32. | 869 // by 0 and the result cannot be truncated to int32. |
870 bool may_deopt = (op == Token::SHR && constant_value == 0); | 870 bool may_deopt = (op == Token::SHR && constant_value == 0); |
871 bool does_deopt = false; | 871 bool does_deopt = false; |
872 if (may_deopt) { | 872 if (may_deopt) { |
873 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 873 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
874 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | 874 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { |
875 does_deopt = true; | 875 does_deopt = true; |
876 break; | 876 break; |
877 } | 877 } |
878 } | 878 } |
879 } | 879 } |
880 | 880 |
881 LInstruction* result = | 881 LInstruction* result = |
882 DefineSameAsFirst(new LShiftI(op, left, right, does_deopt)); | 882 DefineAsRegister(new LShiftI(op, left, right, does_deopt)); |
883 return does_deopt ? AssignEnvironment(result) : result; | 883 return does_deopt ? AssignEnvironment(result) : result; |
884 } | 884 } |
885 | 885 |
886 | 886 |
887 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 887 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
888 HArithmeticBinaryOperation* instr) { | 888 HArithmeticBinaryOperation* instr) { |
889 ASSERT(instr->representation().IsDouble()); | 889 ASSERT(instr->representation().IsDouble()); |
890 ASSERT(instr->left()->representation().IsDouble()); | 890 ASSERT(instr->left()->representation().IsDouble()); |
891 ASSERT(instr->right()->representation().IsDouble()); | 891 ASSERT(instr->right()->representation().IsDouble()); |
892 ASSERT(op != Token::MOD); | 892 ASSERT(op != Token::MOD); |
893 LOperand* left = UseRegisterAtStart(instr->left()); | 893 LOperand* left = UseRegisterAtStart(instr->left()); |
894 LOperand* right = UseRegisterAtStart(instr->right()); | 894 LOperand* right = UseRegisterAtStart(instr->right()); |
895 LArithmeticD* result = new LArithmeticD(op, left, right); | 895 LArithmeticD* result = new LArithmeticD(op, left, right); |
896 return DefineSameAsFirst(result); | 896 return DefineAsRegister(result); |
897 } | 897 } |
898 | 898 |
899 | 899 |
900 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 900 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
901 HArithmeticBinaryOperation* instr) { | 901 HArithmeticBinaryOperation* instr) { |
902 ASSERT(op == Token::ADD || | 902 ASSERT(op == Token::ADD || |
903 op == Token::DIV || | 903 op == Token::DIV || |
904 op == Token::MOD || | 904 op == Token::MOD || |
905 op == Token::MUL || | 905 op == Token::MUL || |
906 op == Token::SUB); | 906 op == Token::SUB); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 if (op == kMathLog || op == kMathSin || op == kMathCos) { | 1231 if (op == kMathLog || op == kMathSin || op == kMathCos) { |
1232 LOperand* input = UseFixedDouble(instr->value(), d2); | 1232 LOperand* input = UseFixedDouble(instr->value(), d2); |
1233 LUnaryMathOperation* result = new LUnaryMathOperation(input, NULL); | 1233 LUnaryMathOperation* result = new LUnaryMathOperation(input, NULL); |
1234 return MarkAsCall(DefineFixedDouble(result, d2), instr); | 1234 return MarkAsCall(DefineFixedDouble(result, d2), instr); |
1235 } else { | 1235 } else { |
1236 LOperand* input = UseRegisterAtStart(instr->value()); | 1236 LOperand* input = UseRegisterAtStart(instr->value()); |
1237 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL; | 1237 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL; |
1238 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); | 1238 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); |
1239 switch (op) { | 1239 switch (op) { |
1240 case kMathAbs: | 1240 case kMathAbs: |
1241 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1241 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
1242 case kMathFloor: | 1242 case kMathFloor: |
1243 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1243 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
1244 case kMathSqrt: | 1244 case kMathSqrt: |
1245 return DefineSameAsFirst(result); | 1245 return DefineAsRegister(result); |
1246 case kMathRound: | 1246 case kMathRound: |
1247 return AssignEnvironment(DefineAsRegister(result)); | 1247 return AssignEnvironment(DefineAsRegister(result)); |
1248 case kMathPowHalf: | 1248 case kMathPowHalf: |
1249 return DefineSameAsFirst(result); | 1249 return DefineAsRegister(result); |
1250 default: | 1250 default: |
1251 UNREACHABLE(); | 1251 UNREACHABLE(); |
1252 return NULL; | 1252 return NULL; |
1253 } | 1253 } |
1254 } | 1254 } |
1255 } | 1255 } |
1256 | 1256 |
1257 | 1257 |
1258 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1258 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
1259 ASSERT(instr->key()->representation().IsTagged()); | 1259 ASSERT(instr->key()->representation().IsTagged()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 | 1317 |
1318 | 1318 |
1319 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { | 1319 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { |
1320 return DoBit(Token::BIT_AND, instr); | 1320 return DoBit(Token::BIT_AND, instr); |
1321 } | 1321 } |
1322 | 1322 |
1323 | 1323 |
1324 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { | 1324 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { |
1325 ASSERT(instr->value()->representation().IsInteger32()); | 1325 ASSERT(instr->value()->representation().IsInteger32()); |
1326 ASSERT(instr->representation().IsInteger32()); | 1326 ASSERT(instr->representation().IsInteger32()); |
1327 return DefineSameAsFirst(new LBitNotI(UseRegisterAtStart(instr->value()))); | 1327 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value()))); |
1328 } | 1328 } |
1329 | 1329 |
1330 | 1330 |
1331 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { | 1331 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { |
1332 return DoBit(Token::BIT_OR, instr); | 1332 return DoBit(Token::BIT_OR, instr); |
1333 } | 1333 } |
1334 | 1334 |
1335 | 1335 |
1336 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { | 1336 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { |
1337 return DoBit(Token::BIT_XOR, instr); | 1337 return DoBit(Token::BIT_XOR, instr); |
(...skipping 28 matching lines...) Expand all Loading... |
1366 if (instr->HasPowerOf2Divisor()) { | 1366 if (instr->HasPowerOf2Divisor()) { |
1367 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1367 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
1368 LOperand* value = UseRegisterAtStart(instr->left()); | 1368 LOperand* value = UseRegisterAtStart(instr->left()); |
1369 mod = new LModI(value, UseOrConstant(instr->right())); | 1369 mod = new LModI(value, UseOrConstant(instr->right())); |
1370 } else { | 1370 } else { |
1371 LOperand* dividend = UseRegister(instr->left()); | 1371 LOperand* dividend = UseRegister(instr->left()); |
1372 LOperand* divisor = UseRegisterAtStart(instr->right()); | 1372 LOperand* divisor = UseRegisterAtStart(instr->right()); |
1373 mod = new LModI(dividend, | 1373 mod = new LModI(dividend, |
1374 divisor, | 1374 divisor, |
1375 TempRegister(), | 1375 TempRegister(), |
1376 FixedTemp(d1), | 1376 FixedTemp(d10), |
1377 FixedTemp(d2)); | 1377 FixedTemp(d11)); |
1378 } | 1378 } |
1379 | 1379 |
1380 return AssignEnvironment(DefineSameAsFirst(mod)); | 1380 bool needs_env = (instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
| 1381 instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1382 return needs_env ? AssignEnvironment(DefineAsRegister(mod)) |
| 1383 : DefineAsRegister(mod); |
1381 } else if (instr->representation().IsTagged()) { | 1384 } else if (instr->representation().IsTagged()) { |
1382 return DoArithmeticT(Token::MOD, instr); | 1385 return DoArithmeticT(Token::MOD, instr); |
1383 } else { | 1386 } else { |
1384 ASSERT(instr->representation().IsDouble()); | 1387 ASSERT(instr->representation().IsDouble()); |
1385 // We call a C function for double modulo. It can't trigger a GC. | 1388 // We call a C function for double modulo. It can't trigger a GC. |
1386 // We need to use fixed result register for the call. | 1389 // We need to use fixed result register for the call. |
1387 // TODO(fschneider): Allow any register as input registers. | 1390 // TODO(fschneider): Allow any register as input registers. |
1388 LOperand* left = UseFixedDouble(instr->left(), d1); | 1391 LOperand* left = UseFixedDouble(instr->left(), d1); |
1389 LOperand* right = UseFixedDouble(instr->right(), d2); | 1392 LOperand* right = UseFixedDouble(instr->right(), d2); |
1390 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); | 1393 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); |
1391 return MarkAsCall(DefineFixedDouble(result, d1), instr); | 1394 return MarkAsCall(DefineFixedDouble(result, d1), instr); |
1392 } | 1395 } |
1393 } | 1396 } |
1394 | 1397 |
1395 | 1398 |
1396 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1399 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
1397 if (instr->representation().IsInteger32()) { | 1400 if (instr->representation().IsInteger32()) { |
1398 ASSERT(instr->left()->representation().IsInteger32()); | 1401 ASSERT(instr->left()->representation().IsInteger32()); |
1399 ASSERT(instr->right()->representation().IsInteger32()); | 1402 ASSERT(instr->right()->representation().IsInteger32()); |
1400 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1403 LOperand* left; |
1401 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1404 LOperand* right = UseOrConstant(instr->MostConstantOperand()); |
1402 LOperand* temp = NULL; | 1405 LOperand* temp = NULL; |
1403 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && | 1406 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
1404 (instr->CheckFlag(HValue::kCanOverflow) || | 1407 (instr->CheckFlag(HValue::kCanOverflow) || |
1405 !right->IsConstantOperand())) { | 1408 !right->IsConstantOperand())) { |
| 1409 left = UseRegister(instr->LeastConstantOperand()); |
1406 temp = TempRegister(); | 1410 temp = TempRegister(); |
| 1411 } else { |
| 1412 left = UseRegisterAtStart(instr->LeastConstantOperand()); |
1407 } | 1413 } |
1408 return AssignEnvironment(DefineSameAsFirst(new LMulI(left, right, temp))); | 1414 return AssignEnvironment(DefineAsRegister(new LMulI(left, right, temp))); |
1409 | 1415 |
1410 } else if (instr->representation().IsDouble()) { | 1416 } else if (instr->representation().IsDouble()) { |
1411 return DoArithmeticD(Token::MUL, instr); | 1417 return DoArithmeticD(Token::MUL, instr); |
1412 | 1418 |
1413 } else { | 1419 } else { |
1414 return DoArithmeticT(Token::MUL, instr); | 1420 return DoArithmeticT(Token::MUL, instr); |
1415 } | 1421 } |
1416 } | 1422 } |
1417 | 1423 |
1418 | 1424 |
1419 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1425 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
1420 if (instr->representation().IsInteger32()) { | 1426 if (instr->representation().IsInteger32()) { |
1421 ASSERT(instr->left()->representation().IsInteger32()); | 1427 ASSERT(instr->left()->representation().IsInteger32()); |
1422 ASSERT(instr->right()->representation().IsInteger32()); | 1428 ASSERT(instr->right()->representation().IsInteger32()); |
1423 LOperand* left = UseRegisterAtStart(instr->left()); | 1429 LOperand* left = UseRegisterAtStart(instr->left()); |
1424 LOperand* right = UseOrConstantAtStart(instr->right()); | 1430 LOperand* right = UseOrConstantAtStart(instr->right()); |
1425 LSubI* sub = new LSubI(left, right); | 1431 LSubI* sub = new LSubI(left, right); |
1426 LInstruction* result = DefineSameAsFirst(sub); | 1432 LInstruction* result = DefineAsRegister(sub); |
1427 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1433 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1428 result = AssignEnvironment(result); | 1434 result = AssignEnvironment(result); |
1429 } | 1435 } |
1430 return result; | 1436 return result; |
1431 } else if (instr->representation().IsDouble()) { | 1437 } else if (instr->representation().IsDouble()) { |
1432 return DoArithmeticD(Token::SUB, instr); | 1438 return DoArithmeticD(Token::SUB, instr); |
1433 } else { | 1439 } else { |
1434 return DoArithmeticT(Token::SUB, instr); | 1440 return DoArithmeticT(Token::SUB, instr); |
1435 } | 1441 } |
1436 } | 1442 } |
1437 | 1443 |
1438 | 1444 |
1439 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1445 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
1440 if (instr->representation().IsInteger32()) { | 1446 if (instr->representation().IsInteger32()) { |
1441 ASSERT(instr->left()->representation().IsInteger32()); | 1447 ASSERT(instr->left()->representation().IsInteger32()); |
1442 ASSERT(instr->right()->representation().IsInteger32()); | 1448 ASSERT(instr->right()->representation().IsInteger32()); |
1443 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1449 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
1444 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1450 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
1445 LAddI* add = new LAddI(left, right); | 1451 LAddI* add = new LAddI(left, right); |
1446 LInstruction* result = DefineSameAsFirst(add); | 1452 LInstruction* result = DefineAsRegister(add); |
1447 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1453 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1448 result = AssignEnvironment(result); | 1454 result = AssignEnvironment(result); |
1449 } | 1455 } |
1450 return result; | 1456 return result; |
1451 } else if (instr->representation().IsDouble()) { | 1457 } else if (instr->representation().IsDouble()) { |
1452 return DoArithmeticD(Token::ADD, instr); | 1458 return DoArithmeticD(Token::ADD, instr); |
1453 } else { | 1459 } else { |
1454 ASSERT(instr->representation().IsTagged()); | 1460 ASSERT(instr->representation().IsTagged()); |
1455 return DoArithmeticT(Token::ADD, instr); | 1461 return DoArithmeticT(Token::ADD, instr); |
1456 } | 1462 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 | 1605 |
1600 LInstruction* LChunkBuilder::DoFixedArrayLength(HFixedArrayLength* instr) { | 1606 LInstruction* LChunkBuilder::DoFixedArrayLength(HFixedArrayLength* instr) { |
1601 LOperand* array = UseRegisterAtStart(instr->value()); | 1607 LOperand* array = UseRegisterAtStart(instr->value()); |
1602 return DefineAsRegister(new LFixedArrayLength(array)); | 1608 return DefineAsRegister(new LFixedArrayLength(array)); |
1603 } | 1609 } |
1604 | 1610 |
1605 | 1611 |
1606 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1612 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
1607 LOperand* object = UseRegister(instr->value()); | 1613 LOperand* object = UseRegister(instr->value()); |
1608 LValueOf* result = new LValueOf(object, TempRegister()); | 1614 LValueOf* result = new LValueOf(object, TempRegister()); |
1609 return AssignEnvironment(DefineSameAsFirst(result)); | 1615 return AssignEnvironment(DefineAsRegister(result)); |
1610 } | 1616 } |
1611 | 1617 |
1612 | 1618 |
1613 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1619 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
1614 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), | 1620 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), |
1615 UseRegister(instr->length()))); | 1621 UseRegister(instr->length()))); |
1616 } | 1622 } |
1617 | 1623 |
1618 | 1624 |
1619 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1625 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 ASSERT(to.IsInteger32()); | 1660 ASSERT(to.IsInteger32()); |
1655 LOperand* value = UseRegister(instr->value()); | 1661 LOperand* value = UseRegister(instr->value()); |
1656 bool needs_check = !instr->value()->type().IsSmi(); | 1662 bool needs_check = !instr->value()->type().IsSmi(); |
1657 LInstruction* res = NULL; | 1663 LInstruction* res = NULL; |
1658 if (!needs_check) { | 1664 if (!needs_check) { |
1659 res = DefineSameAsFirst(new LSmiUntag(value, needs_check)); | 1665 res = DefineSameAsFirst(new LSmiUntag(value, needs_check)); |
1660 } else { | 1666 } else { |
1661 LOperand* temp1 = TempRegister(); | 1667 LOperand* temp1 = TempRegister(); |
1662 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() | 1668 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() |
1663 : NULL; | 1669 : NULL; |
1664 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(d3) | 1670 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(d11) |
1665 : NULL; | 1671 : NULL; |
1666 res = DefineSameAsFirst(new LTaggedToI(value, temp1, temp2, temp3)); | 1672 res = DefineSameAsFirst(new LTaggedToI(value, temp1, temp2, temp3)); |
1667 res = AssignEnvironment(res); | 1673 res = AssignEnvironment(res); |
1668 } | 1674 } |
1669 return res; | 1675 return res; |
1670 } | 1676 } |
1671 } else if (from.IsDouble()) { | 1677 } else if (from.IsDouble()) { |
1672 if (to.IsTagged()) { | 1678 if (to.IsTagged()) { |
1673 LOperand* value = UseRegister(instr->value()); | 1679 LOperand* value = UseRegister(instr->value()); |
1674 LOperand* temp1 = TempRegister(); | 1680 LOperand* temp1 = TempRegister(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 LInstruction* result = new LCheckMap(value); | 1754 LInstruction* result = new LCheckMap(value); |
1749 return AssignEnvironment(result); | 1755 return AssignEnvironment(result); |
1750 } | 1756 } |
1751 | 1757 |
1752 | 1758 |
1753 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { | 1759 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
1754 HValue* value = instr->value(); | 1760 HValue* value = instr->value(); |
1755 Representation input_rep = value->representation(); | 1761 Representation input_rep = value->representation(); |
1756 LOperand* reg = UseRegister(value); | 1762 LOperand* reg = UseRegister(value); |
1757 if (input_rep.IsDouble()) { | 1763 if (input_rep.IsDouble()) { |
1758 return DefineAsRegister(new LClampDToUint8(reg, FixedTemp(d1))); | 1764 return DefineAsRegister(new LClampDToUint8(reg, FixedTemp(d11))); |
1759 } else if (input_rep.IsInteger32()) { | 1765 } else if (input_rep.IsInteger32()) { |
1760 return DefineAsRegister(new LClampIToUint8(reg)); | 1766 return DefineAsRegister(new LClampIToUint8(reg)); |
1761 } else { | 1767 } else { |
1762 ASSERT(input_rep.IsTagged()); | 1768 ASSERT(input_rep.IsTagged()); |
1763 // Register allocator doesn't (yet) support allocation of double | 1769 // Register allocator doesn't (yet) support allocation of double |
1764 // temps. Reserve d1 explicitly. | 1770 // temps. Reserve d1 explicitly. |
1765 LClampTToUint8* result = new LClampTToUint8(reg, FixedTemp(d1)); | 1771 LClampTToUint8* result = new LClampTToUint8(reg, FixedTemp(d11)); |
1766 return AssignEnvironment(DefineAsRegister(result)); | 1772 return AssignEnvironment(DefineAsRegister(result)); |
1767 } | 1773 } |
1768 } | 1774 } |
1769 | 1775 |
1770 | 1776 |
1771 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { | 1777 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { |
1772 HValue* value = instr->value(); | 1778 HValue* value = instr->value(); |
1773 Representation input_rep = value->representation(); | 1779 Representation input_rep = value->representation(); |
1774 LOperand* reg = UseRegister(value); | 1780 LOperand* reg = UseRegister(value); |
1775 if (input_rep.IsDouble()) { | 1781 if (input_rep.IsDouble()) { |
1776 LOperand* temp1 = TempRegister(); | 1782 LOperand* temp1 = TempRegister(); |
1777 LOperand* temp2 = TempRegister(); | 1783 LOperand* temp2 = TempRegister(); |
1778 LDoubleToI* res = new LDoubleToI(reg, temp1, temp2); | 1784 LDoubleToI* res = new LDoubleToI(reg, temp1, temp2); |
1779 return AssignEnvironment(DefineAsRegister(res)); | 1785 return AssignEnvironment(DefineAsRegister(res)); |
1780 } else if (input_rep.IsInteger32()) { | 1786 } else if (input_rep.IsInteger32()) { |
1781 // Canonicalization should already have removed the hydrogen instruction in | 1787 // Canonicalization should already have removed the hydrogen instruction in |
1782 // this case, since it is a noop. | 1788 // this case, since it is a noop. |
1783 UNREACHABLE(); | 1789 UNREACHABLE(); |
1784 return NULL; | 1790 return NULL; |
1785 } else { | 1791 } else { |
1786 ASSERT(input_rep.IsTagged()); | 1792 ASSERT(input_rep.IsTagged()); |
1787 LOperand* temp1 = TempRegister(); | 1793 LOperand* temp1 = TempRegister(); |
1788 LOperand* temp2 = TempRegister(); | 1794 LOperand* temp2 = TempRegister(); |
1789 LOperand* temp3 = FixedTemp(d3); | 1795 LOperand* temp3 = FixedTemp(d11); |
1790 LTaggedToI* res = new LTaggedToI(reg, temp1, temp2, temp3); | 1796 LTaggedToI* res = new LTaggedToI(reg, temp1, temp2, temp3); |
1791 return AssignEnvironment(DefineSameAsFirst(res)); | 1797 return AssignEnvironment(DefineSameAsFirst(res)); |
1792 } | 1798 } |
1793 } | 1799 } |
1794 | 1800 |
1795 | 1801 |
1796 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1802 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
1797 return new LReturn(UseFixed(instr->value(), r0)); | 1803 return new LReturn(UseFixed(instr->value(), r0)); |
1798 } | 1804 } |
1799 | 1805 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 } | 1923 } |
1918 | 1924 |
1919 | 1925 |
1920 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1926 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
1921 HLoadKeyedFastElement* instr) { | 1927 HLoadKeyedFastElement* instr) { |
1922 ASSERT(instr->representation().IsTagged()); | 1928 ASSERT(instr->representation().IsTagged()); |
1923 ASSERT(instr->key()->representation().IsInteger32()); | 1929 ASSERT(instr->key()->representation().IsInteger32()); |
1924 LOperand* obj = UseRegisterAtStart(instr->object()); | 1930 LOperand* obj = UseRegisterAtStart(instr->object()); |
1925 LOperand* key = UseRegisterAtStart(instr->key()); | 1931 LOperand* key = UseRegisterAtStart(instr->key()); |
1926 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1932 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1927 return AssignEnvironment(DefineSameAsFirst(result)); | 1933 return AssignEnvironment(DefineAsRegister(result)); |
1928 } | 1934 } |
1929 | 1935 |
1930 | 1936 |
1931 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1937 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1932 HLoadKeyedSpecializedArrayElement* instr) { | 1938 HLoadKeyedSpecializedArrayElement* instr) { |
1933 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1939 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
1934 Representation representation(instr->representation()); | 1940 Representation representation(instr->representation()); |
1935 ASSERT( | 1941 ASSERT( |
1936 (representation.IsInteger32() && | 1942 (representation.IsInteger32() && |
1937 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1943 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2228 | 2234 |
2229 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2235 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2230 LOperand* key = UseRegisterAtStart(instr->key()); | 2236 LOperand* key = UseRegisterAtStart(instr->key()); |
2231 LOperand* object = UseRegisterAtStart(instr->object()); | 2237 LOperand* object = UseRegisterAtStart(instr->object()); |
2232 LIn* result = new LIn(key, object); | 2238 LIn* result = new LIn(key, object); |
2233 return MarkAsCall(DefineFixed(result, r0), instr); | 2239 return MarkAsCall(DefineFixed(result, r0), instr); |
2234 } | 2240 } |
2235 | 2241 |
2236 | 2242 |
2237 } } // namespace v8::internal | 2243 } } // namespace v8::internal |
OLD | NEW |