OLD | NEW |
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 const char* function_name) { | 145 const char* function_name) { |
146 v8::Script::Compile(v8::String::NewFromUtf8(isolate, source))->Run(); | 146 v8::Script::Compile(v8::String::NewFromUtf8(isolate, source))->Run(); |
147 v8::Local<v8::Object> global = isolate->GetCurrentContext()->Global(); | 147 v8::Local<v8::Object> global = isolate->GetCurrentContext()->Global(); |
148 return v8::Local<v8::Function>::Cast( | 148 return v8::Local<v8::Function>::Cast( |
149 global->Get(v8::String::NewFromUtf8(isolate, function_name))); | 149 global->Get(v8::String::NewFromUtf8(isolate, function_name))); |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 // Is there any debug info for the function? | 153 // Is there any debug info for the function? |
154 static bool HasDebugInfo(v8::Handle<v8::Function> fun) { | 154 static bool HasDebugInfo(v8::Handle<v8::Function> fun) { |
155 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); | 155 Handle<v8::internal::JSFunction> f = |
| 156 Handle<v8::internal::JSFunction>::cast(v8::Utils::OpenHandle(*fun)); |
156 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); | 157 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); |
157 return shared->HasDebugInfo(); | 158 return shared->HasDebugInfo(); |
158 } | 159 } |
159 | 160 |
160 | 161 |
161 // Set a break point in a function and return the associated break point | 162 // Set a break point in a function and return the associated break point |
162 // number. | 163 // number. |
163 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) { | 164 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) { |
164 static int break_point = 0; | 165 static int break_point = 0; |
165 v8::internal::Isolate* isolate = fun->GetIsolate(); | 166 v8::internal::Isolate* isolate = fun->GetIsolate(); |
166 v8::internal::Debug* debug = isolate->debug(); | 167 v8::internal::Debug* debug = isolate->debug(); |
167 debug->SetBreakPoint( | 168 debug->SetBreakPoint( |
168 fun, | 169 fun, |
169 Handle<Object>(v8::internal::Smi::FromInt(++break_point), isolate), | 170 Handle<Object>(v8::internal::Smi::FromInt(++break_point), isolate), |
170 &position); | 171 &position); |
171 return break_point; | 172 return break_point; |
172 } | 173 } |
173 | 174 |
174 | 175 |
175 // Set a break point in a function and return the associated break point | 176 // Set a break point in a function and return the associated break point |
176 // number. | 177 // number. |
177 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) { | 178 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) { |
178 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position); | 179 return SetBreakPoint( |
| 180 i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*fun)), position); |
179 } | 181 } |
180 | 182 |
181 | 183 |
182 // Set a break point in a function using the Debug object and return the | 184 // Set a break point in a function using the Debug object and return the |
183 // associated break point number. | 185 // associated break point number. |
184 static int SetBreakPointFromJS(v8::Isolate* isolate, | 186 static int SetBreakPointFromJS(v8::Isolate* isolate, |
185 const char* function_name, | 187 const char* function_name, |
186 int line, int position) { | 188 int line, int position) { |
187 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 189 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
188 SNPrintF(buffer, | 190 SNPrintF(buffer, |
(...skipping 7455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7644 CompileRun("function foo() {}; foo();"); | 7646 CompileRun("function foo() {}; foo();"); |
7645 --after_compile_handler_depth; | 7647 --after_compile_handler_depth; |
7646 } | 7648 } |
7647 | 7649 |
7648 | 7650 |
7649 TEST(NoInterruptsInDebugListener) { | 7651 TEST(NoInterruptsInDebugListener) { |
7650 DebugLocalContext env; | 7652 DebugLocalContext env; |
7651 v8::Debug::SetDebugEventListener(NoInterruptsOnDebugEvent); | 7653 v8::Debug::SetDebugEventListener(NoInterruptsOnDebugEvent); |
7652 CompileRun("void(0);"); | 7654 CompileRun("void(0);"); |
7653 } | 7655 } |
OLD | NEW |