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

Side by Side Diff: src/compiler.cc

Issue 2494993002: [compiler] correctly attribute compile event for inner function. (Closed)
Patch Set: . Created 4 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
« no previous file with comments | « no previous file | 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 // 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/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 parse_info.set_literal(literal); 1579 parse_info.set_literal(literal);
1580 parse_info.set_shared_info(result); 1580 parse_info.set_shared_info(result);
1581 parse_info.set_language_mode(literal->scope()->language_mode()); 1581 parse_info.set_language_mode(literal->scope()->language_mode());
1582 parse_info.set_ast_value_factory( 1582 parse_info.set_ast_value_factory(
1583 outer_info->parse_info()->ast_value_factory()); 1583 outer_info->parse_info()->ast_value_factory());
1584 parse_info.set_ast_value_factory_owned(false); 1584 parse_info.set_ast_value_factory_owned(false);
1585 1585
1586 if (outer_info->will_serialize()) info.PrepareForSerializing(); 1586 if (outer_info->will_serialize()) info.PrepareForSerializing();
1587 if (outer_info->is_debug()) info.MarkAsDebug(); 1587 if (outer_info->is_debug()) info.MarkAsDebug();
1588 1588
1589 // Generate code 1589 // If this inner function is already compiled, we don't need to compile
1590 TimerEventScope<TimerEventCompileCode> timer(isolate); 1590 // again. When compiling for debug, we are not interested in having debug
1591 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); 1591 // break slots in inner functions, neither for setting break points nor
1592 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); 1592 // for revealing inner functions.
1593 1593 // This is especially important for generators. We must not replace the
1594 if (result->is_compiled()) { 1594 // code for generators, as there may be suspended generator objects.
1595 // If this inner function is already compiled, we don't need to compile 1595 if (!result->is_compiled()) {
1596 // again. When compiling for debug, we are not interested in having debug 1596 if (!literal->ShouldEagerCompile()) {
1597 // break slots in inner functions, neither for setting break points nor 1597 info.SetCode(isolate->builtins()->CompileLazy());
1598 // for revealing inner functions. 1598 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
1599 // This is especially important for generators. We must not replace the 1599 if (outer_scope) {
1600 // code for generators, as there may be suspended generator objects. 1600 result->set_outer_scope_info(*outer_scope->scope_info());
1601 return result; 1601 }
1602 } else if (!literal->ShouldEagerCompile()) { 1602 } else {
1603 info.SetCode(isolate->builtins()->CompileLazy()); 1603 // Generate code
1604 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext(); 1604 TimerEventScope<TimerEventCompileCode> timer(isolate);
1605 if (outer_scope) { 1605 RuntimeCallTimerScope runtimeTimer(isolate,
1606 result->set_outer_scope_info(*outer_scope->scope_info()); 1606 &RuntimeCallStats::CompileCode);
1607 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
1608 if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
1609 // Code generation will ensure that the feedback vector is present and
1610 // appropriately sized.
1611 DCHECK(!info.code().is_null());
1612 if (literal->should_be_used_once_hint()) {
1613 info.code()->MarkToBeExecutedOnce(isolate);
1614 }
1615 } else {
1616 return Handle<SharedFunctionInfo>::null();
1617 }
1607 } 1618 }
1608 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
1609 // Code generation will ensure that the feedback vector is present and
1610 // appropriately sized.
1611 DCHECK(!info.code().is_null());
1612 if (literal->should_be_used_once_hint()) {
1613 info.code()->MarkToBeExecutedOnce(isolate);
1614 }
1615 } else {
1616 return Handle<SharedFunctionInfo>::null();
1617 } 1619 }
1618 1620
1619 if (maybe_existing.is_null()) { 1621 if (maybe_existing.is_null()) {
1620 RecordFunctionCompilation(CodeEventListener::FUNCTION_TAG, &info); 1622 RecordFunctionCompilation(CodeEventListener::FUNCTION_TAG, &info);
1621 } 1623 }
1622 1624
1623 return result; 1625 return result;
1624 } 1626 }
1625 1627
1626 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForNative( 1628 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForNative(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 DCHECK(shared->is_compiled()); 1715 DCHECK(shared->is_compiled());
1714 function->set_literals(cached.literals); 1716 function->set_literals(cached.literals);
1715 } else if (shared->is_compiled()) { 1717 } else if (shared->is_compiled()) {
1716 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1718 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1717 JSFunction::EnsureLiterals(function); 1719 JSFunction::EnsureLiterals(function);
1718 } 1720 }
1719 } 1721 }
1720 1722
1721 } // namespace internal 1723 } // namespace internal
1722 } // namespace v8 1724 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698