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

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

Issue 6881044: Change the Hydrogen representation of uses. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 LOperand* right = NULL; 845 LOperand* right = NULL;
846 int constant_value = 0; 846 int constant_value = 0;
847 if (right_value->IsConstant()) { 847 if (right_value->IsConstant()) {
848 HConstant* constant = HConstant::cast(right_value); 848 HConstant* constant = HConstant::cast(right_value);
849 right = chunk_->DefineConstantOperand(constant); 849 right = chunk_->DefineConstantOperand(constant);
850 constant_value = constant->Integer32Value() & 0x1f; 850 constant_value = constant->Integer32Value() & 0x1f;
851 } else { 851 } else {
852 right = UseFixed(right_value, ecx); 852 right = UseFixed(right_value, ecx);
853 } 853 }
854 854
855 // Shift operations can only deoptimize if we do a logical shift 855 // Shift operations can only deoptimize if we do a logical shift by 0 and
856 // by 0 and the result cannot be truncated to int32. 856 // the result cannot be truncated to int32.
857 bool can_deopt = (op == Token::SHR && constant_value == 0); 857 bool may_deopt = (op == Token::SHR && constant_value == 0);
858 if (can_deopt) { 858 bool does_deopt = false;
859 bool can_truncate = true; 859 if (may_deopt) {
860 for (int i = 0; i < instr->uses()->length(); i++) { 860 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
861 if (!instr->uses()->at(i)->CheckFlag(HValue::kTruncatingToInt32)) { 861 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
862 can_truncate = false; 862 does_deopt = true;
863 break; 863 break;
864 } 864 }
865 } 865 }
866 can_deopt = !can_truncate;
867 } 866 }
868 867
869 LShiftI* result = new LShiftI(op, left, right, can_deopt); 868 LInstruction* result =
870 return can_deopt 869 DefineSameAsFirst(new LShiftI(op, left, right, does_deopt));
871 ? AssignEnvironment(DefineSameAsFirst(result)) 870 return does_deopt ? AssignEnvironment(result) : result;
872 : DefineSameAsFirst(result);
873 } 871 }
874 872
875 873
876 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, 874 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
877 HArithmeticBinaryOperation* instr) { 875 HArithmeticBinaryOperation* instr) {
878 ASSERT(instr->representation().IsDouble()); 876 ASSERT(instr->representation().IsDouble());
879 ASSERT(instr->left()->representation().IsDouble()); 877 ASSERT(instr->left()->representation().IsDouble());
880 ASSERT(instr->right()->representation().IsDouble()); 878 ASSERT(instr->right()->representation().IsDouble());
881 ASSERT(op != Token::MOD); 879 ASSERT(op != Token::MOD);
882 LOperand* left = UseRegisterAtStart(instr->left()); 880 LOperand* left = UseRegisterAtStart(instr->left());
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 2195 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2198 HEnvironment* outer = current_block_->last_environment()->outer(); 2196 HEnvironment* outer = current_block_->last_environment()->outer();
2199 current_block_->UpdateEnvironment(outer); 2197 current_block_->UpdateEnvironment(outer);
2200 return NULL; 2198 return NULL;
2201 } 2199 }
2202 2200
2203 2201
2204 } } // namespace v8::internal 2202 } } // namespace v8::internal
2205 2203
2206 #endif // V8_TARGET_ARCH_IA32 2204 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698