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

Side by Side Diff: src/hydrogen.cc

Issue 206183003: Use HBoundsCheck to check string length. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | no next file » | no next file with comments »
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 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 } 1786 }
1787 1787
1788 return object; 1788 return object;
1789 } 1789 }
1790 1790
1791 1791
1792 HValue* HGraphBuilder::BuildAddStringLengths(HValue* left_length, 1792 HValue* HGraphBuilder::BuildAddStringLengths(HValue* left_length,
1793 HValue* right_length) { 1793 HValue* right_length) {
1794 // Compute the combined string length and check against max string length. 1794 // Compute the combined string length and check against max string length.
1795 HValue* length = AddUncasted<HAdd>(left_length, right_length); 1795 HValue* length = AddUncasted<HAdd>(left_length, right_length);
1796 IfBuilder if_nooverflow(this); 1796 HValue* max_length = Add<HConstant>(String::kMaxLength);
1797 if_nooverflow.If<HCompareNumericAndBranch>( 1797 Add<HBoundsCheck>(length, max_length);
1798 length, Add<HConstant>(String::kMaxLength), Token::LTE);
1799 if_nooverflow.Then();
1800 if_nooverflow.ElseDeopt("String length exceeds limit");
1801 return length; 1798 return length;
1802 } 1799 }
1803 1800
1804 1801
1805 HValue* HGraphBuilder::BuildCreateConsString( 1802 HValue* HGraphBuilder::BuildCreateConsString(
1806 HValue* length, 1803 HValue* length,
1807 HValue* left, 1804 HValue* left,
1808 HValue* right, 1805 HValue* right,
1809 HAllocationMode allocation_mode) { 1806 HAllocationMode allocation_mode) {
1810 // Determine the string instance types. 1807 // Determine the string instance types.
(...skipping 9493 matching lines...) Expand 10 before | Expand all | Expand 10 after
11304 if (ShouldProduceTraceOutput()) { 11301 if (ShouldProduceTraceOutput()) {
11305 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11302 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11306 } 11303 }
11307 11304
11308 #ifdef DEBUG 11305 #ifdef DEBUG
11309 graph_->Verify(false); // No full verify. 11306 graph_->Verify(false); // No full verify.
11310 #endif 11307 #endif
11311 } 11308 }
11312 11309
11313 } } // namespace v8::internal 11310 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698