Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: src/x64/lithium-x64.cc

Issue 321373002: Update Lithium AddI, SubI, MulI, BitI, ShiftI, MathMinMax to support x32 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/lithium-allocator-inl.h" 9 #include "src/lithium-allocator-inl.h"
10 #include "src/x64/lithium-x64.h" 10 #include "src/x64/lithium-x64.h"
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 LInstruction* LChunkBuilder::DoShift(Token::Value op, 692 LInstruction* LChunkBuilder::DoShift(Token::Value op,
693 HBitwiseBinaryOperation* instr) { 693 HBitwiseBinaryOperation* instr) {
694 if (instr->representation().IsSmiOrInteger32()) { 694 if (instr->representation().IsSmiOrInteger32()) {
695 ASSERT(instr->left()->representation().Equals(instr->representation())); 695 ASSERT(instr->left()->representation().Equals(instr->representation()));
696 ASSERT(instr->right()->representation().Equals(instr->representation())); 696 ASSERT(instr->right()->representation().Equals(instr->representation()));
697 LOperand* left = UseRegisterAtStart(instr->left()); 697 LOperand* left = UseRegisterAtStart(instr->left());
698 698
699 HValue* right_value = instr->right(); 699 HValue* right_value = instr->right();
700 LOperand* right = NULL; 700 LOperand* right = NULL;
701 int constant_value = 0; 701 int constant_value = 0;
702 bool does_deopt = false;
702 if (right_value->IsConstant()) { 703 if (right_value->IsConstant()) {
703 HConstant* constant = HConstant::cast(right_value); 704 HConstant* constant = HConstant::cast(right_value);
704 right = chunk_->DefineConstantOperand(constant); 705 right = chunk_->DefineConstantOperand(constant);
705 constant_value = constant->Integer32Value() & 0x1f; 706 constant_value = constant->Integer32Value() & 0x1f;
707 if (SmiValuesAre31Bits() && instr->representation().IsSmi() &&
708 constant_value > 0) {
709 // Left shift can deoptimize if we shift by > 0 and the result
710 // cannot be truncated to smi.
711 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
712 }
706 } else { 713 } else {
707 right = UseFixed(right_value, rcx); 714 right = UseFixed(right_value, rcx);
708 } 715 }
709 716
710 // Shift operations can only deoptimize if we do a logical shift by 0 and 717 // Shift operations can only deoptimize if we do a logical shift by 0 and
711 // the result cannot be truncated to int32. 718 // the result cannot be truncated to int32.
712 bool does_deopt = false;
713 if (op == Token::SHR && constant_value == 0) { 719 if (op == Token::SHR && constant_value == 0) {
714 if (FLAG_opt_safe_uint32_operations) { 720 if (FLAG_opt_safe_uint32_operations) {
715 does_deopt = !instr->CheckFlag(HInstruction::kUint32); 721 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
716 } else { 722 } else {
717 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32); 723 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
718 } 724 }
719 } 725 }
720 726
721 LInstruction* result = 727 LInstruction* result =
722 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); 728 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt));
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 // Check to see if it would be advantageous to use an lea instruction rather 1520 // Check to see if it would be advantageous to use an lea instruction rather
1515 // than an add. This is the case when no overflow check is needed and there 1521 // than an add. This is the case when no overflow check is needed and there
1516 // are multiple uses of the add's inputs, so using a 3-register add will 1522 // are multiple uses of the add's inputs, so using a 3-register add will
1517 // preserve all input values for later uses. 1523 // preserve all input values for later uses.
1518 bool use_lea = LAddI::UseLea(instr); 1524 bool use_lea = LAddI::UseLea(instr);
1519 ASSERT(instr->left()->representation().Equals(instr->representation())); 1525 ASSERT(instr->left()->representation().Equals(instr->representation()));
1520 ASSERT(instr->right()->representation().Equals(instr->representation())); 1526 ASSERT(instr->right()->representation().Equals(instr->representation()));
1521 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); 1527 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1522 HValue* right_candidate = instr->BetterRightOperand(); 1528 HValue* right_candidate = instr->BetterRightOperand();
1523 LOperand* right; 1529 LOperand* right;
1524 if (instr->representation().IsSmi()) { 1530 if (SmiValuesAre32Bits() && instr->representation().IsSmi()) {
1525 // We cannot add a tagged immediate to a tagged value, 1531 // We cannot add a tagged immediate to a tagged value,
1526 // so we request it in a register. 1532 // so we request it in a register.
1527 right = UseRegisterAtStart(right_candidate); 1533 right = UseRegisterAtStart(right_candidate);
1528 } else { 1534 } else {
1529 right = use_lea ? UseRegisterOrConstantAtStart(right_candidate) 1535 right = use_lea ? UseRegisterOrConstantAtStart(right_candidate)
1530 : UseOrConstantAtStart(right_candidate); 1536 : UseOrConstantAtStart(right_candidate);
1531 } 1537 }
1532 LAddI* add = new(zone()) LAddI(left, right); 1538 LAddI* add = new(zone()) LAddI(left, right);
1533 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); 1539 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1534 LInstruction* result = use_lea ? DefineAsRegister(add) 1540 LInstruction* result = use_lea ? DefineAsRegister(add)
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 LOperand* function = UseRegisterAtStart(instr->function()); 2603 LOperand* function = UseRegisterAtStart(instr->function());
2598 LAllocateBlockContext* result = 2604 LAllocateBlockContext* result =
2599 new(zone()) LAllocateBlockContext(context, function); 2605 new(zone()) LAllocateBlockContext(context, function);
2600 return MarkAsCall(DefineFixed(result, rsi), instr); 2606 return MarkAsCall(DefineFixed(result, rsi), instr);
2601 } 2607 }
2602 2608
2603 2609
2604 } } // namespace v8::internal 2610 } } // namespace v8::internal
2605 2611
2606 #endif // V8_TARGET_ARCH_X64 2612 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698