Commit 679b31c2 authored by leszeks's avatar leszeks Committed by Commit bot

abstract_code: return compiled code for compiled shared funcs

SharedFunctionInfo's abstract_code was returning the bytecode array
whenever SharedFunctionInfo had a bytecode array, even if the function
was compiled (e.g. tiered up to FCG). This meant that abstract_code
could return code that is not actually the code that will run, which was
causing problems in profiling as the sampled PC did not match the known
code offset.

This patch changes both SharedFunctionInfo and JSFunction to return the
bytecode if-and-only-if they are not compiled and have a bytecode array
to return, or they already point to the interpreter trampoline.

BUG=v8:5758

Review-Url: https://codereview.chromium.org/2592703002
Cr-Commit-Position: refs/heads/master@{#41894}
parent 93df0940
......@@ -6159,7 +6159,7 @@ BOOL_GETTER(SharedFunctionInfo,
kOptimizationDisabled)
AbstractCode* SharedFunctionInfo::abstract_code() {
if (HasBytecodeArray()) {
if ((!is_compiled() && HasBytecodeArray()) || IsInterpreted()) {
return AbstractCode::cast(bytecode_array());
} else {
return AbstractCode::cast(code());
......@@ -6577,7 +6577,7 @@ void Map::InobjectSlackTrackingStep() {
}
AbstractCode* JSFunction::abstract_code() {
if (IsInterpreted()) {
if ((!is_compiled() && shared()->HasBytecodeArray()) || IsInterpreted()) {
return AbstractCode::cast(shared()->bytecode_array());
} else {
return AbstractCode::cast(code());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment