OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 LInstruction* LChunkBuilder::DoShl(HShl* instr) { | 1299 LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
1300 return DoShift(Token::SHL, instr); | 1300 return DoShift(Token::SHL, instr); |
1301 } | 1301 } |
1302 | 1302 |
1303 | 1303 |
1304 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { | 1304 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
1305 if (instr->representation().IsInteger32()) { | 1305 if (instr->representation().IsInteger32()) { |
1306 ASSERT(instr->left()->representation().IsInteger32()); | 1306 ASSERT(instr->left()->representation().IsInteger32()); |
1307 ASSERT(instr->right()->representation().IsInteger32()); | 1307 ASSERT(instr->right()->representation().IsInteger32()); |
1308 | 1308 |
1309 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1309 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1310 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1310 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1311 return DefineAsRegister(new(zone()) LBitI(left, right)); | 1311 return DefineAsRegister(new(zone()) LBitI(left, right)); |
1312 } else { | 1312 } else { |
1313 ASSERT(instr->representation().IsTagged()); | 1313 ASSERT(instr->representation().IsTagged()); |
1314 ASSERT(instr->left()->representation().IsTagged()); | 1314 ASSERT(instr->left()->representation().IsTagged()); |
1315 ASSERT(instr->right()->representation().IsTagged()); | 1315 ASSERT(instr->right()->representation().IsTagged()); |
1316 | 1316 |
1317 LOperand* left = UseFixed(instr->left(), a1); | 1317 LOperand* left = UseFixed(instr->left(), a1); |
1318 LOperand* right = UseFixed(instr->right(), a0); | 1318 LOperand* right = UseFixed(instr->right(), a0); |
1319 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right); | 1319 LArithmeticT* result = new(zone()) LArithmeticT(instr->op(), left, right); |
1320 return MarkAsCall(DefineFixed(result, v0), instr); | 1320 return MarkAsCall(DefineFixed(result, v0), instr); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 return MarkAsCall(DefineFixedDouble(result, f2), instr); | 1395 return MarkAsCall(DefineFixedDouble(result, f2), instr); |
1396 } | 1396 } |
1397 } | 1397 } |
1398 | 1398 |
1399 | 1399 |
1400 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1400 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
1401 if (instr->representation().IsInteger32()) { | 1401 if (instr->representation().IsInteger32()) { |
1402 ASSERT(instr->left()->representation().IsInteger32()); | 1402 ASSERT(instr->left()->representation().IsInteger32()); |
1403 ASSERT(instr->right()->representation().IsInteger32()); | 1403 ASSERT(instr->right()->representation().IsInteger32()); |
1404 LOperand* left; | 1404 LOperand* left; |
1405 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1405 LOperand* right = UseOrConstant(instr->BetterRightOperand()); |
1406 LOperand* temp = NULL; | 1406 LOperand* temp = NULL; |
1407 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && | 1407 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
1408 (instr->CheckFlag(HValue::kCanOverflow) || | 1408 (instr->CheckFlag(HValue::kCanOverflow) || |
1409 !right->IsConstantOperand())) { | 1409 !right->IsConstantOperand())) { |
1410 left = UseRegister(instr->LeastConstantOperand()); | 1410 left = UseRegister(instr->BetterLeftOperand()); |
1411 temp = TempRegister(); | 1411 temp = TempRegister(); |
1412 } else { | 1412 } else { |
1413 left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1413 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1414 } | 1414 } |
1415 LMulI* mul = new(zone()) LMulI(left, right, temp); | 1415 LMulI* mul = new(zone()) LMulI(left, right, temp); |
1416 if (instr->CheckFlag(HValue::kCanOverflow) || | 1416 if (instr->CheckFlag(HValue::kCanOverflow) || |
1417 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1417 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1418 AssignEnvironment(mul); | 1418 AssignEnvironment(mul); |
1419 } | 1419 } |
1420 return DefineAsRegister(mul); | 1420 return DefineAsRegister(mul); |
1421 | 1421 |
1422 } else if (instr->representation().IsDouble()) { | 1422 } else if (instr->representation().IsDouble()) { |
1423 if (kArchVariant == kMips32r2) { | 1423 if (kArchVariant == kMips32r2) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 LOperand* addend_op = UseRegisterAtStart(addend); | 1468 LOperand* addend_op = UseRegisterAtStart(addend); |
1469 return DefineSameAsFirst(new(zone()) LMultiplyAddD(addend_op, multiplier_op, | 1469 return DefineSameAsFirst(new(zone()) LMultiplyAddD(addend_op, multiplier_op, |
1470 multiplicand_op)); | 1470 multiplicand_op)); |
1471 } | 1471 } |
1472 | 1472 |
1473 | 1473 |
1474 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1474 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
1475 if (instr->representation().IsInteger32()) { | 1475 if (instr->representation().IsInteger32()) { |
1476 ASSERT(instr->left()->representation().IsInteger32()); | 1476 ASSERT(instr->left()->representation().IsInteger32()); |
1477 ASSERT(instr->right()->representation().IsInteger32()); | 1477 ASSERT(instr->right()->representation().IsInteger32()); |
1478 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1478 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1479 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1479 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1480 LAddI* add = new(zone()) LAddI(left, right); | 1480 LAddI* add = new(zone()) LAddI(left, right); |
1481 LInstruction* result = DefineAsRegister(add); | 1481 LInstruction* result = DefineAsRegister(add); |
1482 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1482 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1483 result = AssignEnvironment(result); | 1483 result = AssignEnvironment(result); |
1484 } | 1484 } |
1485 return result; | 1485 return result; |
1486 } else if (instr->representation().IsDouble()) { | 1486 } else if (instr->representation().IsDouble()) { |
1487 if (kArchVariant == kMips32r2) { | 1487 if (kArchVariant == kMips32r2) { |
1488 if (instr->left()->IsMul()) | 1488 if (instr->left()->IsMul()) |
1489 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); | 1489 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); |
(...skipping 10 matching lines...) Expand all Loading... |
1500 } | 1500 } |
1501 } | 1501 } |
1502 | 1502 |
1503 | 1503 |
1504 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1504 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
1505 LOperand* left = NULL; | 1505 LOperand* left = NULL; |
1506 LOperand* right = NULL; | 1506 LOperand* right = NULL; |
1507 if (instr->representation().IsInteger32()) { | 1507 if (instr->representation().IsInteger32()) { |
1508 ASSERT(instr->left()->representation().IsInteger32()); | 1508 ASSERT(instr->left()->representation().IsInteger32()); |
1509 ASSERT(instr->right()->representation().IsInteger32()); | 1509 ASSERT(instr->right()->representation().IsInteger32()); |
1510 left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1510 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1511 right = UseOrConstantAtStart(instr->MostConstantOperand()); | 1511 right = UseOrConstantAtStart(instr->BetterRightOperand()); |
1512 } else { | 1512 } else { |
1513 ASSERT(instr->representation().IsDouble()); | 1513 ASSERT(instr->representation().IsDouble()); |
1514 ASSERT(instr->left()->representation().IsDouble()); | 1514 ASSERT(instr->left()->representation().IsDouble()); |
1515 ASSERT(instr->right()->representation().IsDouble()); | 1515 ASSERT(instr->right()->representation().IsDouble()); |
1516 left = UseRegisterAtStart(instr->left()); | 1516 left = UseRegisterAtStart(instr->left()); |
1517 right = UseRegisterAtStart(instr->right()); | 1517 right = UseRegisterAtStart(instr->right()); |
1518 } | 1518 } |
1519 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); | 1519 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); |
1520 } | 1520 } |
1521 | 1521 |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 | 2496 |
2497 | 2497 |
2498 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2498 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2499 LOperand* object = UseRegister(instr->object()); | 2499 LOperand* object = UseRegister(instr->object()); |
2500 LOperand* index = UseRegister(instr->index()); | 2500 LOperand* index = UseRegister(instr->index()); |
2501 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2501 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2502 } | 2502 } |
2503 | 2503 |
2504 | 2504 |
2505 } } // namespace v8::internal | 2505 } } // namespace v8::internal |
OLD | NEW |