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

Side by Side Diff: src/json-parser.cc

Issue 2037363002: [json] check and handle interrupts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 6 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
« no previous file with comments | « no previous file | src/json-stringifier.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 "src/json-parser.h" 5 #include "src/json-parser.h"
6 6
7 #include "src/char-predicates-inl.h" 7 #include "src/char-predicates-inl.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 // Parse any JSON value. 243 // Parse any JSON value.
244 template <bool seq_one_byte> 244 template <bool seq_one_byte>
245 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() { 245 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() {
246 StackLimitCheck stack_check(isolate_); 246 StackLimitCheck stack_check(isolate_);
247 if (stack_check.HasOverflowed()) { 247 if (stack_check.HasOverflowed()) {
248 isolate_->StackOverflow(); 248 isolate_->StackOverflow();
249 return Handle<Object>::null(); 249 return Handle<Object>::null();
250 } 250 }
251 251
252 if (stack_check.InterruptRequested()) { 252 if (stack_check.InterruptRequested() &&
253 ExecutionAccess access(isolate_); 253 isolate_->stack_guard()->HandleInterrupts()->IsException()) {
254 // Avoid blocking GC in long running parser (v8:3974). 254 return Handle<Object>::null();
255 isolate_->stack_guard()->HandleGCInterrupt();
256 } 255 }
257 256
258 if (c0_ == '"') return ParseJsonString(); 257 if (c0_ == '"') return ParseJsonString();
259 if ((c0_ >= '0' && c0_ <= '9') || c0_ == '-') return ParseJsonNumber(); 258 if ((c0_ >= '0' && c0_ <= '9') || c0_ == '-') return ParseJsonNumber();
260 if (c0_ == '{') return ParseJsonObject(); 259 if (c0_ == '{') return ParseJsonObject();
261 if (c0_ == '[') return ParseJsonArray(); 260 if (c0_ == '[') return ParseJsonArray();
262 if (c0_ == 'f') { 261 if (c0_ == 'f') {
263 if (AdvanceGetChar() == 'a' && AdvanceGetChar() == 'l' && 262 if (AdvanceGetChar() == 'a' && AdvanceGetChar() == 'l' &&
264 AdvanceGetChar() == 's' && AdvanceGetChar() == 'e') { 263 AdvanceGetChar() == 's' && AdvanceGetChar() == 'e') {
265 AdvanceSkipWhitespace(); 264 AdvanceSkipWhitespace();
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 AdvanceSkipWhitespace(); 803 AdvanceSkipWhitespace();
805 return result; 804 return result;
806 } 805 }
807 806
808 // Explicit instantiation. 807 // Explicit instantiation.
809 template class JsonParser<true>; 808 template class JsonParser<true>;
810 template class JsonParser<false>; 809 template class JsonParser<false>;
811 810
812 } // namespace internal 811 } // namespace internal
813 } // namespace v8 812 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/json-stringifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698