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

Side by Side Diff: src/compiler.cc

Issue 240253003: Remove uses of MaybeObject in runtime.cc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: changed as suggested 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/compiler.h ('k') | src/runtime.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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 } 859 }
860 860
861 #ifdef ENABLE_DEBUGGER_SUPPORT 861 #ifdef ENABLE_DEBUGGER_SUPPORT
862 isolate->debugger()->OnAfterCompile(script, Debugger::NO_AFTER_COMPILE_FLAGS); 862 isolate->debugger()->OnAfterCompile(script, Debugger::NO_AFTER_COMPILE_FLAGS);
863 #endif 863 #endif
864 864
865 return result; 865 return result;
866 } 866 }
867 867
868 868
869 Handle<JSFunction> Compiler::GetFunctionFromEval(Handle<String> source, 869 MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
870 Handle<Context> context, 870 Handle<String> source,
871 StrictMode strict_mode, 871 Handle<Context> context,
872 ParseRestriction restriction, 872 StrictMode strict_mode,
873 int scope_position) { 873 ParseRestriction restriction,
874 int scope_position) {
874 Isolate* isolate = source->GetIsolate(); 875 Isolate* isolate = source->GetIsolate();
875 int source_length = source->length(); 876 int source_length = source->length();
876 isolate->counters()->total_eval_size()->Increment(source_length); 877 isolate->counters()->total_eval_size()->Increment(source_length);
877 isolate->counters()->total_compile_size()->Increment(source_length); 878 isolate->counters()->total_compile_size()->Increment(source_length);
878 879
879 CompilationCache* compilation_cache = isolate->compilation_cache(); 880 CompilationCache* compilation_cache = isolate->compilation_cache();
880 MaybeHandle<SharedFunctionInfo> maybe_shared_info = 881 MaybeHandle<SharedFunctionInfo> maybe_shared_info =
881 compilation_cache->LookupEval(source, context, strict_mode, 882 compilation_cache->LookupEval(source, context, strict_mode,
882 scope_position); 883 scope_position);
883 Handle<SharedFunctionInfo> shared_info; 884 Handle<SharedFunctionInfo> shared_info;
884 885
885 if (!maybe_shared_info.ToHandle(&shared_info)) { 886 if (!maybe_shared_info.ToHandle(&shared_info)) {
886 Handle<Script> script = isolate->factory()->NewScript(source); 887 Handle<Script> script = isolate->factory()->NewScript(source);
887 CompilationInfoWithZone info(script); 888 CompilationInfoWithZone info(script);
888 info.MarkAsEval(); 889 info.MarkAsEval();
889 if (context->IsNativeContext()) info.MarkAsGlobal(); 890 if (context->IsNativeContext()) info.MarkAsGlobal();
890 info.SetStrictMode(strict_mode); 891 info.SetStrictMode(strict_mode);
891 info.SetParseRestriction(restriction); 892 info.SetParseRestriction(restriction);
892 info.SetContext(context); 893 info.SetContext(context);
893 894
894 #if ENABLE_DEBUGGER_SUPPORT 895 #if ENABLE_DEBUGGER_SUPPORT
895 Debug::RecordEvalCaller(script); 896 Debug::RecordEvalCaller(script);
896 #endif // ENABLE_DEBUGGER_SUPPORT 897 #endif // ENABLE_DEBUGGER_SUPPORT
897 898
898 shared_info = CompileToplevel(&info); 899 shared_info = CompileToplevel(&info);
899 900
900 if (shared_info.is_null()) { 901 if (shared_info.is_null()) {
901 return Handle<JSFunction>::null(); 902 return MaybeHandle<JSFunction>();
902 } else { 903 } else {
903 // Explicitly disable optimization for eval code. We're not yet prepared 904 // Explicitly disable optimization for eval code. We're not yet prepared
904 // to handle eval-code in the optimizing compiler. 905 // to handle eval-code in the optimizing compiler.
905 shared_info->DisableOptimization(kEval); 906 shared_info->DisableOptimization(kEval);
906 907
907 // If caller is strict mode, the result must be in strict mode as well. 908 // If caller is strict mode, the result must be in strict mode as well.
908 ASSERT(strict_mode == SLOPPY || shared_info->strict_mode() == STRICT); 909 ASSERT(strict_mode == SLOPPY || shared_info->strict_mode() == STRICT);
909 if (!shared_info->dont_cache()) { 910 if (!shared_info->dont_cache()) {
910 compilation_cache->PutEval( 911 compilation_cache->PutEval(
911 source, context, shared_info, scope_position); 912 source, context, shared_info, scope_position);
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 AllowHandleDereference allow_deref; 1304 AllowHandleDereference allow_deref;
1304 bool tracing_on = info()->IsStub() 1305 bool tracing_on = info()->IsStub()
1305 ? FLAG_trace_hydrogen_stubs 1306 ? FLAG_trace_hydrogen_stubs
1306 : (FLAG_trace_hydrogen && 1307 : (FLAG_trace_hydrogen &&
1307 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1308 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1308 return (tracing_on && 1309 return (tracing_on &&
1309 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1310 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1310 } 1311 }
1311 1312
1312 } } // namespace v8::internal 1313 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698