Commit 00170e43 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Use HBoundsCheck to check string length.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/206183003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20120 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 000be4d0
...@@ -1793,11 +1793,8 @@ HValue* HGraphBuilder::BuildAddStringLengths(HValue* left_length, ...@@ -1793,11 +1793,8 @@ HValue* HGraphBuilder::BuildAddStringLengths(HValue* left_length,
HValue* right_length) { HValue* right_length) {
// Compute the combined string length and check against max string length. // Compute the combined string length and check against max string length.
HValue* length = AddUncasted<HAdd>(left_length, right_length); HValue* length = AddUncasted<HAdd>(left_length, right_length);
IfBuilder if_nooverflow(this); HValue* max_length = Add<HConstant>(String::kMaxLength);
if_nooverflow.If<HCompareNumericAndBranch>( Add<HBoundsCheck>(length, max_length);
length, Add<HConstant>(String::kMaxLength), Token::LTE);
if_nooverflow.Then();
if_nooverflow.ElseDeopt("String length exceeds limit");
return length; return length;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment