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

Side by Side Diff: src/debug.cc

Issue 270273005: Harden yet more runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed nits Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug.h ('k') | src/liveedit.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "api.h" 7 #include "api.h"
8 #include "arguments.h" 8 #include "arguments.h"
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "code-stubs.h" 10 #include "code-stubs.h"
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1101
1102 1102
1103 // Return the debug info for this function. EnsureDebugInfo must be called 1103 // Return the debug info for this function. EnsureDebugInfo must be called
1104 // prior to ensure the debug info has been generated for shared. 1104 // prior to ensure the debug info has been generated for shared.
1105 Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) { 1105 Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
1106 ASSERT(HasDebugInfo(shared)); 1106 ASSERT(HasDebugInfo(shared));
1107 return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info())); 1107 return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info()));
1108 } 1108 }
1109 1109
1110 1110
1111 void Debug::SetBreakPoint(Handle<JSFunction> function, 1111 bool Debug::SetBreakPoint(Handle<JSFunction> function,
1112 Handle<Object> break_point_object, 1112 Handle<Object> break_point_object,
1113 int* source_position) { 1113 int* source_position) {
1114 HandleScope scope(isolate_); 1114 HandleScope scope(isolate_);
1115 1115
1116 PrepareForBreakPoints(); 1116 PrepareForBreakPoints();
1117 1117
1118 // Make sure the function is compiled and has set up the debug info. 1118 // Make sure the function is compiled and has set up the debug info.
1119 Handle<SharedFunctionInfo> shared(function->shared()); 1119 Handle<SharedFunctionInfo> shared(function->shared());
1120 if (!EnsureDebugInfo(shared, function)) { 1120 if (!EnsureDebugInfo(shared, function)) {
1121 // Return if retrieving debug info failed. 1121 // Return if retrieving debug info failed.
1122 return; 1122 return true;
1123 } 1123 }
1124 1124
1125 Handle<DebugInfo> debug_info = GetDebugInfo(shared); 1125 Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1126 // Source positions starts with zero. 1126 // Source positions starts with zero.
1127 ASSERT(*source_position >= 0); 1127 ASSERT(*source_position >= 0);
1128 1128
1129 // Find the break point and change it. 1129 // Find the break point and change it.
1130 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS); 1130 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
1131 it.FindBreakLocationFromPosition(*source_position, STATEMENT_ALIGNED); 1131 it.FindBreakLocationFromPosition(*source_position, STATEMENT_ALIGNED);
1132 it.SetBreakPoint(break_point_object); 1132 it.SetBreakPoint(break_point_object);
1133 1133
1134 *source_position = it.position(); 1134 *source_position = it.position();
1135 1135
1136 // At least one active break point now. 1136 // At least one active break point now.
1137 ASSERT(debug_info->GetBreakPointCount() > 0); 1137 return debug_info->GetBreakPointCount() > 0;
1138 } 1138 }
1139 1139
1140 1140
1141 bool Debug::SetBreakPointForScript(Handle<Script> script, 1141 bool Debug::SetBreakPointForScript(Handle<Script> script,
1142 Handle<Object> break_point_object, 1142 Handle<Object> break_point_object,
1143 int* source_position, 1143 int* source_position,
1144 BreakPositionAlignment alignment) { 1144 BreakPositionAlignment alignment) {
1145 HandleScope scope(isolate_); 1145 HandleScope scope(isolate_);
1146 1146
1147 PrepareForBreakPoints(); 1147 PrepareForBreakPoints();
(...skipping 2699 matching lines...) Expand 10 before | Expand all | Expand 10 after
3847 already_signalled_ = false; 3847 already_signalled_ = false;
3848 } 3848 }
3849 { 3849 {
3850 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); 3850 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_));
3851 isolate_->debugger()->CallMessageDispatchHandler(); 3851 isolate_->debugger()->CallMessageDispatchHandler();
3852 } 3852 }
3853 } 3853 }
3854 } 3854 }
3855 3855
3856 } } // namespace v8::internal 3856 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.h ('k') | src/liveedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698