OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 } | 1306 } |
1307 | 1307 |
1308 | 1308 |
1309 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { | 1309 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
1310 if (instr->representation().IsSmiOrInteger32()) { | 1310 if (instr->representation().IsSmiOrInteger32()) { |
1311 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1311 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1312 DCHECK(instr->right()->representation().Equals(instr->representation())); | 1312 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1313 DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32)); | 1313 DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32)); |
1314 | 1314 |
1315 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1315 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1316 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1316 LOperand* right; |
| 1317 if (SmiValuesAre32Bits() && instr->representation().IsSmi()) { |
| 1318 // We don't support tagged immediates, so we request it in a register. |
| 1319 right = UseRegisterAtStart(instr->BetterRightOperand()); |
| 1320 } else { |
| 1321 right = UseOrConstantAtStart(instr->BetterRightOperand()); |
| 1322 } |
1317 return DefineSameAsFirst(new(zone()) LBitI(left, right)); | 1323 return DefineSameAsFirst(new(zone()) LBitI(left, right)); |
1318 } else { | 1324 } else { |
1319 return DoArithmeticT(instr->op(), instr); | 1325 return DoArithmeticT(instr->op(), instr); |
1320 } | 1326 } |
1321 } | 1327 } |
1322 | 1328 |
1323 | 1329 |
1324 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) { | 1330 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) { |
1325 DCHECK(instr->representation().IsSmiOrInteger32()); | 1331 DCHECK(instr->representation().IsSmiOrInteger32()); |
1326 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1332 DCHECK(instr->left()->representation().Equals(instr->representation())); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 return DoArithmeticT(Token::MUL, instr); | 1554 return DoArithmeticT(Token::MUL, instr); |
1549 } | 1555 } |
1550 } | 1556 } |
1551 | 1557 |
1552 | 1558 |
1553 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1559 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
1554 if (instr->representation().IsSmiOrInteger32()) { | 1560 if (instr->representation().IsSmiOrInteger32()) { |
1555 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1561 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1556 DCHECK(instr->right()->representation().Equals(instr->representation())); | 1562 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1557 LOperand* left = UseRegisterAtStart(instr->left()); | 1563 LOperand* left = UseRegisterAtStart(instr->left()); |
1558 LOperand* right = UseOrConstantAtStart(instr->right()); | 1564 LOperand* right; |
| 1565 if (SmiValuesAre32Bits() && instr->representation().IsSmi()) { |
| 1566 // We don't support tagged immediates, so we request it in a register. |
| 1567 right = UseRegisterAtStart(instr->right()); |
| 1568 } else { |
| 1569 right = UseOrConstantAtStart(instr->right()); |
| 1570 } |
1559 LSubI* sub = new(zone()) LSubI(left, right); | 1571 LSubI* sub = new(zone()) LSubI(left, right); |
1560 LInstruction* result = DefineSameAsFirst(sub); | 1572 LInstruction* result = DefineSameAsFirst(sub); |
1561 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1573 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1562 result = AssignEnvironment(result); | 1574 result = AssignEnvironment(result); |
1563 } | 1575 } |
1564 return result; | 1576 return result; |
1565 } else if (instr->representation().IsDouble()) { | 1577 } else if (instr->representation().IsDouble()) { |
1566 return DoArithmeticD(Token::SUB, instr); | 1578 return DoArithmeticD(Token::SUB, instr); |
1567 } else { | 1579 } else { |
1568 return DoArithmeticT(Token::SUB, instr); | 1580 return DoArithmeticT(Token::SUB, instr); |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 LOperand* function = UseRegisterAtStart(instr->function()); | 2714 LOperand* function = UseRegisterAtStart(instr->function()); |
2703 LAllocateBlockContext* result = | 2715 LAllocateBlockContext* result = |
2704 new(zone()) LAllocateBlockContext(context, function); | 2716 new(zone()) LAllocateBlockContext(context, function); |
2705 return MarkAsCall(DefineFixed(result, rsi), instr); | 2717 return MarkAsCall(DefineFixed(result, rsi), instr); |
2706 } | 2718 } |
2707 | 2719 |
2708 | 2720 |
2709 } } // namespace v8::internal | 2721 } } // namespace v8::internal |
2710 | 2722 |
2711 #endif // V8_TARGET_ARCH_X64 | 2723 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |