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

Unified Diff: src/debug.cc

Issue 725983002: Classes: Add support for stepping through default constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove stray change 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 side-by-side diff with in-line comments
Download patch
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 7fe9064e989a1e0bd44c1102ea2b8b5025f5dc91..45f465c0efc55fdb7a215c2e9aef4a1d29fe9a22 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1225,7 +1225,31 @@ void Debug::FloodBoundFunctionWithOneShot(Handle<JSFunction> function) {
if (!bindee.is_null() && bindee->IsJSFunction() &&
!JSFunction::cast(*bindee)->IsFromNativeScript()) {
Handle<JSFunction> bindee_function(JSFunction::cast(*bindee));
- FloodWithOneShot(bindee_function);
+ if (bindee_function->shared()->is_default_constructor()) {
+ FloodDefaultConstructorWithOneShot(bindee_function);
+ } else {
+ FloodWithOneShot(bindee_function);
+ }
+ }
+}
+
+
+void Debug::FloodDefaultConstructorWithOneShot(Handle<JSFunction> function) {
+ DCHECK(function->shared()->is_default_constructor());
+ // Instead of stepping into the function we directly step into the super class
+ // constructor.
+ Isolate* isolate = function->GetIsolate();
+ PrototypeIterator iter(isolate, function);
+ Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
+ if (!proto->IsJSFunction()) return; // Object.prototype
+ Handle<JSFunction> function_proto = Handle<JSFunction>::cast(proto);
+
+ if (function_proto->shared()->bound()) {
aandrey 2014/11/14 19:27:13 this if-else block is repeated several times below
arv (Not doing code reviews) 2014/11/14 22:02:22 Done.
+ FloodBoundFunctionWithOneShot(function_proto);
+ } else if (function_proto->shared()->is_default_constructor()) {
+ FloodDefaultConstructorWithOneShot(function_proto);
+ } else if (!function_proto->IsFromNativeScript()) {
+ FloodWithOneShot(function_proto);
}
}
@@ -1466,6 +1490,8 @@ void Debug::PrepareStep(StepAction step_action,
Handle<JSFunction> js_function(JSFunction::cast(fun));
if (js_function->shared()->bound()) {
aandrey 2014/11/14 19:27:13 repeated again
arv (Not doing code reviews) 2014/11/14 22:02:22 Done.
FloodBoundFunctionWithOneShot(js_function);
+ } else if (js_function->shared()->is_default_constructor()) {
+ FloodDefaultConstructorWithOneShot(js_function);
} else if (!js_function->IsFromNativeScript()) {
// Don't step into builtins.
// It will also compile target function if it's not compiled yet.
@@ -1615,6 +1641,8 @@ void Debug::HandleStepIn(Handle<Object> function_obj, Handle<Object> holder,
if (function->shared()->bound()) {
aandrey 2014/11/14 19:27:13 repeated once more.
arv (Not doing code reviews) 2014/11/14 22:02:22 Done.
// Handle Function.prototype.bind
FloodBoundFunctionWithOneShot(function);
+ } else if (function->shared()->is_default_constructor()) {
+ FloodDefaultConstructorWithOneShot(function);
} else if (!function->IsFromNativeScript()) {
// Don't allow step into functions in the native context.
if (function->shared()->code() ==
aandrey 2014/11/14 19:27:13 maybe the following apply & call checks should be
arv (Not doing code reviews) 2014/11/14 22:02:22 This is the only place where we have the holder.
@@ -1632,6 +1660,8 @@ void Debug::HandleStepIn(Handle<Object> function_obj, Handle<Object> holder,
} else if (js_function->shared()->bound()) {
// Handle Function.prototype.bind
FloodBoundFunctionWithOneShot(js_function);
+ } else if (js_function->shared()->is_default_constructor()) {
+ FloodDefaultConstructorWithOneShot(js_function);
}
}
} else {

Powered by Google App Engine
This is Rietveld 408576698