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

Side by Side Diff: src/runtime.cc

Issue 201573007: Revert "Remove Failure::OutOfMemory propagation and V8::IgnoreOutOfMemoryException." (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 | « src/objects-inl.h ('k') | src/x64/code-stubs-x64.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3895 matching lines...) Expand 10 before | Expand all | Expand 10 after
3906 3906
3907 int matches = indices.length(); 3907 int matches = indices.length();
3908 if (matches == 0) return *subject; 3908 if (matches == 0) return *subject;
3909 3909
3910 // Detect integer overflow. 3910 // Detect integer overflow.
3911 int64_t result_len_64 = 3911 int64_t result_len_64 =
3912 (static_cast<int64_t>(replacement_len) - 3912 (static_cast<int64_t>(replacement_len) -
3913 static_cast<int64_t>(pattern_len)) * 3913 static_cast<int64_t>(pattern_len)) *
3914 static_cast<int64_t>(matches) + 3914 static_cast<int64_t>(matches) +
3915 static_cast<int64_t>(subject_len); 3915 static_cast<int64_t>(subject_len);
3916 if (result_len_64 > INT_MAX) { 3916 if (result_len_64 > INT_MAX) return Failure::OutOfMemoryException(0x11);
3917 v8::internal::Heap::FatalProcessOutOfMemory("invalid string length", true);
3918 }
3919 int result_len = static_cast<int>(result_len_64); 3917 int result_len = static_cast<int>(result_len_64);
3920 3918
3921 int subject_pos = 0; 3919 int subject_pos = 0;
3922 int result_pos = 0; 3920 int result_pos = 0;
3923 3921
3924 Handle<ResultSeqString> result; 3922 Handle<ResultSeqString> result;
3925 if (ResultSeqString::kHasAsciiEncoding) { 3923 if (ResultSeqString::kHasAsciiEncoding) {
3926 result = Handle<ResultSeqString>::cast( 3924 result = Handle<ResultSeqString>::cast(
3927 isolate->factory()->NewRawOneByteString(result_len)); 3925 isolate->factory()->NewRawOneByteString(result_len));
3928 } else { 3926 } else {
(...skipping 11133 matching lines...) Expand 10 before | Expand all | Expand 10 after
15062 // Handle last resort GC and make sure to allow future allocations 15060 // Handle last resort GC and make sure to allow future allocations
15063 // to grow the heap without causing GCs (if possible). 15061 // to grow the heap without causing GCs (if possible).
15064 isolate->counters()->gc_last_resort_from_js()->Increment(); 15062 isolate->counters()->gc_last_resort_from_js()->Increment();
15065 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 15063 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
15066 "Runtime::PerformGC"); 15064 "Runtime::PerformGC");
15067 } 15065 }
15068 } 15066 }
15069 15067
15070 15068
15071 } } // namespace v8::internal 15069 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698