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

Side by Side Diff: src/runtime.cc

Issue 223553003: Return MaybeHandle from JsonParser. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/json-parser.h ('k') | no next file » | 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 9751 matching lines...) Expand 10 before | Expand all | Expand 10 after
9762 9762
9763 9763
9764 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { 9764 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) {
9765 HandleScope scope(isolate); 9765 HandleScope scope(isolate);
9766 ASSERT_EQ(1, args.length()); 9766 ASSERT_EQ(1, args.length());
9767 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); 9767 CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
9768 9768
9769 source = Handle<String>(FlattenGetString(source)); 9769 source = Handle<String>(FlattenGetString(source));
9770 // Optimized fast case where we only have ASCII characters. 9770 // Optimized fast case where we only have ASCII characters.
9771 Handle<Object> result; 9771 Handle<Object> result;
9772 if (source->IsSeqOneByteString()) { 9772 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
9773 result = JsonParser<true>::Parse(source); 9773 isolate, result,
9774 } else { 9774 source->IsSeqOneByteString() ? JsonParser<true>::Parse(source)
9775 result = JsonParser<false>::Parse(source); 9775 : JsonParser<false>::Parse(source));
9776 }
9777 if (result.is_null()) {
9778 // Syntax error or stack overflow in scanner.
9779 ASSERT(isolate->has_pending_exception());
9780 return Failure::Exception();
9781 }
9782 return *result; 9776 return *result;
9783 } 9777 }
9784 9778
9785 9779
9786 bool CodeGenerationFromStringsAllowed(Isolate* isolate, 9780 bool CodeGenerationFromStringsAllowed(Isolate* isolate,
9787 Handle<Context> context) { 9781 Handle<Context> context) {
9788 ASSERT(context->allow_code_gen_from_strings()->IsFalse()); 9782 ASSERT(context->allow_code_gen_from_strings()->IsFalse());
9789 // Check with callback if set. 9783 // Check with callback if set.
9790 AllowCodeGenerationFromStringsCallback callback = 9784 AllowCodeGenerationFromStringsCallback callback =
9791 isolate->allow_code_gen_callback(); 9785 isolate->allow_code_gen_callback();
(...skipping 5439 matching lines...) Expand 10 before | Expand all | Expand 10 after
15231 } 15225 }
15232 } 15226 }
15233 15227
15234 15228
15235 void Runtime::OutOfMemory() { 15229 void Runtime::OutOfMemory() {
15236 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15230 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15237 UNREACHABLE(); 15231 UNREACHABLE();
15238 } 15232 }
15239 15233
15240 } } // namespace v8::internal 15234 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/json-parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698