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

Side by Side Diff: src/compiler.cc

Issue 71163006: Merge bleeding_edge r17376:17693. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Fix all.gyp Created 7 years, 1 month 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/codegen.cc ('k') | src/contexts.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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 257
258 static bool AlwaysFullCompiler(Isolate* isolate) { 258 static bool AlwaysFullCompiler(Isolate* isolate) {
259 return FLAG_always_full_compiler || IsDebuggerActive(isolate); 259 return FLAG_always_full_compiler || IsDebuggerActive(isolate);
260 } 260 }
261 261
262 262
263 void RecompileJob::RecordOptimizationStats() { 263 void RecompileJob::RecordOptimizationStats() {
264 Handle<JSFunction> function = info()->closure(); 264 Handle<JSFunction> function = info()->closure();
265 int opt_count = function->shared()->opt_count(); 265 if (!function->IsOptimized()) {
266 function->shared()->set_opt_count(opt_count + 1); 266 // Concurrent recompilation and OSR may race. Increment only once.
267 int opt_count = function->shared()->opt_count();
268 function->shared()->set_opt_count(opt_count + 1);
269 }
267 double ms_creategraph = time_taken_to_create_graph_.InMillisecondsF(); 270 double ms_creategraph = time_taken_to_create_graph_.InMillisecondsF();
268 double ms_optimize = time_taken_to_optimize_.InMillisecondsF(); 271 double ms_optimize = time_taken_to_optimize_.InMillisecondsF();
269 double ms_codegen = time_taken_to_codegen_.InMillisecondsF(); 272 double ms_codegen = time_taken_to_codegen_.InMillisecondsF();
270 if (FLAG_trace_opt) { 273 if (FLAG_trace_opt) {
271 PrintF("[optimizing "); 274 PrintF("[optimizing ");
272 function->ShortPrint(); 275 function->ShortPrint();
273 PrintF(" - took %0.3f, %0.3f, %0.3f ms]\n", ms_creategraph, ms_optimize, 276 PrintF(" - took %0.3f, %0.3f, %0.3f ms]\n", ms_creategraph, ms_optimize,
274 ms_codegen); 277 ms_codegen);
275 } 278 }
276 if (FLAG_trace_opt_stats) { 279 if (FLAG_trace_opt_stats) {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 Parser parser(info); 661 Parser parser(info);
659 if ((info->pre_parse_data() != NULL || 662 if ((info->pre_parse_data() != NULL ||
660 String::cast(script->source())->length() > FLAG_min_preparse_length) && 663 String::cast(script->source())->length() > FLAG_min_preparse_length) &&
661 !DebuggerWantsEagerCompilation(info)) 664 !DebuggerWantsEagerCompilation(info))
662 parser.set_allow_lazy(true); 665 parser.set_allow_lazy(true);
663 if (!parser.Parse()) { 666 if (!parser.Parse()) {
664 return Handle<SharedFunctionInfo>::null(); 667 return Handle<SharedFunctionInfo>::null();
665 } 668 }
666 } 669 }
667 670
668 // Measure how long it takes to do the compilation; only take the
669 // rest of the function into account to avoid overlap with the
670 // parsing statistics.
671 HistogramTimer* rate = info->is_eval()
672 ? info->isolate()->counters()->compile_eval()
673 : info->isolate()->counters()->compile();
674 HistogramTimerScope timer(rate);
675
676 // Compile the code.
677 FunctionLiteral* lit = info->function(); 671 FunctionLiteral* lit = info->function();
678 LiveEditFunctionTracker live_edit_tracker(isolate, lit); 672 LiveEditFunctionTracker live_edit_tracker(isolate, lit);
679 if (!MakeCode(info)) { 673 Handle<SharedFunctionInfo> result;
680 if (!isolate->has_pending_exception()) isolate->StackOverflow(); 674 {
681 return Handle<SharedFunctionInfo>::null(); 675 // Measure how long it takes to do the compilation; only take the
676 // rest of the function into account to avoid overlap with the
677 // parsing statistics.
678 HistogramTimer* rate = info->is_eval()
679 ? info->isolate()->counters()->compile_eval()
680 : info->isolate()->counters()->compile();
681 HistogramTimerScope timer(rate);
682
683 // Compile the code.
684 if (!MakeCode(info)) {
685 if (!isolate->has_pending_exception()) isolate->StackOverflow();
686 return Handle<SharedFunctionInfo>::null();
687 }
688
689 // Allocate function.
690 ASSERT(!info->code().is_null());
691 result =
692 isolate->factory()->NewSharedFunctionInfo(
693 lit->name(),
694 lit->materialized_literal_count(),
695 lit->is_generator(),
696 info->code(),
697 ScopeInfo::Create(info->scope(), info->zone()));
698
699 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
700 Compiler::SetFunctionInfo(result, lit, true, script);
701
702 if (script->name()->IsString()) {
703 PROFILE(isolate, CodeCreateEvent(
704 info->is_eval()
705 ? Logger::EVAL_TAG
706 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
707 *info->code(),
708 *result,
709 info,
710 String::cast(script->name())));
711 GDBJIT(AddCode(Handle<String>(String::cast(script->name())),
712 script,
713 info->code(),
714 info));
715 } else {
716 PROFILE(isolate, CodeCreateEvent(
717 info->is_eval()
718 ? Logger::EVAL_TAG
719 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
720 *info->code(),
721 *result,
722 info,
723 isolate->heap()->empty_string()));
724 GDBJIT(AddCode(Handle<String>(), script, info->code(), info));
725 }
726
727 // Hint to the runtime system used when allocating space for initial
728 // property space by setting the expected number of properties for
729 // the instances of the function.
730 SetExpectedNofPropertiesFromEstimate(result,
731 lit->expected_property_count());
732
733 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED);
682 } 734 }
683 735
684 // Allocate function.
685 ASSERT(!info->code().is_null());
686 Handle<SharedFunctionInfo> result =
687 isolate->factory()->NewSharedFunctionInfo(
688 lit->name(),
689 lit->materialized_literal_count(),
690 lit->is_generator(),
691 info->code(),
692 ScopeInfo::Create(info->scope(), info->zone()));
693
694 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
695 Compiler::SetFunctionInfo(result, lit, true, script);
696
697 if (script->name()->IsString()) {
698 PROFILE(isolate, CodeCreateEvent(
699 info->is_eval()
700 ? Logger::EVAL_TAG
701 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
702 *info->code(),
703 *result,
704 info,
705 String::cast(script->name())));
706 GDBJIT(AddCode(Handle<String>(String::cast(script->name())),
707 script,
708 info->code(),
709 info));
710 } else {
711 PROFILE(isolate, CodeCreateEvent(
712 info->is_eval()
713 ? Logger::EVAL_TAG
714 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
715 *info->code(),
716 *result,
717 info,
718 isolate->heap()->empty_string()));
719 GDBJIT(AddCode(Handle<String>(), script, info->code(), info));
720 }
721
722 // Hint to the runtime system used when allocating space for initial
723 // property space by setting the expected number of properties for
724 // the instances of the function.
725 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count());
726
727 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED);
728
729 #ifdef ENABLE_DEBUGGER_SUPPORT 736 #ifdef ENABLE_DEBUGGER_SUPPORT
730 // Notify debugger 737 // Notify debugger
731 isolate->debugger()->OnAfterCompile( 738 isolate->debugger()->OnAfterCompile(
732 script, Debugger::NO_AFTER_COMPILE_FLAGS); 739 script, Debugger::NO_AFTER_COMPILE_FLAGS);
733 #endif 740 #endif
734 741
735 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone()); 742 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone());
736 743
737 return result; 744 return result;
738 } 745 }
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 AllowHandleDereference allow_deref; 1353 AllowHandleDereference allow_deref;
1347 bool tracing_on = info()->IsStub() 1354 bool tracing_on = info()->IsStub()
1348 ? FLAG_trace_hydrogen_stubs 1355 ? FLAG_trace_hydrogen_stubs
1349 : (FLAG_trace_hydrogen && 1356 : (FLAG_trace_hydrogen &&
1350 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1357 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1351 return (tracing_on && 1358 return (tracing_on &&
1352 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1359 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1353 } 1360 }
1354 1361
1355 } } // namespace v8::internal 1362 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698