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

Side by Side Diff: src/hydrogen.cc

Issue 17028017: Flexible representation for BuildIncrement, but CannotBeTagged. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Let inferrepr figure out the repr of the add Created 7 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 | « no previous file | src/hydrogen-instructions.h » ('j') | 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 // 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 2935 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 for (int j = 0; j < phis->length(); ++j) { 2946 for (int j = 0; j < phis->length(); ++j) {
2947 HPhi* phi = phis->at(j); 2947 HPhi* phi = phis->at(j);
2948 if (phi->representation().IsNone()) { 2948 if (phi->representation().IsNone()) {
2949 phi->ChangeRepresentation(Representation::Tagged()); 2949 phi->ChangeRepresentation(Representation::Tagged());
2950 } 2950 }
2951 } 2951 }
2952 for (HInstruction* current = block->first(); 2952 for (HInstruction* current = block->first();
2953 current != NULL; current = current->next()) { 2953 current != NULL; current = current->next()) {
2954 if (current->representation().IsNone() && 2954 if (current->representation().IsNone() &&
2955 current->CheckFlag(HInstruction::kFlexibleRepresentation)) { 2955 current->CheckFlag(HInstruction::kFlexibleRepresentation)) {
2956 current->ChangeRepresentation(Representation::Tagged()); 2956 if (current->CheckFlag(HInstruction::kCannotBeTagged)) {
2957 current->ChangeRepresentation(Representation::Double());
2958 } else {
2959 current->ChangeRepresentation(Representation::Tagged());
2960 }
2957 } 2961 }
2958 } 2962 }
2959 } 2963 }
2960 } 2964 }
2961 2965
2962 2966
2963 void HGraph::MergeRemovableSimulates() { 2967 void HGraph::MergeRemovableSimulates() {
2964 HPhase phase("H_Merge removable simulates", this); 2968 HPhase phase("H_Merge removable simulates", this);
2965 ZoneList<HSimulate*> mergelist(2, zone()); 2969 ZoneList<HSimulate*> mergelist(2, zone());
2966 for (int i = 0; i < blocks()->length(); ++i) { 2970 for (int i = 0; i < blocks()->length(); ++i) {
(...skipping 6208 matching lines...) Expand 10 before | Expand all | Expand 10 after
9175 if (join != NULL) return ast_context()->ReturnValue(Pop()); 9179 if (join != NULL) return ast_context()->ReturnValue(Pop());
9176 } 9180 }
9177 9181
9178 9182
9179 HInstruction* HOptimizedGraphBuilder::BuildIncrement( 9183 HInstruction* HOptimizedGraphBuilder::BuildIncrement(
9180 bool returns_original_input, 9184 bool returns_original_input,
9181 CountOperation* expr) { 9185 CountOperation* expr) {
9182 // The input to the count operation is on top of the expression stack. 9186 // The input to the count operation is on top of the expression stack.
9183 TypeInfo info = expr->type(); 9187 TypeInfo info = expr->type();
9184 Representation rep = ToRepresentation(info); 9188 Representation rep = ToRepresentation(info);
9185 if (rep.IsTagged()) { 9189 if (rep.IsNone() || rep.IsTagged()) {
9186 rep = Representation::Integer32(); 9190 rep = Representation::Smi();
9187 } 9191 }
9188 9192
9189 if (returns_original_input) { 9193 if (returns_original_input) {
9190 // We need an explicit HValue representing ToNumber(input). The 9194 // We need an explicit HValue representing ToNumber(input). The
9191 // actual HChange instruction we need is (sometimes) added in a later 9195 // actual HChange instruction we need is (sometimes) added in a later
9192 // phase, so it is not available now to be used as an input to HAdd and 9196 // phase, so it is not available now to be used as an input to HAdd and
9193 // as the return value. 9197 // as the return value.
9194 HInstruction* number_input = new(zone()) HForceRepresentation(Pop(), rep); 9198 HInstruction* number_input = new(zone()) HForceRepresentation(Pop(), rep);
9199 if (!rep.IsDouble()) {
9200 number_input->SetFlag(HInstruction::kFlexibleRepresentation);
9201 number_input->SetFlag(HInstruction::kCannotBeTagged);
9202 }
9195 AddInstruction(number_input); 9203 AddInstruction(number_input);
9196 Push(number_input); 9204 Push(number_input);
9197 } 9205 }
9198 9206
9199 // The addition has no side effects, so we do not need 9207 // The addition has no side effects, so we do not need
9200 // to simulate the expression stack after this instruction. 9208 // to simulate the expression stack after this instruction.
9201 // Any later failures deopt to the load of the input or earlier. 9209 // Any later failures deopt to the load of the input or earlier.
9202 HConstant* delta = (expr->op() == Token::INC) 9210 HConstant* delta = (expr->op() == Token::INC)
9203 ? graph()->GetConstant1() 9211 ? graph()->GetConstant1()
9204 : graph()->GetConstantMinus1(); 9212 : graph()->GetConstantMinus1();
9205 HValue* context = environment()->LookupContext(); 9213 HValue* context = environment()->LookupContext();
9206 HInstruction* instr = HAdd::New(zone(), context, Top(), delta); 9214 HInstruction* instr = HAdd::New(zone(), context, Top(), delta);
9207 // We can't insert a simulate here, because it would break deoptimization, 9215 instr->SetFlag(HInstruction::kCannotBeTagged);
9208 // so the HAdd must not have side effects, so we must freeze its
9209 // representation.
9210 instr->AssumeRepresentation(rep);
9211 instr->ClearAllSideEffects(); 9216 instr->ClearAllSideEffects();
9212 AddInstruction(instr); 9217 AddInstruction(instr);
9213 return instr; 9218 return instr;
9214 } 9219 }
9215 9220
9216 9221
9217 void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) { 9222 void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
9218 ASSERT(!HasStackOverflow()); 9223 ASSERT(!HasStackOverflow());
9219 ASSERT(current_block() != NULL); 9224 ASSERT(current_block() != NULL);
9220 ASSERT(current_block()->HasPredecessor()); 9225 ASSERT(current_block()->HasPredecessor());
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after
11654 } 11659 }
11655 } 11660 }
11656 11661
11657 #ifdef DEBUG 11662 #ifdef DEBUG
11658 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11663 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11659 if (allocator_ != NULL) allocator_->Verify(); 11664 if (allocator_ != NULL) allocator_->Verify();
11660 #endif 11665 #endif
11661 } 11666 }
11662 11667
11663 } } // namespace v8::internal 11668 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698