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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 } | 1300 } |
1301 | 1301 |
1302 | 1302 |
1303 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { | 1303 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
1304 if (instr->representation().IsSmiOrInteger32()) { | 1304 if (instr->representation().IsSmiOrInteger32()) { |
1305 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1305 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1306 DCHECK(instr->right()->representation().Equals(instr->representation())); | 1306 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1307 DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32)); | 1307 DCHECK(instr->CheckFlag(HValue::kTruncatingToInt32)); |
1308 | 1308 |
1309 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1309 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
1310 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); | 1310 LOperand* right; |
| 1311 if (SmiValuesAre32Bits() && instr->representation().IsSmi()) { |
| 1312 // We don't support tagged immediates, so we request it in a register. |
| 1313 right = UseRegisterAtStart(instr->BetterRightOperand()); |
| 1314 } else { |
| 1315 right = UseOrConstantAtStart(instr->BetterRightOperand()); |
| 1316 } |
1311 return DefineSameAsFirst(new(zone()) LBitI(left, right)); | 1317 return DefineSameAsFirst(new(zone()) LBitI(left, right)); |
1312 } else { | 1318 } else { |
1313 return DoArithmeticT(instr->op(), instr); | 1319 return DoArithmeticT(instr->op(), instr); |
1314 } | 1320 } |
1315 } | 1321 } |
1316 | 1322 |
1317 | 1323 |
1318 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) { | 1324 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) { |
1319 DCHECK(instr->representation().IsSmiOrInteger32()); | 1325 DCHECK(instr->representation().IsSmiOrInteger32()); |
1320 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1326 DCHECK(instr->left()->representation().Equals(instr->representation())); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 return DoArithmeticT(Token::MUL, instr); | 1548 return DoArithmeticT(Token::MUL, instr); |
1543 } | 1549 } |
1544 } | 1550 } |
1545 | 1551 |
1546 | 1552 |
1547 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1553 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
1548 if (instr->representation().IsSmiOrInteger32()) { | 1554 if (instr->representation().IsSmiOrInteger32()) { |
1549 DCHECK(instr->left()->representation().Equals(instr->representation())); | 1555 DCHECK(instr->left()->representation().Equals(instr->representation())); |
1550 DCHECK(instr->right()->representation().Equals(instr->representation())); | 1556 DCHECK(instr->right()->representation().Equals(instr->representation())); |
1551 LOperand* left = UseRegisterAtStart(instr->left()); | 1557 LOperand* left = UseRegisterAtStart(instr->left()); |
1552 LOperand* right = UseOrConstantAtStart(instr->right()); | 1558 LOperand* right; |
| 1559 if (SmiValuesAre32Bits() && instr->representation().IsSmi()) { |
| 1560 // We don't support tagged immediates, so we request it in a register. |
| 1561 right = UseRegisterAtStart(instr->right()); |
| 1562 } else { |
| 1563 right = UseOrConstantAtStart(instr->right()); |
| 1564 } |
1553 LSubI* sub = new(zone()) LSubI(left, right); | 1565 LSubI* sub = new(zone()) LSubI(left, right); |
1554 LInstruction* result = DefineSameAsFirst(sub); | 1566 LInstruction* result = DefineSameAsFirst(sub); |
1555 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1567 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1556 result = AssignEnvironment(result); | 1568 result = AssignEnvironment(result); |
1557 } | 1569 } |
1558 return result; | 1570 return result; |
1559 } else if (instr->representation().IsDouble()) { | 1571 } else if (instr->representation().IsDouble()) { |
1560 return DoArithmeticD(Token::SUB, instr); | 1572 return DoArithmeticD(Token::SUB, instr); |
1561 } else { | 1573 } else { |
1562 return DoArithmeticT(Token::SUB, instr); | 1574 return DoArithmeticT(Token::SUB, instr); |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 LAllocateBlockContext* result = | 2737 LAllocateBlockContext* result = |
2726 new(zone()) LAllocateBlockContext(context, function); | 2738 new(zone()) LAllocateBlockContext(context, function); |
2727 return MarkAsCall(DefineFixed(result, rsi), instr); | 2739 return MarkAsCall(DefineFixed(result, rsi), instr); |
2728 } | 2740 } |
2729 | 2741 |
2730 | 2742 |
2731 } // namespace internal | 2743 } // namespace internal |
2732 } // namespace v8 | 2744 } // namespace v8 |
2733 | 2745 |
2734 #endif // V8_TARGET_ARCH_X64 | 2746 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |