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

Side by Side Diff: src/hydrogen.cc

Issue 23654041: Ensure constant truncation is only done when it is safe. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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') | src/hydrogen-instructions.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7676 matching lines...) Expand 10 before | Expand all | Expand 10 after
7687 return false; 7687 return false;
7688 } 7688 }
7689 } 7689 }
7690 return true; 7690 return true;
7691 } 7691 }
7692 7692
7693 7693
7694 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Handle<Type>* expected) { 7694 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Handle<Type>* expected) {
7695 if (value->IsConstant()) { 7695 if (value->IsConstant()) {
7696 HConstant* constant = HConstant::cast(value); 7696 HConstant* constant = HConstant::cast(value);
7697 Maybe<HConstant*> number = constant->CopyToTruncatedNumber(zone()); 7697 Maybe<HConstant*> number =
7698 constant->CopyToTruncatedNumberAndAdd(zone(), this);
7698 if (number.has_value) { 7699 if (number.has_value) {
7699 *expected = handle(Type::Number(), isolate()); 7700 *expected = handle(Type::Number(), isolate());
7700 return AddInstruction(number.value); 7701 return number.value;
7701 } 7702 }
7702 } 7703 }
7703 7704
7704 return value; 7705 return value;
7705 } 7706 }
7706 7707
7707 7708
7708 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( 7709 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
7709 BinaryOperation* expr, 7710 BinaryOperation* expr,
7710 HValue* left, 7711 HValue* left,
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after
9704 if (ShouldProduceTraceOutput()) { 9705 if (ShouldProduceTraceOutput()) {
9705 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9706 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9706 } 9707 }
9707 9708
9708 #ifdef DEBUG 9709 #ifdef DEBUG
9709 graph_->Verify(false); // No full verify. 9710 graph_->Verify(false); // No full verify.
9710 #endif 9711 #endif
9711 } 9712 }
9712 9713
9713 } } // namespace v8::internal 9714 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698