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

Side by Side Diff: src/hydrogen.cc

Issue 196133030: Make max size and max length of strings consistent. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 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 | « src/heap-inl.h ('k') | src/objects.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 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 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 BuildCreateAllocationMemento( 1784 BuildCreateAllocationMemento(
1785 object, object_size, allocation_mode.current_site()); 1785 object, object_size, allocation_mode.current_site());
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. If the result is larger than the max 1794 // Compute the combined string length and check against max string length.
1795 // supported string length, we bailout to the runtime. This is done implicitly
1796 // when converting the result back to a smi in case the max string length
1797 // equals the max smi value. Otherwise, for platforms with 32-bit smis, we do
1798 HValue* length = AddUncasted<HAdd>(left_length, right_length); 1795 HValue* length = AddUncasted<HAdd>(left_length, right_length);
1799 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 1796 IfBuilder if_nooverflow(this);
1800 if (String::kMaxLength != Smi::kMaxValue) { 1797 if_nooverflow.If<HCompareNumericAndBranch>(
1801 IfBuilder if_nooverflow(this); 1798 length, Add<HConstant>(String::kMaxLength), Token::LTE);
Benedikt Meurer 2014/03/20 07:41:59 Maybe we should use an HBoundsCheck here instead?
1802 if_nooverflow.If<HCompareNumericAndBranch>( 1799 if_nooverflow.Then();
1803 length, Add<HConstant>(String::kMaxLength), Token::LTE); 1800 if_nooverflow.ElseDeopt("String length exceeds limit");
1804 if_nooverflow.Then();
1805 if_nooverflow.ElseDeopt("String length exceeds limit");
1806 }
1807 return length; 1801 return length;
1808 } 1802 }
1809 1803
1810 1804
1811 HValue* HGraphBuilder::BuildCreateConsString( 1805 HValue* HGraphBuilder::BuildCreateConsString(
1812 HValue* length, 1806 HValue* length,
1813 HValue* left, 1807 HValue* left,
1814 HValue* right, 1808 HValue* right,
1815 HAllocationMode allocation_mode) { 1809 HAllocationMode allocation_mode) {
1816 // Determine the string instance types. 1810 // Determine the string instance types.
(...skipping 9493 matching lines...) Expand 10 before | Expand all | Expand 10 after
11310 if (ShouldProduceTraceOutput()) { 11304 if (ShouldProduceTraceOutput()) {
11311 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11305 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11312 } 11306 }
11313 11307
11314 #ifdef DEBUG 11308 #ifdef DEBUG
11315 graph_->Verify(false); // No full verify. 11309 graph_->Verify(false); // No full verify.
11316 #endif 11310 #endif
11317 } 11311 }
11318 11312
11319 } } // namespace v8::internal 11313 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698