Commit c2186834 authored by yangguo's avatar yangguo Committed by Commit bot

[debugger,interpreter] precisely determine execution tier.

R=mstarzinger@chromium.org
BUG=v8:4690
LOG=N

Review-Url: https://codereview.chromium.org/1921853005
Cr-Commit-Position: refs/heads/master@{#35840}
parent 7dc18f85
......@@ -498,6 +498,7 @@ void EnsureFeedbackVector(CompilationInfo* info) {
}
bool UseIgnition(CompilationInfo* info) {
if (info->is_debug()) return false;
if (info->shared_info()->is_generator() && !FLAG_ignition_generators) {
return false;
}
......@@ -569,7 +570,7 @@ void InstallSharedScopeInfo(CompilationInfo* info,
void InstallSharedCompilationResult(CompilationInfo* info,
Handle<SharedFunctionInfo> shared) {
// Assert that we are not overwriting (possibly patched) debug code.
DCHECK(!shared->HasDebugCode());
DCHECK(!shared->HasDebugInfo());
DCHECK(!info->code().is_null());
shared->ReplaceCode(*info->code());
if (info->has_bytecode_array()) {
......@@ -1319,6 +1320,11 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
DCHECK_NOT_NULL(info->literal());
DCHECK_NOT_NULL(info->scope());
Handle<SharedFunctionInfo> shared = info->shared_info();
if (shared->HasBytecodeArray() &&
HasInterpreterActivations(info->isolate(), *shared)) {
// Do not tier up from here if we have bytecode on the stack.
return false;
}
if (!shared->has_deoptimization_support()) {
Zone zone(info->isolate()->allocator());
CompilationInfo unoptimized(info->parse_info(), info->closure());
......
......@@ -1323,7 +1323,7 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask,
"prepare for break points");
bool is_interpreted = shared->HasBytecodeArray();
bool is_interpreted = shared->IsInterpreted();
{
// TODO(yangguo): with bytecode, we still walk the heap to find all
......@@ -1532,7 +1532,7 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
return false;
}
if (shared->HasBytecodeArray()) {
if (shared->IsInterpreted()) {
// To prepare bytecode for debugging, we already need to have the debug
// info (containing the debug copy) upfront, but since we do not recompile,
// preparing for break points cannot fail.
......
......@@ -2232,7 +2232,7 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
Handle<DebugInfo> debug_info =
Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE));
debug_info->set_shared(*shared);
if (shared->HasBytecodeArray()) {
if (shared->IsInterpreted()) {
// We need to create a copy, but delay since this may cause heap
// verification.
debug_info->set_abstract_code(AbstractCode::cast(shared->bytecode_array()));
......@@ -2240,7 +2240,7 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
debug_info->set_abstract_code(AbstractCode::cast(shared->code()));
}
debug_info->set_break_points(*break_points);
if (shared->HasBytecodeArray()) {
if (shared->IsInterpreted()) {
// Create a copy for debugging.
Handle<BytecodeArray> original(shared->bytecode_array());
Handle<BytecodeArray> copy = CopyBytecodeArray(original);
......
......@@ -5885,7 +5885,7 @@ DebugInfo* SharedFunctionInfo::GetDebugInfo() {
bool SharedFunctionInfo::HasDebugCode() {
return HasBytecodeArray() ||
return IsInterpreted() ||
(code()->kind() == Code::FUNCTION && code()->has_debug_break_slots());
}
......@@ -5909,6 +5909,15 @@ bool SharedFunctionInfo::HasBytecodeArray() {
return function_data()->IsBytecodeArray();
}
bool SharedFunctionInfo::IsInterpreted() {
// Currently, having bytecode does not mean the function is actually being
// interpreted. However, the debugger has to know precisely what is going to
// be executed.
// TODO(yangguo,mstarzinger): make this a synonym of HasBytecodeArray().
return code() ==
GetIsolate()->builtins()->builtin(
Builtins::kInterpreterEntryTrampoline);
}
BytecodeArray* SharedFunctionInfo::bytecode_array() {
DCHECK(HasBytecodeArray());
......
......@@ -6758,6 +6758,7 @@ class SharedFunctionInfo: public HeapObject {
inline FunctionTemplateInfo* get_api_func_data();
inline void set_api_func_data(FunctionTemplateInfo* data);
inline bool HasBytecodeArray();
inline bool IsInterpreted();
inline BytecodeArray* bytecode_array();
inline void set_bytecode_array(BytecodeArray* bytecode);
inline void ClearBytecodeArray();
......
......@@ -751,9 +751,6 @@
##############################################################################
['ignition or ignition_turbofan', {
# TODO(yangguo,4690): flaky failures on the bots.
'debug-stepin-builtin-callback-opt': [SKIP],
# TODO(rmcilroy,4765): assertion failures in LiveEdit tests.
'debug-liveedit-restart-frame': [FAIL],
'debug-liveedit-literals': [FAIL],
......
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