| 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 8722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8733 if (join != NULL) return ast_context()->ReturnValue(Pop()); | 8733 if (join != NULL) return ast_context()->ReturnValue(Pop()); |
| 8734 } | 8734 } |
| 8735 | 8735 |
| 8736 | 8736 |
| 8737 HInstruction* HOptimizedGraphBuilder::BuildIncrement( | 8737 HInstruction* HOptimizedGraphBuilder::BuildIncrement( |
| 8738 bool returns_original_input, | 8738 bool returns_original_input, |
| 8739 CountOperation* expr) { | 8739 CountOperation* expr) { |
| 8740 // The input to the count operation is on top of the expression stack. | 8740 // The input to the count operation is on top of the expression stack. |
| 8741 Representation rep = Representation::FromType(expr->type()); | 8741 Representation rep = Representation::FromType(expr->type()); |
| 8742 if (rep.IsNone() || rep.IsTagged()) { | 8742 if (rep.IsNone() || rep.IsTagged()) { |
| 8743 rep = Representation::FromType(Type::Smi()); | 8743 rep = Representation::Smi(); |
| 8744 } | 8744 } |
| 8745 | 8745 |
| 8746 if (returns_original_input) { | 8746 if (returns_original_input) { |
| 8747 // We need an explicit HValue representing ToNumber(input). The | 8747 // We need an explicit HValue representing ToNumber(input). The |
| 8748 // actual HChange instruction we need is (sometimes) added in a later | 8748 // actual HChange instruction we need is (sometimes) added in a later |
| 8749 // phase, so it is not available now to be used as an input to HAdd and | 8749 // phase, so it is not available now to be used as an input to HAdd and |
| 8750 // as the return value. | 8750 // as the return value. |
| 8751 HInstruction* number_input = AddUncasted<HForceRepresentation>(Pop(), rep); | 8751 HInstruction* number_input = AddUncasted<HForceRepresentation>(Pop(), rep); |
| 8752 if (!rep.IsDouble()) { | 8752 if (!rep.IsDouble()) { |
| 8753 number_input->SetFlag(HInstruction::kFlexibleRepresentation); | 8753 number_input->SetFlag(HInstruction::kFlexibleRepresentation); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8983 (right_const->Integer32Value() & 0x1f) != 0) { | 8983 (right_const->Integer32Value() & 0x1f) != 0) { |
| 8984 return false; | 8984 return false; |
| 8985 } | 8985 } |
| 8986 } | 8986 } |
| 8987 return true; | 8987 return true; |
| 8988 } | 8988 } |
| 8989 | 8989 |
| 8990 | 8990 |
| 8991 HValue* HGraphBuilder::EnforceNumberType(HValue* number, | 8991 HValue* HGraphBuilder::EnforceNumberType(HValue* number, |
| 8992 Type* expected) { | 8992 Type* expected) { |
| 8993 return AddUncasted<HForceRepresentation>( | 8993 if (expected->Is(Type::Smi())) { |
| 8994 number, Representation::FromType(expected)); | 8994 return AddUncasted<HForceRepresentation>(number, Representation::Smi()); |
| 8995 } |
| 8996 if (expected->Is(Type::Signed32())) { |
| 8997 return AddUncasted<HForceRepresentation>(number, |
| 8998 Representation::Integer32()); |
| 8999 } |
| 9000 return number; |
| 8995 } | 9001 } |
| 8996 | 9002 |
| 8997 | 9003 |
| 8998 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) { | 9004 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) { |
| 8999 if (value->IsConstant()) { | 9005 if (value->IsConstant()) { |
| 9000 HConstant* constant = HConstant::cast(value); | 9006 HConstant* constant = HConstant::cast(value); |
| 9001 Maybe<HConstant*> number = constant->CopyToTruncatedNumber(zone()); | 9007 Maybe<HConstant*> number = constant->CopyToTruncatedNumber(zone()); |
| 9002 if (number.has_value) { | 9008 if (number.has_value) { |
| 9003 *expected = Type::Number(zone()); | 9009 *expected = Type::Number(zone()); |
| 9004 return AddInstruction(number.value); | 9010 return AddInstruction(number.value); |
| (...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11295 if (ShouldProduceTraceOutput()) { | 11301 if (ShouldProduceTraceOutput()) { |
| 11296 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11302 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11297 } | 11303 } |
| 11298 | 11304 |
| 11299 #ifdef DEBUG | 11305 #ifdef DEBUG |
| 11300 graph_->Verify(false); // No full verify. | 11306 graph_->Verify(false); // No full verify. |
| 11301 #endif | 11307 #endif |
| 11302 } | 11308 } |
| 11303 | 11309 |
| 11304 } } // namespace v8::internal | 11310 } } // namespace v8::internal |
| OLD | NEW |