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

Unified Diff: src/debug.cc

Issue 10536142: Revert r11782, r11783 and r11790 due to Webkit failures. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months 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
« no previous file with comments | « src/debug.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index c7a55f4c1977fe0bf456e016d1877d35df784113..543ce9f24df5f096106902b918f927f9a7e3dc8e 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1170,16 +1170,14 @@ Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
}
-void Debug::SetBreakPoint(Handle<JSFunction> function,
+void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
Handle<Object> break_point_object,
int* source_position) {
HandleScope scope(isolate_);
PrepareForBreakPoints();
- // Make sure the function is compiled and has set up the debug info.
- Handle<SharedFunctionInfo> shared(function->shared());
- if (!EnsureDebugInfo(shared, function)) {
+ if (!EnsureDebugInfo(shared)) {
// Return if retrieving debug info failed.
return;
}
@@ -1200,51 +1198,6 @@ void Debug::SetBreakPoint(Handle<JSFunction> function,
}
-bool Debug::SetBreakPointForScript(Handle<Script> script,
- Handle<Object> break_point_object,
- int* source_position) {
- HandleScope scope(isolate_);
-
- // No need to call PrepareForBreakPoints because it will be called
- // implicitly by Runtime::FindSharedFunctionInfoInScript.
- Object* result = Runtime::FindSharedFunctionInfoInScript(isolate_,
- script,
- *source_position);
- if (result->IsUndefined()) return false;
-
- // Make sure the function has set up the debug info.
- Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result));
- if (!EnsureDebugInfo(shared, Handle<JSFunction>::null())) {
- // Return if retrieving debug info failed.
- return false;
- }
-
- // Find position within function. The script position might be before the
- // source position of the first function.
- int position;
- if (shared->start_position() > *source_position) {
- position = 0;
- } else {
- position = *source_position - shared->start_position();
- }
-
- Handle<DebugInfo> debug_info = GetDebugInfo(shared);
- // Source positions starts with zero.
- ASSERT(position >= 0);
-
- // Find the break point and change it.
- BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
- it.FindBreakLocationFromPosition(position);
- it.SetBreakPoint(break_point_object);
-
- *source_position = it.position() + shared->start_position();
-
- // At least one active break point now.
- ASSERT(debug_info->GetBreakPointCount() > 0);
- return true;
-}
-
-
void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
HandleScope scope(isolate_);
@@ -1296,12 +1249,10 @@ void Debug::ClearAllBreakPoints() {
}
-void Debug::FloodWithOneShot(Handle<JSFunction> function) {
+void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) {
PrepareForBreakPoints();
-
- // Make sure the function is compiled and has set up the debug info.
- Handle<SharedFunctionInfo> shared(function->shared());
- if (!EnsureDebugInfo(shared, function)) {
+ // Make sure the function has set up the debug info.
+ if (!EnsureDebugInfo(shared)) {
// Return if we failed to retrieve the debug info.
return;
}
@@ -1321,8 +1272,8 @@ void Debug::FloodBoundFunctionWithOneShot(Handle<JSFunction> function) {
if (!bindee.is_null() && bindee->IsJSFunction() &&
!JSFunction::cast(*bindee)->IsBuiltin()) {
- Handle<JSFunction> bindee_function(JSFunction::cast(*bindee));
- Debug::FloodWithOneShot(bindee_function);
+ Handle<SharedFunctionInfo> shared_info(JSFunction::cast(*bindee)->shared());
+ Debug::FloodWithOneShot(shared_info);
}
}
@@ -1337,9 +1288,11 @@ void Debug::FloodHandlerWithOneShot() {
for (JavaScriptFrameIterator it(isolate_, id); !it.done(); it.Advance()) {
JavaScriptFrame* frame = it.frame();
if (frame->HasHandler()) {
+ Handle<SharedFunctionInfo> shared =
+ Handle<SharedFunctionInfo>(
+ JSFunction::cast(frame->function())->shared());
// Flood the function with the catch block with break points
- JSFunction* function = JSFunction::cast(frame->function());
- FloodWithOneShot(Handle<JSFunction>(function));
+ FloodWithOneShot(shared);
return;
}
}
@@ -1406,14 +1359,14 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
frames_it.Advance();
// Fill the function to return to with one-shot break points.
JSFunction* function = JSFunction::cast(frames_it.frame()->function());
- FloodWithOneShot(Handle<JSFunction>(function));
+ FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
return;
}
// Get the debug info (create it if it does not exist).
- Handle<JSFunction> function(JSFunction::cast(frame->function()));
- Handle<SharedFunctionInfo> shared(function->shared());
- if (!EnsureDebugInfo(shared, function)) {
+ Handle<SharedFunctionInfo> shared =
+ Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
+ if (!EnsureDebugInfo(shared)) {
// Return if ensuring debug info failed.
return;
}
@@ -1483,7 +1436,7 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
if (!frames_it.done()) {
// Fill the function to return to with one-shot break points.
JSFunction* function = JSFunction::cast(frames_it.frame()->function());
- FloodWithOneShot(Handle<JSFunction>(function));
+ FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
// Set target frame pointer.
ActivateStepOut(frames_it.frame());
}
@@ -1493,7 +1446,7 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
// Step next or step min.
// Fill the current function with one-shot break points.
- FloodWithOneShot(function);
+ FloodWithOneShot(shared);
// Remember source position and frame to handle step next.
thread_local_.last_statement_position_ =
@@ -1505,7 +1458,9 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
if (is_at_restarted_function) {
Handle<JSFunction> restarted_function(
JSFunction::cast(*thread_local_.restarter_frame_function_pointer_));
- FloodWithOneShot(restarted_function);
+ Handle<SharedFunctionInfo> restarted_shared(
+ restarted_function->shared());
+ FloodWithOneShot(restarted_shared);
} else if (!call_function_stub.is_null()) {
// If it's CallFunction stub ensure target function is compiled and flood
// it with one shot breakpoints.
@@ -1547,7 +1502,7 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
} else if (!js_function->IsBuiltin()) {
// Don't step into builtins.
// It will also compile target function if it's not compiled yet.
- FloodWithOneShot(js_function);
+ FloodWithOneShot(Handle<SharedFunctionInfo>(js_function->shared()));
}
}
}
@@ -1556,7 +1511,7 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
// a call target as the function called might be a native function for
// which step in will not stop. It also prepares for stepping in
// getters/setters.
- FloodWithOneShot(function);
+ FloodWithOneShot(shared);
if (is_load_or_store) {
// Remember source position and frame to handle step in getter/setter. If
@@ -1756,11 +1711,12 @@ void Debug::HandleStepIn(Handle<JSFunction> function,
// function.
if (!holder.is_null() && holder->IsJSFunction() &&
!JSFunction::cast(*holder)->IsBuiltin()) {
- Handle<JSFunction> js_function = Handle<JSFunction>::cast(holder);
- Debug::FloodWithOneShot(js_function);
+ Handle<SharedFunctionInfo> shared_info(
+ JSFunction::cast(*holder)->shared());
+ Debug::FloodWithOneShot(shared_info);
}
} else {
- Debug::FloodWithOneShot(function);
+ Debug::FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
}
}
}
@@ -2000,9 +1956,6 @@ void Debug::PrepareForBreakPoints() {
Handle<Code> lazy_compile =
Handle<Code>(isolate_->builtins()->builtin(Builtins::kLazyCompile));
- // There will be at least one break point when we are done.
- has_break_points_ = true;
-
// Keep the list of activated functions in a handlified list as it
// is used both in GC and non-GC code.
List<Handle<JSFunction> > active_functions(100);
@@ -2110,20 +2063,15 @@ void Debug::PrepareForBreakPoints() {
// Ensures the debug information is present for shared.
-bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
- Handle<JSFunction> function) {
+bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared) {
// Return if we already have the debug info for shared.
if (HasDebugInfo(shared)) {
ASSERT(shared->is_compiled());
return true;
}
- // There will be at least one break point when we are done.
- has_break_points_ = true;
-
- // Ensure function is compiled. Return false if this failed.
- if (!function.is_null() &&
- !JSFunction::EnsureCompiled(function, CLEAR_EXCEPTION)) {
+ // Ensure shared in compiled. Return false if this failed.
+ if (!SharedFunctionInfo::EnsureCompiled(shared, CLEAR_EXCEPTION)) {
return false;
}
@@ -2135,6 +2083,9 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
node->set_next(debug_info_list_);
debug_info_list_ = node;
+ // Now there is at least one break point.
+ has_break_points_ = true;
+
return true;
}
@@ -2176,9 +2127,9 @@ void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
PrepareForBreakPoints();
// Get the executing function in which the debug break occurred.
- Handle<JSFunction> function(JSFunction::cast(frame->function()));
- Handle<SharedFunctionInfo> shared(function->shared());
- if (!EnsureDebugInfo(shared, function)) {
+ Handle<SharedFunctionInfo> shared =
+ Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
+ if (!EnsureDebugInfo(shared)) {
// Return if we failed to retrieve the debug info.
return;
}
@@ -2268,9 +2219,9 @@ bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
PrepareForBreakPoints();
// Get the executing function in which the debug break occurred.
- Handle<JSFunction> function(JSFunction::cast(frame->function()));
- Handle<SharedFunctionInfo> shared(function->shared());
- if (!EnsureDebugInfo(shared, function)) {
+ Handle<SharedFunctionInfo> shared =
+ Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
+ if (!EnsureDebugInfo(shared)) {
// Return if we failed to retrieve the debug info.
return false;
}
« no previous file with comments | « src/debug.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698