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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 if (op == kMathLog || op == kMathSin || op == kMathCos) { | 1230 if (op == kMathLog || op == kMathSin || op == kMathCos) { |
1231 LOperand* input = UseFixedDouble(instr->value(), d2); | 1231 LOperand* input = UseFixedDouble(instr->value(), d2); |
1232 LUnaryMathOperation* result = new LUnaryMathOperation(input, NULL); | 1232 LUnaryMathOperation* result = new LUnaryMathOperation(input, NULL); |
1233 return MarkAsCall(DefineFixedDouble(result, d2), instr); | 1233 return MarkAsCall(DefineFixedDouble(result, d2), instr); |
1234 } else { | 1234 } else { |
1235 LOperand* input = UseRegisterAtStart(instr->value()); | 1235 LOperand* input = UseRegisterAtStart(instr->value()); |
1236 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL; | 1236 LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL; |
1237 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); | 1237 LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); |
1238 switch (op) { | 1238 switch (op) { |
1239 case kMathAbs: | 1239 case kMathAbs: |
1240 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1240 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
1241 case kMathFloor: | 1241 case kMathFloor: |
1242 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1242 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
1243 case kMathSqrt: | 1243 case kMathSqrt: |
1244 return DefineSameAsFirst(result); | 1244 return DefineAsRegister(result); |
1245 case kMathRound: | 1245 case kMathRound: |
1246 return AssignEnvironment(DefineAsRegister(result)); | 1246 return AssignEnvironment(DefineAsRegister(result)); |
1247 case kMathPowHalf: | 1247 case kMathPowHalf: |
1248 return DefineSameAsFirst(result); | 1248 return DefineAsRegister(result); |
1249 default: | 1249 default: |
1250 UNREACHABLE(); | 1250 UNREACHABLE(); |
1251 return NULL; | 1251 return NULL; |
1252 } | 1252 } |
1253 } | 1253 } |
1254 } | 1254 } |
1255 | 1255 |
1256 | 1256 |
1257 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1257 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
1258 ASSERT(instr->key()->representation().IsTagged()); | 1258 ASSERT(instr->key()->representation().IsTagged()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 | 1316 |
1317 | 1317 |
1318 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { | 1318 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { |
1319 return DoBit(Token::BIT_AND, instr); | 1319 return DoBit(Token::BIT_AND, instr); |
1320 } | 1320 } |
1321 | 1321 |
1322 | 1322 |
1323 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { | 1323 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { |
1324 ASSERT(instr->value()->representation().IsInteger32()); | 1324 ASSERT(instr->value()->representation().IsInteger32()); |
1325 ASSERT(instr->representation().IsInteger32()); | 1325 ASSERT(instr->representation().IsInteger32()); |
1326 return DefineSameAsFirst(new LBitNotI(UseRegisterAtStart(instr->value()))); | 1326 return DefineAsRegister(new LBitNotI(UseRegisterAtStart(instr->value()))); |
1327 } | 1327 } |
1328 | 1328 |
1329 | 1329 |
1330 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { | 1330 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { |
1331 return DoBit(Token::BIT_OR, instr); | 1331 return DoBit(Token::BIT_OR, instr); |
1332 } | 1332 } |
1333 | 1333 |
1334 | 1334 |
1335 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { | 1335 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { |
1336 return DoBit(Token::BIT_XOR, instr); | 1336 return DoBit(Token::BIT_XOR, instr); |
(...skipping 28 matching lines...) Expand all Loading... |
1365 if (instr->HasPowerOf2Divisor()) { | 1365 if (instr->HasPowerOf2Divisor()) { |
1366 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1366 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
1367 LOperand* value = UseRegisterAtStart(instr->left()); | 1367 LOperand* value = UseRegisterAtStart(instr->left()); |
1368 mod = new LModI(value, UseOrConstant(instr->right())); | 1368 mod = new LModI(value, UseOrConstant(instr->right())); |
1369 } else { | 1369 } else { |
1370 LOperand* dividend = UseRegister(instr->left()); | 1370 LOperand* dividend = UseRegister(instr->left()); |
1371 LOperand* divisor = UseRegisterAtStart(instr->right()); | 1371 LOperand* divisor = UseRegisterAtStart(instr->right()); |
1372 mod = new LModI(dividend, | 1372 mod = new LModI(dividend, |
1373 divisor, | 1373 divisor, |
1374 TempRegister(), | 1374 TempRegister(), |
1375 FixedTemp(d1), | 1375 FixedTemp(d10), |
1376 FixedTemp(d2)); | 1376 FixedTemp(d11)); |
1377 } | 1377 } |
1378 | 1378 |
1379 return AssignEnvironment(DefineSameAsFirst(mod)); | 1379 bool needs_env = (instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
| 1380 instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1381 return needs_env ? AssignEnvironment(DefineAsRegister(mod)) |
| 1382 : DefineAsRegister(mod); |
1380 } else if (instr->representation().IsTagged()) { | 1383 } else if (instr->representation().IsTagged()) { |
1381 return DoArithmeticT(Token::MOD, instr); | 1384 return DoArithmeticT(Token::MOD, instr); |
1382 } else { | 1385 } else { |
1383 ASSERT(instr->representation().IsDouble()); | 1386 ASSERT(instr->representation().IsDouble()); |
1384 // We call a C function for double modulo. It can't trigger a GC. | 1387 // We call a C function for double modulo. It can't trigger a GC. |
1385 // We need to use fixed result register for the call. | 1388 // We need to use fixed result register for the call. |
1386 // TODO(fschneider): Allow any register as input registers. | 1389 // TODO(fschneider): Allow any register as input registers. |
1387 LOperand* left = UseFixedDouble(instr->left(), d1); | 1390 LOperand* left = UseFixedDouble(instr->left(), d1); |
1388 LOperand* right = UseFixedDouble(instr->right(), d2); | 1391 LOperand* right = UseFixedDouble(instr->right(), d2); |
1389 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); | 1392 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); |
1390 return MarkAsCall(DefineFixedDouble(result, d1), instr); | 1393 return MarkAsCall(DefineFixedDouble(result, d1), instr); |
1391 } | 1394 } |
1392 } | 1395 } |
1393 | 1396 |
1394 | 1397 |
1395 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1398 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
1396 if (instr->representation().IsInteger32()) { | 1399 if (instr->representation().IsInteger32()) { |
1397 ASSERT(instr->left()->representation().IsInteger32()); | 1400 ASSERT(instr->left()->representation().IsInteger32()); |
1398 ASSERT(instr->right()->representation().IsInteger32()); | 1401 ASSERT(instr->right()->representation().IsInteger32()); |
1399 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1402 LOperand* left; |
1400 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1403 LOperand* right = UseOrConstant(instr->MostConstantOperand()); |
1401 LOperand* temp = NULL; | 1404 LOperand* temp = NULL; |
1402 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && | 1405 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
1403 (instr->CheckFlag(HValue::kCanOverflow) || | 1406 (instr->CheckFlag(HValue::kCanOverflow) || |
1404 !right->IsConstantOperand())) { | 1407 !right->IsConstantOperand())) { |
| 1408 left = UseRegister(instr->LeastConstantOperand()); |
1405 temp = TempRegister(); | 1409 temp = TempRegister(); |
| 1410 } else { |
| 1411 left = UseRegisterAtStart(instr->LeastConstantOperand()); |
1406 } | 1412 } |
1407 return AssignEnvironment(DefineSameAsFirst(new LMulI(left, right, temp))); | 1413 return AssignEnvironment(DefineAsRegister(new LMulI(left, right, temp))); |
1408 | 1414 |
1409 } else if (instr->representation().IsDouble()) { | 1415 } else if (instr->representation().IsDouble()) { |
1410 return DoArithmeticD(Token::MUL, instr); | 1416 return DoArithmeticD(Token::MUL, instr); |
1411 | 1417 |
1412 } else { | 1418 } else { |
1413 return DoArithmeticT(Token::MUL, instr); | 1419 return DoArithmeticT(Token::MUL, instr); |
1414 } | 1420 } |
1415 } | 1421 } |
1416 | 1422 |
1417 | 1423 |
1418 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1424 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
1419 if (instr->representation().IsInteger32()) { | 1425 if (instr->representation().IsInteger32()) { |
1420 ASSERT(instr->left()->representation().IsInteger32()); | 1426 ASSERT(instr->left()->representation().IsInteger32()); |
1421 ASSERT(instr->right()->representation().IsInteger32()); | 1427 ASSERT(instr->right()->representation().IsInteger32()); |
1422 LOperand* left = UseRegisterAtStart(instr->left()); | 1428 LOperand* left = UseRegisterAtStart(instr->left()); |
1423 LOperand* right = UseOrConstantAtStart(instr->right()); | 1429 LOperand* right = UseOrConstantAtStart(instr->right()); |
1424 LSubI* sub = new LSubI(left, right); | 1430 LSubI* sub = new LSubI(left, right); |
1425 LInstruction* result = DefineSameAsFirst(sub); | 1431 LInstruction* result = DefineAsRegister(sub); |
1426 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1432 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1427 result = AssignEnvironment(result); | 1433 result = AssignEnvironment(result); |
1428 } | 1434 } |
1429 return result; | 1435 return result; |
1430 } else if (instr->representation().IsDouble()) { | 1436 } else if (instr->representation().IsDouble()) { |
1431 return DoArithmeticD(Token::SUB, instr); | 1437 return DoArithmeticD(Token::SUB, instr); |
1432 } else { | 1438 } else { |
1433 return DoArithmeticT(Token::SUB, instr); | 1439 return DoArithmeticT(Token::SUB, instr); |
1434 } | 1440 } |
1435 } | 1441 } |
1436 | 1442 |
1437 | 1443 |
1438 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1444 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
1439 if (instr->representation().IsInteger32()) { | 1445 if (instr->representation().IsInteger32()) { |
1440 ASSERT(instr->left()->representation().IsInteger32()); | 1446 ASSERT(instr->left()->representation().IsInteger32()); |
1441 ASSERT(instr->right()->representation().IsInteger32()); | 1447 ASSERT(instr->right()->representation().IsInteger32()); |
1442 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1448 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
1443 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1449 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
1444 LAddI* add = new LAddI(left, right); | 1450 LAddI* add = new LAddI(left, right); |
1445 LInstruction* result = DefineSameAsFirst(add); | 1451 LInstruction* result = DefineAsRegister(add); |
1446 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1452 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1447 result = AssignEnvironment(result); | 1453 result = AssignEnvironment(result); |
1448 } | 1454 } |
1449 return result; | 1455 return result; |
1450 } else if (instr->representation().IsDouble()) { | 1456 } else if (instr->representation().IsDouble()) { |
1451 return DoArithmeticD(Token::ADD, instr); | 1457 return DoArithmeticD(Token::ADD, instr); |
1452 } else { | 1458 } else { |
1453 ASSERT(instr->representation().IsTagged()); | 1459 ASSERT(instr->representation().IsTagged()); |
1454 return DoArithmeticT(Token::ADD, instr); | 1460 return DoArithmeticT(Token::ADD, instr); |
1455 } | 1461 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 | 1607 |
1602 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { | 1608 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { |
1603 LOperand* object = UseRegisterAtStart(instr->value()); | 1609 LOperand* object = UseRegisterAtStart(instr->value()); |
1604 return DefineAsRegister(new LElementsKind(object)); | 1610 return DefineAsRegister(new LElementsKind(object)); |
1605 } | 1611 } |
1606 | 1612 |
1607 | 1613 |
1608 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1614 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
1609 LOperand* object = UseRegister(instr->value()); | 1615 LOperand* object = UseRegister(instr->value()); |
1610 LValueOf* result = new LValueOf(object, TempRegister()); | 1616 LValueOf* result = new LValueOf(object, TempRegister()); |
1611 return AssignEnvironment(DefineSameAsFirst(result)); | 1617 return AssignEnvironment(DefineAsRegister(result)); |
1612 } | 1618 } |
1613 | 1619 |
1614 | 1620 |
1615 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1621 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
1616 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), | 1622 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), |
1617 UseRegister(instr->length()))); | 1623 UseRegister(instr->length()))); |
1618 } | 1624 } |
1619 | 1625 |
1620 | 1626 |
1621 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1627 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 ASSERT(to.IsInteger32()); | 1662 ASSERT(to.IsInteger32()); |
1657 LOperand* value = UseRegister(instr->value()); | 1663 LOperand* value = UseRegister(instr->value()); |
1658 bool needs_check = !instr->value()->type().IsSmi(); | 1664 bool needs_check = !instr->value()->type().IsSmi(); |
1659 LInstruction* res = NULL; | 1665 LInstruction* res = NULL; |
1660 if (!needs_check) { | 1666 if (!needs_check) { |
1661 res = DefineSameAsFirst(new LSmiUntag(value, needs_check)); | 1667 res = DefineSameAsFirst(new LSmiUntag(value, needs_check)); |
1662 } else { | 1668 } else { |
1663 LOperand* temp1 = TempRegister(); | 1669 LOperand* temp1 = TempRegister(); |
1664 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() | 1670 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() |
1665 : NULL; | 1671 : NULL; |
1666 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(d3) | 1672 LOperand* temp3 = instr->CanTruncateToInt32() ? FixedTemp(d11) |
1667 : NULL; | 1673 : NULL; |
1668 res = DefineSameAsFirst(new LTaggedToI(value, temp1, temp2, temp3)); | 1674 res = DefineSameAsFirst(new LTaggedToI(value, temp1, temp2, temp3)); |
1669 res = AssignEnvironment(res); | 1675 res = AssignEnvironment(res); |
1670 } | 1676 } |
1671 return res; | 1677 return res; |
1672 } | 1678 } |
1673 } else if (from.IsDouble()) { | 1679 } else if (from.IsDouble()) { |
1674 if (to.IsTagged()) { | 1680 if (to.IsTagged()) { |
1675 LOperand* value = UseRegister(instr->value()); | 1681 LOperand* value = UseRegister(instr->value()); |
1676 LOperand* temp1 = TempRegister(); | 1682 LOperand* temp1 = TempRegister(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 LInstruction* result = new LCheckMap(value); | 1756 LInstruction* result = new LCheckMap(value); |
1751 return AssignEnvironment(result); | 1757 return AssignEnvironment(result); |
1752 } | 1758 } |
1753 | 1759 |
1754 | 1760 |
1755 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { | 1761 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
1756 HValue* value = instr->value(); | 1762 HValue* value = instr->value(); |
1757 Representation input_rep = value->representation(); | 1763 Representation input_rep = value->representation(); |
1758 LOperand* reg = UseRegister(value); | 1764 LOperand* reg = UseRegister(value); |
1759 if (input_rep.IsDouble()) { | 1765 if (input_rep.IsDouble()) { |
1760 return DefineAsRegister(new LClampDToUint8(reg, FixedTemp(d1))); | 1766 return DefineAsRegister(new LClampDToUint8(reg, FixedTemp(d11))); |
1761 } else if (input_rep.IsInteger32()) { | 1767 } else if (input_rep.IsInteger32()) { |
1762 return DefineAsRegister(new LClampIToUint8(reg)); | 1768 return DefineAsRegister(new LClampIToUint8(reg)); |
1763 } else { | 1769 } else { |
1764 ASSERT(input_rep.IsTagged()); | 1770 ASSERT(input_rep.IsTagged()); |
1765 // Register allocator doesn't (yet) support allocation of double | 1771 // Register allocator doesn't (yet) support allocation of double |
1766 // temps. Reserve d1 explicitly. | 1772 // temps. Reserve d1 explicitly. |
1767 LClampTToUint8* result = new LClampTToUint8(reg, FixedTemp(d1)); | 1773 LClampTToUint8* result = new LClampTToUint8(reg, FixedTemp(d11)); |
1768 return AssignEnvironment(DefineAsRegister(result)); | 1774 return AssignEnvironment(DefineAsRegister(result)); |
1769 } | 1775 } |
1770 } | 1776 } |
1771 | 1777 |
1772 | 1778 |
1773 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { | 1779 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { |
1774 HValue* value = instr->value(); | 1780 HValue* value = instr->value(); |
1775 Representation input_rep = value->representation(); | 1781 Representation input_rep = value->representation(); |
1776 LOperand* reg = UseRegister(value); | 1782 LOperand* reg = UseRegister(value); |
1777 if (input_rep.IsDouble()) { | 1783 if (input_rep.IsDouble()) { |
1778 LOperand* temp1 = TempRegister(); | 1784 LOperand* temp1 = TempRegister(); |
1779 LOperand* temp2 = TempRegister(); | 1785 LOperand* temp2 = TempRegister(); |
1780 LDoubleToI* res = new LDoubleToI(reg, temp1, temp2); | 1786 LDoubleToI* res = new LDoubleToI(reg, temp1, temp2); |
1781 return AssignEnvironment(DefineAsRegister(res)); | 1787 return AssignEnvironment(DefineAsRegister(res)); |
1782 } else if (input_rep.IsInteger32()) { | 1788 } else if (input_rep.IsInteger32()) { |
1783 // Canonicalization should already have removed the hydrogen instruction in | 1789 // Canonicalization should already have removed the hydrogen instruction in |
1784 // this case, since it is a noop. | 1790 // this case, since it is a noop. |
1785 UNREACHABLE(); | 1791 UNREACHABLE(); |
1786 return NULL; | 1792 return NULL; |
1787 } else { | 1793 } else { |
1788 ASSERT(input_rep.IsTagged()); | 1794 ASSERT(input_rep.IsTagged()); |
1789 LOperand* temp1 = TempRegister(); | 1795 LOperand* temp1 = TempRegister(); |
1790 LOperand* temp2 = TempRegister(); | 1796 LOperand* temp2 = TempRegister(); |
1791 LOperand* temp3 = FixedTemp(d3); | 1797 LOperand* temp3 = FixedTemp(d11); |
1792 LTaggedToI* res = new LTaggedToI(reg, temp1, temp2, temp3); | 1798 LTaggedToI* res = new LTaggedToI(reg, temp1, temp2, temp3); |
1793 return AssignEnvironment(DefineSameAsFirst(res)); | 1799 return AssignEnvironment(DefineSameAsFirst(res)); |
1794 } | 1800 } |
1795 } | 1801 } |
1796 | 1802 |
1797 | 1803 |
1798 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1804 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
1799 return new LReturn(UseFixed(instr->value(), r0)); | 1805 return new LReturn(UseFixed(instr->value(), r0)); |
1800 } | 1806 } |
1801 | 1807 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 } | 1925 } |
1920 | 1926 |
1921 | 1927 |
1922 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1928 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
1923 HLoadKeyedFastElement* instr) { | 1929 HLoadKeyedFastElement* instr) { |
1924 ASSERT(instr->representation().IsTagged()); | 1930 ASSERT(instr->representation().IsTagged()); |
1925 ASSERT(instr->key()->representation().IsInteger32()); | 1931 ASSERT(instr->key()->representation().IsInteger32()); |
1926 LOperand* obj = UseRegisterAtStart(instr->object()); | 1932 LOperand* obj = UseRegisterAtStart(instr->object()); |
1927 LOperand* key = UseRegisterAtStart(instr->key()); | 1933 LOperand* key = UseRegisterAtStart(instr->key()); |
1928 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1934 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1929 return AssignEnvironment(DefineSameAsFirst(result)); | 1935 return AssignEnvironment(DefineAsRegister(result)); |
1930 } | 1936 } |
1931 | 1937 |
1932 | 1938 |
1933 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1939 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1934 HLoadKeyedSpecializedArrayElement* instr) { | 1940 HLoadKeyedSpecializedArrayElement* instr) { |
1935 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1941 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
1936 Representation representation(instr->representation()); | 1942 Representation representation(instr->representation()); |
1937 ASSERT( | 1943 ASSERT( |
1938 (representation.IsInteger32() && | 1944 (representation.IsInteger32() && |
1939 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1945 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 | 2236 |
2231 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2237 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2232 LOperand* key = UseRegisterAtStart(instr->key()); | 2238 LOperand* key = UseRegisterAtStart(instr->key()); |
2233 LOperand* object = UseRegisterAtStart(instr->object()); | 2239 LOperand* object = UseRegisterAtStart(instr->object()); |
2234 LIn* result = new LIn(key, object); | 2240 LIn* result = new LIn(key, object); |
2235 return MarkAsCall(DefineFixed(result, r0), instr); | 2241 return MarkAsCall(DefineFixed(result, r0), instr); |
2236 } | 2242 } |
2237 | 2243 |
2238 | 2244 |
2239 } } // namespace v8::internal | 2245 } } // namespace v8::internal |
OLD | NEW |