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

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

Issue 10778029: Allow uint32 value on optimized frames if they are consumed by safe operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: arm and x64 ports Created 8 years, 4 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
OLDNEW
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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 LOperand* right = NULL; 731 LOperand* right = NULL;
732 int constant_value = 0; 732 int constant_value = 0;
733 if (right_value->IsConstant()) { 733 if (right_value->IsConstant()) {
734 HConstant* constant = HConstant::cast(right_value); 734 HConstant* constant = HConstant::cast(right_value);
735 right = chunk_->DefineConstantOperand(constant); 735 right = chunk_->DefineConstantOperand(constant);
736 constant_value = constant->Integer32Value() & 0x1f; 736 constant_value = constant->Integer32Value() & 0x1f;
737 } else { 737 } else {
738 right = UseFixed(right_value, ecx); 738 right = UseFixed(right_value, ecx);
739 } 739 }
740 740
741 // Shift operations can only deoptimize if we do a logical shift by 0 and
742 // the result cannot be truncated to int32.
743 bool may_deopt = (op == Token::SHR && constant_value == 0);
744 bool does_deopt = false; 741 bool does_deopt = false;
745 if (may_deopt) { 742 if (FLAG_opt_safe_uint32_operations) {
746 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 743 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
747 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { 744 } else {
748 does_deopt = true; 745 // Shift operations can only deoptimize if we do a logical shift by 0 and
749 break; 746 // the result cannot be truncated to int32.
747 bool may_deopt = (op == Token::SHR && constant_value == 0 &&
748 !instr->CheckFlag(HInstruction::kUint32));
749 if (may_deopt) {
750 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
751 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
752 does_deopt = true;
753 break;
754 }
750 } 755 }
751 } 756 }
752 } 757 }
753 758
754 LInstruction* result = 759 LInstruction* result =
755 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); 760 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt));
756 return does_deopt ? AssignEnvironment(result) : result; 761 return does_deopt ? AssignEnvironment(result) : result;
757 } 762 }
758 763
759 764
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 904
900 HValue* value = hydrogen_env->values()->at(i); 905 HValue* value = hydrogen_env->values()->at(i);
901 LOperand* op = NULL; 906 LOperand* op = NULL;
902 if (value->IsArgumentsObject()) { 907 if (value->IsArgumentsObject()) {
903 op = NULL; 908 op = NULL;
904 } else if (value->IsPushArgument()) { 909 } else if (value->IsPushArgument()) {
905 op = new(zone()) LArgument(argument_index++); 910 op = new(zone()) LArgument(argument_index++);
906 } else { 911 } else {
907 op = UseAny(value); 912 op = UseAny(value);
908 } 913 }
909 result->AddValue(op, value->representation()); 914 result->AddValue(op,
915 value->representation(),
916 value->CheckFlag(HInstruction::kUint32));
910 } 917 }
911 918
912 if (hydrogen_env->frame_type() == JS_FUNCTION) { 919 if (hydrogen_env->frame_type() == JS_FUNCTION) {
913 *argument_index_accumulator = argument_index; 920 *argument_index_accumulator = argument_index;
914 } 921 }
915 922
916 return result; 923 return result;
917 } 924 }
918 925
919 926
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 LOperand* temp = needs_temp ? TempRegister() : NULL; 1698 LOperand* temp = needs_temp ? TempRegister() : NULL;
1692 return AssignEnvironment( 1699 return AssignEnvironment(
1693 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); 1700 DefineAsRegister(new(zone()) LDoubleToI(value, temp)));
1694 } 1701 }
1695 } else if (from.IsInteger32()) { 1702 } else if (from.IsInteger32()) {
1696 if (to.IsTagged()) { 1703 if (to.IsTagged()) {
1697 HValue* val = instr->value(); 1704 HValue* val = instr->value();
1698 LOperand* value = UseRegister(val); 1705 LOperand* value = UseRegister(val);
1699 if (val->HasRange() && val->range()->IsInSmiRange()) { 1706 if (val->HasRange() && val->range()->IsInSmiRange()) {
1700 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1707 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1708 } else if (val->CheckFlag(HInstruction::kUint32)) {
1709 LOperand* temp = FixedTemp(xmm1);
1710 LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
1711 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1701 } else { 1712 } else {
1702 LNumberTagI* result = new(zone()) LNumberTagI(value); 1713 LNumberTagI* result = new(zone()) LNumberTagI(value);
1703 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1714 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1704 } 1715 }
1705 } else { 1716 } else {
1706 ASSERT(to.IsDouble()); 1717 ASSERT(to.IsDouble());
1707 return DefineAsRegister( 1718 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1708 new(zone()) LInteger32ToDouble(Use(instr->value()))); 1719 LOperand* temp = FixedTemp(xmm1);
1720 return DefineAsRegister(
1721 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp));
1722 } else {
1723 return DefineAsRegister(
1724 new(zone()) LInteger32ToDouble(Use(instr->value())));
1725 }
1709 } 1726 }
1710 } 1727 }
1711 UNREACHABLE(); 1728 UNREACHABLE();
1712 return NULL; 1729 return NULL;
1713 } 1730 }
1714 1731
1715 1732
1716 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { 1733 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1717 LOperand* value = UseAtStart(instr->value()); 1734 LOperand* value = UseAtStart(instr->value());
1718 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); 1735 return AssignEnvironment(new(zone()) LCheckNonSmi(value));
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2433 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2417 LOperand* object = UseRegister(instr->object()); 2434 LOperand* object = UseRegister(instr->object());
2418 LOperand* index = UseTempRegister(instr->index()); 2435 LOperand* index = UseTempRegister(instr->index());
2419 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2436 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2420 } 2437 }
2421 2438
2422 2439
2423 } } // namespace v8::internal 2440 } } // namespace v8::internal
2424 2441
2425 #endif // V8_TARGET_ARCH_IA32 2442 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698