OLD | NEW |
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 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Generate code |
1590 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1590 TimerEventScope<TimerEventCompileCode> timer(isolate); |
1591 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1591 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
1592 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1592 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
1593 | 1593 |
1594 if (!literal->ShouldEagerCompile()) { | 1594 if (result->is_compiled()) { |
| 1595 // If this inner function is already compiled, we don't need to compile |
| 1596 // again. When compiling for debug, we are not interested in having debug |
| 1597 // break slots in inner functions, neither for setting break points nor |
| 1598 // for revealing inner functions. |
| 1599 // This is especially important for generators. We must not replace the |
| 1600 // code for generators, as there may be suspended generator objects. |
| 1601 return result; |
| 1602 } else if (!literal->ShouldEagerCompile()) { |
1595 info.SetCode(isolate->builtins()->CompileLazy()); | 1603 info.SetCode(isolate->builtins()->CompileLazy()); |
1596 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext(); | 1604 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext(); |
1597 if (outer_scope) { | 1605 if (outer_scope) { |
1598 result->set_outer_scope_info(*outer_scope->scope_info()); | 1606 result->set_outer_scope_info(*outer_scope->scope_info()); |
1599 } | 1607 } |
1600 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { | 1608 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { |
1601 // Code generation will ensure that the feedback vector is present and | 1609 // Code generation will ensure that the feedback vector is present and |
1602 // appropriately sized. | 1610 // appropriately sized. |
1603 DCHECK(!info.code().is_null()); | 1611 DCHECK(!info.code().is_null()); |
1604 if (literal->should_be_used_once_hint()) { | 1612 if (literal->should_be_used_once_hint()) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 DCHECK(shared->is_compiled()); | 1713 DCHECK(shared->is_compiled()); |
1706 function->set_literals(cached.literals); | 1714 function->set_literals(cached.literals); |
1707 } else if (shared->is_compiled()) { | 1715 } else if (shared->is_compiled()) { |
1708 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1716 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1709 JSFunction::EnsureLiterals(function); | 1717 JSFunction::EnsureLiterals(function); |
1710 } | 1718 } |
1711 } | 1719 } |
1712 | 1720 |
1713 } // namespace internal | 1721 } // namespace internal |
1714 } // namespace v8 | 1722 } // namespace v8 |
OLD | NEW |