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

Side by Side Diff: src/runtime.cc

Issue 18326007: Revert "Debug: support breakpoints set in the middle of statement" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/runtime.h ('k') | test/cctest/test-debug.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 12084 matching lines...) Expand 10 before | Expand all | Expand 10 after
12095 // args[0]: disable break state 12095 // args[0]: disable break state
12096 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) { 12096 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) {
12097 HandleScope scope(isolate); 12097 HandleScope scope(isolate);
12098 ASSERT(args.length() == 1); 12098 ASSERT(args.length() == 1);
12099 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 0); 12099 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 0);
12100 isolate->debug()->set_disable_break(disable_break); 12100 isolate->debug()->set_disable_break(disable_break);
12101 return isolate->heap()->undefined_value(); 12101 return isolate->heap()->undefined_value();
12102 } 12102 }
12103 12103
12104 12104
12105 static bool IsPositionAlignmentValueCorrect(BreakPositionAlignment alignment) {
12106 return alignment == STATEMENT_ALIGNED || alignment == BREAK_POSITION_ALIGNED;
12107 }
12108
12109
12110 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) { 12105 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) {
12111 HandleScope scope(isolate); 12106 HandleScope scope(isolate);
12112 ASSERT(args.length() == 2); 12107 ASSERT(args.length() == 1);
12113 12108
12114 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); 12109 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
12115 CONVERT_NUMBER_CHECKED(int32_t, statement_alighned_code, Int32, args[1]);
12116
12117 BreakPositionAlignment alignment =
12118 static_cast<BreakPositionAlignment>(statement_alighned_code);
12119 if (!IsPositionAlignmentValueCorrect(alignment)) {
12120 return isolate->ThrowIllegalOperation();
12121 }
12122
12123 Handle<SharedFunctionInfo> shared(fun->shared()); 12110 Handle<SharedFunctionInfo> shared(fun->shared());
12124 // Find the number of break points 12111 // Find the number of break points
12125 Handle<Object> break_locations = 12112 Handle<Object> break_locations = Debug::GetSourceBreakLocations(shared);
12126 Debug::GetSourceBreakLocations(shared, alignment);
12127 if (break_locations->IsUndefined()) return isolate->heap()->undefined_value(); 12113 if (break_locations->IsUndefined()) return isolate->heap()->undefined_value();
12128 // Return array as JS array 12114 // Return array as JS array
12129 return *isolate->factory()->NewJSArrayWithElements( 12115 return *isolate->factory()->NewJSArrayWithElements(
12130 Handle<FixedArray>::cast(break_locations)); 12116 Handle<FixedArray>::cast(break_locations));
12131 } 12117 }
12132 12118
12133 12119
12134 // Set a break point in a function. 12120 // Set a break point in a function.
12135 // args[0]: function 12121 // args[0]: function
12136 // args[1]: number: break source position (within the function source) 12122 // args[1]: number: break source position (within the function source)
(...skipping 12 matching lines...) Expand all
12149 12135
12150 return Smi::FromInt(source_position); 12136 return Smi::FromInt(source_position);
12151 } 12137 }
12152 12138
12153 12139
12154 // Changes the state of a break point in a script and returns source position 12140 // Changes the state of a break point in a script and returns source position
12155 // where break point was set. NOTE: Regarding performance see the NOTE for 12141 // where break point was set. NOTE: Regarding performance see the NOTE for
12156 // GetScriptFromScriptData. 12142 // GetScriptFromScriptData.
12157 // args[0]: script to set break point in 12143 // args[0]: script to set break point in
12158 // args[1]: number: break source position (within the script source) 12144 // args[1]: number: break source position (within the script source)
12159 // args[2]: number, breakpoint position alignment 12145 // args[2]: number: break point object
12160 // args[3]: number: break point object
12161 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) { 12146 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetScriptBreakPoint) {
12162 HandleScope scope(isolate); 12147 HandleScope scope(isolate);
12163 ASSERT(args.length() == 4); 12148 ASSERT(args.length() == 3);
12164 CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0); 12149 CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0);
12165 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); 12150 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
12166 RUNTIME_ASSERT(source_position >= 0); 12151 RUNTIME_ASSERT(source_position >= 0);
12167 CONVERT_NUMBER_CHECKED(int32_t, statement_alighned_code, Int32, args[2]); 12152 Handle<Object> break_point_object_arg = args.at<Object>(2);
12168 Handle<Object> break_point_object_arg = args.at<Object>(3);
12169
12170 BreakPositionAlignment alignment =
12171 static_cast<BreakPositionAlignment>(statement_alighned_code);
12172 if (!IsPositionAlignmentValueCorrect(alignment)) {
12173 return isolate->ThrowIllegalOperation();
12174 }
12175 12153
12176 // Get the script from the script wrapper. 12154 // Get the script from the script wrapper.
12177 RUNTIME_ASSERT(wrapper->value()->IsScript()); 12155 RUNTIME_ASSERT(wrapper->value()->IsScript());
12178 Handle<Script> script(Script::cast(wrapper->value())); 12156 Handle<Script> script(Script::cast(wrapper->value()));
12179 12157
12180 // Set break point. 12158 // Set break point.
12181 if (!isolate->debug()->SetBreakPointForScript(script, break_point_object_arg, 12159 if (!isolate->debug()->SetBreakPointForScript(script, break_point_object_arg,
12182 &source_position, 12160 &source_position)) {
12183 alignment)) {
12184 return isolate->heap()->undefined_value(); 12161 return isolate->heap()->undefined_value();
12185 } 12162 }
12186 12163
12187 return Smi::FromInt(source_position); 12164 return Smi::FromInt(source_position);
12188 } 12165 }
12189 12166
12190 12167
12191 // Clear a break point 12168 // Clear a break point
12192 // args[0]: number: break point object 12169 // args[0]: number: break point object
12193 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearBreakPoint) { 12170 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearBreakPoint) {
(...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after
13947 // Handle last resort GC and make sure to allow future allocations 13924 // Handle last resort GC and make sure to allow future allocations
13948 // to grow the heap without causing GCs (if possible). 13925 // to grow the heap without causing GCs (if possible).
13949 isolate->counters()->gc_last_resort_from_js()->Increment(); 13926 isolate->counters()->gc_last_resort_from_js()->Increment();
13950 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13927 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13951 "Runtime::PerformGC"); 13928 "Runtime::PerformGC");
13952 } 13929 }
13953 } 13930 }
13954 13931
13955 13932
13956 } } // namespace v8::internal 13933 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698