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

Side by Side Diff: src/runtime/runtime-observe.cc

Issue 739523002: Allow stepping into Object.observe handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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 | « src/runtime/runtime-debug.cc ('k') | test/mjsunit/debug-stepin-foreach.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug.h"
8 #include "src/runtime/runtime-utils.h" 9 #include "src/runtime/runtime-utils.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 13
13 RUNTIME_FUNCTION(Runtime_IsObserved) { 14 RUNTIME_FUNCTION(Runtime_IsObserved) {
14 SealHandleScope shs(isolate); 15 SealHandleScope shs(isolate);
15 DCHECK(args.length() == 1); 16 DCHECK(args.length() == 1);
16 17
17 if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value(); 18 if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 HandleScope scope(isolate); 57 HandleScope scope(isolate);
57 DCHECK(args.length() == 2); 58 DCHECK(args.length() == 2);
58 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0); 59 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0);
59 CONVERT_ARG_HANDLE_CHECKED(Object, argument, 1); 60 CONVERT_ARG_HANDLE_CHECKED(Object, argument, 1);
60 v8::TryCatch catcher; 61 v8::TryCatch catcher;
61 // We should send a message on uncaught exception thrown during 62 // We should send a message on uncaught exception thrown during
62 // Object.observe delivery while not interrupting further delivery, thus 63 // Object.observe delivery while not interrupting further delivery, thus
63 // we make a call inside a verbose TryCatch. 64 // we make a call inside a verbose TryCatch.
64 catcher.SetVerbose(true); 65 catcher.SetVerbose(true);
65 Handle<Object> argv[] = {argument}; 66 Handle<Object> argv[] = {argument};
67
68 // Allow stepping into the observer callback.
69 Debug* debug = isolate->debug();
70 if (debug->is_active() && debug->IsStepping() &&
71 debug->last_step_action() == StepIn) {
72 // Previous StepIn may have activated a StepOut if it was at the frame exit.
73 // In this case to be able to step into the callback again, we need to clear
74 // the step out first.
75 debug->ClearStepOut();
76 debug->FloodWithOneShot(callback);
77 }
78
66 USE(Execution::Call(isolate, callback, isolate->factory()->undefined_value(), 79 USE(Execution::Call(isolate, callback, isolate->factory()->undefined_value(),
67 arraysize(argv), argv)); 80 arraysize(argv), argv));
68 if (isolate->has_pending_exception()) { 81 if (isolate->has_pending_exception()) {
69 isolate->ReportPendingMessages(); 82 isolate->ReportPendingMessages();
70 isolate->clear_pending_exception(); 83 isolate->clear_pending_exception();
71 isolate->set_external_caught_exception(false); 84 isolate->set_external_caught_exception(false);
72 } 85 }
73 return isolate->heap()->undefined_value(); 86 return isolate->heap()->undefined_value();
74 } 87 }
75 88
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 RUNTIME_FUNCTION(Runtime_GetObjectContextNotifierPerformChange) { 151 RUNTIME_FUNCTION(Runtime_GetObjectContextNotifierPerformChange) {
139 HandleScope scope(isolate); 152 HandleScope scope(isolate);
140 DCHECK(args.length() == 1); 153 DCHECK(args.length() == 1);
141 CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0); 154 CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0);
142 155
143 Handle<Context> context(object_info->GetCreationContext(), isolate); 156 Handle<Context> context(object_info->GetCreationContext(), isolate);
144 return context->native_object_notifier_perform_change(); 157 return context->native_object_notifier_perform_change();
145 } 158 }
146 } 159 }
147 } // namespace v8::internal 160 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/mjsunit/debug-stepin-foreach.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698