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