OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 8723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8734 if (join != NULL) return ast_context()->ReturnValue(Pop()); | 8734 if (join != NULL) return ast_context()->ReturnValue(Pop()); |
8735 } | 8735 } |
8736 | 8736 |
8737 | 8737 |
8738 HInstruction* HOptimizedGraphBuilder::BuildIncrement( | 8738 HInstruction* HOptimizedGraphBuilder::BuildIncrement( |
8739 bool returns_original_input, | 8739 bool returns_original_input, |
8740 CountOperation* expr) { | 8740 CountOperation* expr) { |
8741 // The input to the count operation is on top of the expression stack. | 8741 // The input to the count operation is on top of the expression stack. |
8742 Representation rep = Representation::FromType(expr->type()); | 8742 Representation rep = Representation::FromType(expr->type()); |
8743 if (rep.IsNone() || rep.IsTagged()) { | 8743 if (rep.IsNone() || rep.IsTagged()) { |
8744 rep = Representation::Smi(); | 8744 rep = Representation::FromType(Type::Smi()); |
8745 } | 8745 } |
8746 | 8746 |
8747 if (returns_original_input) { | 8747 if (returns_original_input) { |
8748 // We need an explicit HValue representing ToNumber(input). The | 8748 // We need an explicit HValue representing ToNumber(input). The |
8749 // actual HChange instruction we need is (sometimes) added in a later | 8749 // actual HChange instruction we need is (sometimes) added in a later |
8750 // phase, so it is not available now to be used as an input to HAdd and | 8750 // phase, so it is not available now to be used as an input to HAdd and |
8751 // as the return value. | 8751 // as the return value. |
8752 HInstruction* number_input = AddUncasted<HForceRepresentation>(Pop(), rep); | 8752 HInstruction* number_input = AddUncasted<HForceRepresentation>(Pop(), rep); |
8753 if (!rep.IsDouble()) { | 8753 if (!rep.IsDouble()) { |
8754 number_input->SetFlag(HInstruction::kFlexibleRepresentation); | 8754 number_input->SetFlag(HInstruction::kFlexibleRepresentation); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8984 (right_const->Integer32Value() & 0x1f) != 0) { | 8984 (right_const->Integer32Value() & 0x1f) != 0) { |
8985 return false; | 8985 return false; |
8986 } | 8986 } |
8987 } | 8987 } |
8988 return true; | 8988 return true; |
8989 } | 8989 } |
8990 | 8990 |
8991 | 8991 |
8992 HValue* HGraphBuilder::EnforceNumberType(HValue* number, | 8992 HValue* HGraphBuilder::EnforceNumberType(HValue* number, |
8993 Type* expected) { | 8993 Type* expected) { |
8994 if (expected->Is(Type::Smi())) { | 8994 return AddUncasted<HForceRepresentation>( |
8995 return AddUncasted<HForceRepresentation>(number, Representation::Smi()); | 8995 number, Representation::FromType(expected)); |
8996 } | |
8997 if (expected->Is(Type::Signed32())) { | |
8998 return AddUncasted<HForceRepresentation>(number, | |
8999 Representation::Integer32()); | |
9000 } | |
9001 return number; | |
9002 } | 8996 } |
9003 | 8997 |
9004 | 8998 |
9005 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) { | 8999 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) { |
9006 if (value->IsConstant()) { | 9000 if (value->IsConstant()) { |
9007 HConstant* constant = HConstant::cast(value); | 9001 HConstant* constant = HConstant::cast(value); |
9008 Maybe<HConstant*> number = constant->CopyToTruncatedNumber(zone()); | 9002 Maybe<HConstant*> number = constant->CopyToTruncatedNumber(zone()); |
9009 if (number.has_value) { | 9003 if (number.has_value) { |
9010 *expected = Type::Number(zone()); | 9004 *expected = Type::Number(zone()); |
9011 return AddInstruction(number.value); | 9005 return AddInstruction(number.value); |
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11273 if (ShouldProduceTraceOutput()) { | 11267 if (ShouldProduceTraceOutput()) { |
11274 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11268 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11275 } | 11269 } |
11276 | 11270 |
11277 #ifdef DEBUG | 11271 #ifdef DEBUG |
11278 graph_->Verify(false); // No full verify. | 11272 graph_->Verify(false); // No full verify. |
11279 #endif | 11273 #endif |
11280 } | 11274 } |
11281 | 11275 |
11282 } } // namespace v8::internal | 11276 } } // namespace v8::internal |
OLD | NEW |