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

Side by Side Diff: src/compiler.cc

Issue 49433002: Work around two ASSERTs that we're hitting now that DEBUG is #defined again (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | src/objects-inl.h » ('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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 Parser parser(info); 658 Parser parser(info);
659 if ((info->pre_parse_data() != NULL || 659 if ((info->pre_parse_data() != NULL ||
660 String::cast(script->source())->length() > FLAG_min_preparse_length) && 660 String::cast(script->source())->length() > FLAG_min_preparse_length) &&
661 !DebuggerWantsEagerCompilation(info)) 661 !DebuggerWantsEagerCompilation(info))
662 parser.set_allow_lazy(true); 662 parser.set_allow_lazy(true);
663 if (!parser.Parse()) { 663 if (!parser.Parse()) {
664 return Handle<SharedFunctionInfo>::null(); 664 return Handle<SharedFunctionInfo>::null();
665 } 665 }
666 } 666 }
667 667
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(); 668 FunctionLiteral* lit = info->function();
678 LiveEditFunctionTracker live_edit_tracker(isolate, lit); 669 LiveEditFunctionTracker live_edit_tracker(isolate, lit);
679 if (!MakeCode(info)) { 670 Handle<SharedFunctionInfo> result;
680 if (!isolate->has_pending_exception()) isolate->StackOverflow(); 671 {
681 return Handle<SharedFunctionInfo>::null(); 672 // Measure how long it takes to do the compilation; only take the
673 // rest of the function into account to avoid overlap with the
674 // parsing statistics.
675 HistogramTimer* rate = info->is_eval()
676 ? info->isolate()->counters()->compile_eval()
677 : info->isolate()->counters()->compile();
678 HistogramTimerScope timer(rate);
679
680 // Compile the code.
681 if (!MakeCode(info)) {
682 if (!isolate->has_pending_exception()) isolate->StackOverflow();
683 return Handle<SharedFunctionInfo>::null();
684 }
685
686 // Allocate function.
687 ASSERT(!info->code().is_null());
688 result =
689 isolate->factory()->NewSharedFunctionInfo(
690 lit->name(),
691 lit->materialized_literal_count(),
692 lit->is_generator(),
693 info->code(),
694 ScopeInfo::Create(info->scope(), info->zone()));
695
696 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
697 Compiler::SetFunctionInfo(result, lit, true, script);
698
699 if (script->name()->IsString()) {
700 PROFILE(isolate, CodeCreateEvent(
701 info->is_eval()
702 ? Logger::EVAL_TAG
703 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
704 *info->code(),
705 *result,
706 info,
707 String::cast(script->name())));
708 GDBJIT(AddCode(Handle<String>(String::cast(script->name())),
709 script,
710 info->code(),
711 info));
712 } else {
713 PROFILE(isolate, CodeCreateEvent(
714 info->is_eval()
715 ? Logger::EVAL_TAG
716 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script),
717 *info->code(),
718 *result,
719 info,
720 isolate->heap()->empty_string()));
721 GDBJIT(AddCode(Handle<String>(), script, info->code(), info));
722 }
723
724 // Hint to the runtime system used when allocating space for initial
725 // property space by setting the expected number of properties for
726 // the instances of the function.
727 SetExpectedNofPropertiesFromEstimate(result,
728 lit->expected_property_count());
729
730 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED);
682 } 731 }
683 732
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 733 #ifdef ENABLE_DEBUGGER_SUPPORT
730 // Notify debugger 734 // Notify debugger
731 isolate->debugger()->OnAfterCompile( 735 isolate->debugger()->OnAfterCompile(
732 script, Debugger::NO_AFTER_COMPILE_FLAGS); 736 script, Debugger::NO_AFTER_COMPILE_FLAGS);
733 #endif 737 #endif
734 738
735 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone()); 739 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone());
736 740
737 return result; 741 return result;
738 } 742 }
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 AllowHandleDereference allow_deref; 1350 AllowHandleDereference allow_deref;
1347 bool tracing_on = info()->IsStub() 1351 bool tracing_on = info()->IsStub()
1348 ? FLAG_trace_hydrogen_stubs 1352 ? FLAG_trace_hydrogen_stubs
1349 : (FLAG_trace_hydrogen && 1353 : (FLAG_trace_hydrogen &&
1350 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1354 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1351 return (tracing_on && 1355 return (tracing_on &&
1352 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1356 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1353 } 1357 }
1354 1358
1355 } } // namespace v8::internal 1359 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698