Chromium Code Reviews| Index: src/debug/debug.cc |
| diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
| index 495e162f28194ce34034dcdf5139934728642a9d..812d0e11b2da26746f1f8890a37a9face6c82cd5 100644 |
| --- a/src/debug/debug.cc |
| +++ b/src/debug/debug.cc |
| @@ -479,6 +479,7 @@ void Debug::ThreadInit() { |
| thread_local_.target_fp_ = 0; |
| thread_local_.step_in_enabled_ = false; |
| thread_local_.return_value_ = Handle<Object>(); |
| + thread_local_.suspended_generator_ = nullptr; |
| // TODO(isolates): frames_are_dropped_? |
| base::NoBarrier_Store(&thread_local_.current_debug_scope_, |
| static_cast<base::AtomicWord>(0)); |
| @@ -486,25 +487,24 @@ void Debug::ThreadInit() { |
| char* Debug::ArchiveDebug(char* storage) { |
| - char* to = storage; |
| - MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); |
| + // Simply reset state. Don't archive anything. |
| ThreadInit(); |
| return storage + ArchiveSpacePerThread(); |
| } |
| char* Debug::RestoreDebug(char* storage) { |
| - char* from = storage; |
| - MemCopy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); |
| + // Simply reset state. Don't restore anything. |
| + ThreadInit(); |
| return storage + ArchiveSpacePerThread(); |
| } |
| +int Debug::ArchiveSpacePerThread() { return 0; } |
| -int Debug::ArchiveSpacePerThread() { |
| - return sizeof(ThreadLocal); |
| +void Debug::Iterate(ObjectVisitor* v) { |
| + v->VisitPointer(&thread_local_.suspended_generator_); |
|
ulan
2016/06/03 09:33:50
Please guard it with
if (thread_local_.suspended_g
Yang
2016/06/03 11:48:11
Done.
|
| } |
| - |
| DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) { |
| // Globalize the request debug info object and make it weak. |
| GlobalHandles* global_handles = debug_info->GetIsolate()->global_handles(); |
| @@ -940,6 +940,17 @@ void Debug::PrepareStepIn(Handle<JSFunction> function) { |
| } |
| } |
| +void Debug::PrepareStepInSuspendedGenerator() { |
| + if (!is_active()) return; |
| + if (in_debug_scope()) return; |
| + DCHECK_NOT_NULL(thread_local_.suspended_generator_); |
| + thread_local_.last_step_action_ = StepIn; |
| + thread_local_.step_in_enabled_ = true; |
| + Handle<JSFunction> function( |
| + JSGeneratorObject::cast(thread_local_.suspended_generator_)->function()); |
| + FloodWithOneShot(function); |
| + thread_local_.suspended_generator_ = nullptr; |
| +} |
| void Debug::PrepareStepOnThrow() { |
| if (!is_active()) return; |
| @@ -1041,6 +1052,8 @@ void Debug::PrepareStep(StepAction step_action) { |
| debug_info->abstract_code()->SourceStatementPosition( |
| summary.code_offset()); |
| thread_local_.last_fp_ = frame->UnpaddedFP(); |
| + // No longer perform the current async step. |
| + thread_local_.suspended_generator_ = nullptr; |
| switch (step_action) { |
| case StepNone: |
| @@ -1385,6 +1398,13 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { |
| return true; |
| } |
| +void Debug::RecordAsyncFunction(Handle<JSGeneratorObject> generator_object) { |
| + if (last_step_action() <= StepOut) return; |
| + DCHECK_NULL(thread_local_.suspended_generator_); |
| + DCHECK(generator_object->function()->shared()->is_async()); |
| + thread_local_.suspended_generator_ = *generator_object; |
| + ClearStepping(); |
| +} |
| class SharedFunctionInfoFinder { |
| public: |