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

Side by Side Diff: src/hydrogen.cc

Issue 286203010: Harden builtins BuildResultFromMatchInfo and URIDecodeOctets (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 6 years, 7 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/regexp.js » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "hydrogen.h" 5 #include "hydrogen.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "v8.h" 9 #include "v8.h"
10 #include "allocation-site-scopes.h" 10 #include "allocation-site-scopes.h"
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 } 1528 }
1529 1529
1530 1530
1531 HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, 1531 HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length,
1532 HValue* index, 1532 HValue* index,
1533 HValue* input) { 1533 HValue* input) {
1534 NoObservableSideEffectsScope scope(this); 1534 NoObservableSideEffectsScope scope(this);
1535 1535
1536 // Compute the size of the RegExpResult followed by FixedArray with length. 1536 // Compute the size of the RegExpResult followed by FixedArray with length.
1537 HValue* size = length; 1537 HValue* size = length;
1538 // Make sure size does not exceed max regular heap object size.
1539 const int kHeaderSize = JSRegExpResult::kSize + FixedArray::kHeaderSize;
1540 const int kMaxLength =
1541 (Page::kMaxRegularHeapObjectSize - kHeaderSize) >> kPointerSizeLog2;
1542 Add<HBoundsCheck>(size, Add<HConstant>(kMaxLength));
1543
1538 size = AddUncasted<HShl>(size, Add<HConstant>(kPointerSizeLog2)); 1544 size = AddUncasted<HShl>(size, Add<HConstant>(kPointerSizeLog2));
1539 size = AddUncasted<HAdd>(size, Add<HConstant>(static_cast<int32_t>( 1545 size = AddUncasted<HAdd>(size, Add<HConstant>(kHeaderSize));
1540 JSRegExpResult::kSize + FixedArray::kHeaderSize)));
1541
1542 // Make sure size does not exceeds max regular heap object size.
1543 Add<HBoundsCheck>(size, Add<HConstant>(Page::kMaxRegularHeapObjectSize));
1544 1546
1545 // Allocate the JSRegExpResult and the FixedArray in one step. 1547 // Allocate the JSRegExpResult and the FixedArray in one step.
1546 HValue* result = Add<HAllocate>( 1548 HValue* result = Add<HAllocate>(
1547 size, HType::JSArray(), NOT_TENURED, JS_ARRAY_TYPE); 1549 size, HType::JSArray(), NOT_TENURED, JS_ARRAY_TYPE);
1548 1550
1549 // Determine the elements FixedArray. 1551 // Determine the elements FixedArray.
1550 HValue* elements = Add<HInnerAllocatedObject>( 1552 HValue* elements = Add<HInnerAllocatedObject>(
1551 result, Add<HConstant>(JSRegExpResult::kSize)); 1553 result, Add<HConstant>(JSRegExpResult::kSize));
1552 1554
1553 // Initialize the JSRegExpResult header. 1555 // Initialize the JSRegExpResult header.
(...skipping 10248 matching lines...) Expand 10 before | Expand all | Expand 10 after
11802 if (ShouldProduceTraceOutput()) { 11804 if (ShouldProduceTraceOutput()) {
11803 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11805 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11804 } 11806 }
11805 11807
11806 #ifdef DEBUG 11808 #ifdef DEBUG
11807 graph_->Verify(false); // No full verify. 11809 graph_->Verify(false); // No full verify.
11808 #endif 11810 #endif
11809 } 11811 }
11810 11812
11811 } } // namespace v8::internal 11813 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698