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