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

Side by Side Diff: src/compiler.cc

Issue 2245263006: [interpreter] Fix canonicalization when preserving bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 4 years, 4 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-638551.js » ('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 // 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 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 if (outer_info->shared_info()->never_compiled()) { 1748 if (outer_info->shared_info()->never_compiled()) {
1749 // On the first compile, there are no existing shared function info for 1749 // On the first compile, there are no existing shared function info for
1750 // inner functions yet, so do not try to find them. All bets are off for 1750 // inner functions yet, so do not try to find them. All bets are off for
1751 // live edit though. 1751 // live edit though.
1752 SLOW_DCHECK(script->FindSharedFunctionInfo(literal).is_null() || 1752 SLOW_DCHECK(script->FindSharedFunctionInfo(literal).is_null() ||
1753 isolate->debug()->live_edit_enabled()); 1753 isolate->debug()->live_edit_enabled());
1754 } else { 1754 } else {
1755 maybe_existing = script->FindSharedFunctionInfo(literal); 1755 maybe_existing = script->FindSharedFunctionInfo(literal);
1756 } 1756 }
1757 1757
1758 // We found an existing shared function info. If it's already compiled, 1758 // We found an existing shared function info. If it has any sort of code
1759 // don't worry about compiling it, and simply return it. If it's not yet 1759 // attached, don't worry about compiling and simply return it. Otherwise,
1760 // compiled, continue to decide whether to eagerly compile. 1760 // continue to decide whether to eagerly compile.
1761 // Carry on if we are compiling eager to obtain code for debugging, 1761 // Note that we also carry on if we are compiling eager to obtain code for
1762 // unless we already have code with debut break slots. 1762 // debugging, unless we already have code with debug break slots.
1763 Handle<SharedFunctionInfo> existing; 1763 Handle<SharedFunctionInfo> existing;
1764 if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) { 1764 if (maybe_existing.ToHandle(&existing)) {
1765 DCHECK(!existing->is_toplevel()); 1765 DCHECK(!existing->is_toplevel());
1766 if (!outer_info->is_debug() || existing->HasDebugCode()) { 1766 if (existing->HasBaselineCode() || existing->HasBytecodeArray()) {
1767 return existing; 1767 if (!outer_info->is_debug() || existing->HasDebugCode()) {
rmcilroy 2016/08/18 10:26:06 Should this be HasDebugCode() || HasDebugBytecode(
rmcilroy 2016/08/18 10:29:02 Sorry ignore this, HasDebugCode does what I though
1768 return existing;
1769 }
1768 } 1770 }
1769 } 1771 }
1770 1772
1771 // Allocate a shared function info object. 1773 // Allocate a shared function info object.
1772 Handle<SharedFunctionInfo> result; 1774 Handle<SharedFunctionInfo> result;
1773 if (!maybe_existing.ToHandle(&result)) { 1775 if (!maybe_existing.ToHandle(&result)) {
1774 result = NewSharedFunctionInfoForLiteral(isolate, literal, script); 1776 result = NewSharedFunctionInfoForLiteral(isolate, literal, script);
1775 result->set_is_toplevel(false); 1777 result->set_is_toplevel(false);
1776 1778
1777 // If the outer function has been compiled before, we cannot be sure that 1779 // If the outer function has been compiled before, we cannot be sure that
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 DCHECK(shared->is_compiled()); 1961 DCHECK(shared->is_compiled());
1960 function->set_literals(cached.literals); 1962 function->set_literals(cached.literals);
1961 } else if (shared->is_compiled()) { 1963 } else if (shared->is_compiled()) {
1962 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1964 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1963 JSFunction::EnsureLiterals(function); 1965 JSFunction::EnsureLiterals(function);
1964 } 1966 }
1965 } 1967 }
1966 1968
1967 } // namespace internal 1969 } // namespace internal
1968 } // namespace v8 1970 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-638551.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698