| OLD | NEW |
| 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 "src/api.h" | 5 #include "src/api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
| 9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
| 10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
| (...skipping 9016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9027 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { | 9027 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { |
| 9028 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9028 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9029 ENTER_V8(isolate); | 9029 ENTER_V8(isolate); |
| 9030 CHECK(isolate->debug()->CheckExecutionState()); | 9030 CHECK(isolate->debug()->CheckExecutionState()); |
| 9031 // Clear all current stepping setup. | 9031 // Clear all current stepping setup. |
| 9032 isolate->debug()->ClearStepping(); | 9032 isolate->debug()->ClearStepping(); |
| 9033 // Prepare step. | 9033 // Prepare step. |
| 9034 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action)); | 9034 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action)); |
| 9035 } | 9035 } |
| 9036 | 9036 |
| 9037 void debug::ClearStepping(Isolate* v8_isolate) { | 9037 bool debug::HasNonBlackboxedFrameOnStack(Isolate* v8_isolate) { |
| 9038 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9038 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9039 ENTER_V8(isolate); | 9039 ENTER_V8(isolate); |
| 9040 // Clear all current stepping setup. | 9040 i::HandleScope scope(isolate); |
| 9041 isolate->debug()->ClearStepping(); | 9041 for (i::StackTraceFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 9042 if (!it.is_javascript()) continue; |
| 9043 i::Handle<i::SharedFunctionInfo> shared( |
| 9044 it.javascript_frame()->function()->shared()); |
| 9045 if (!isolate->debug()->IsBlackboxed(shared)) return true; |
| 9046 } |
| 9047 return false; |
| 9042 } | 9048 } |
| 9043 | 9049 |
| 9044 v8::Isolate* debug::Script::GetIsolate() const { | 9050 v8::Isolate* debug::Script::GetIsolate() const { |
| 9045 return reinterpret_cast<v8::Isolate*>(Utils::OpenHandle(this)->GetIsolate()); | 9051 return reinterpret_cast<v8::Isolate*>(Utils::OpenHandle(this)->GetIsolate()); |
| 9046 } | 9052 } |
| 9047 | 9053 |
| 9048 ScriptOriginOptions debug::Script::OriginOptions() const { | 9054 ScriptOriginOptions debug::Script::OriginOptions() const { |
| 9049 return Utils::OpenHandle(this)->origin_options(); | 9055 return Utils::OpenHandle(this)->origin_options(); |
| 9050 } | 9056 } |
| 9051 | 9057 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9306 result = i::Compiler::GetSharedFunctionInfoForScript( | 9312 result = i::Compiler::GetSharedFunctionInfoForScript( |
| 9307 str, i::Handle<i::Object>(), 0, 0, origin_options, | 9313 str, i::Handle<i::Object>(), 0, 0, origin_options, |
| 9308 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data, | 9314 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data, |
| 9309 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE); | 9315 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE); |
| 9310 has_pending_exception = result.is_null(); | 9316 has_pending_exception = result.is_null(); |
| 9311 RETURN_ON_FAILED_EXECUTION(UnboundScript); | 9317 RETURN_ON_FAILED_EXECUTION(UnboundScript); |
| 9312 } | 9318 } |
| 9313 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); | 9319 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); |
| 9314 } | 9320 } |
| 9315 | 9321 |
| 9316 void debug::SetDebugEventListener(Isolate* v8_isolate, | 9322 void debug::SetDebugDelegate(Isolate* v8_isolate, |
| 9317 debug::DebugEventListener* listener) { | 9323 debug::DebugDelegate* delegate) { |
| 9318 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9324 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9319 ENTER_V8(isolate); | 9325 ENTER_V8(isolate); |
| 9320 isolate->debug()->SetDebugEventListener(listener); | 9326 isolate->debug()->SetDebugDelegate(delegate); |
| 9327 } |
| 9328 |
| 9329 void debug::ResetBlackboxedStateCache(Isolate* v8_isolate, |
| 9330 v8::Local<debug::Script> script) { |
| 9331 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9332 ENTER_V8(isolate); |
| 9333 i::DisallowHeapAllocation no_gc; |
| 9334 i::SharedFunctionInfo::ScriptIterator iter(Utils::OpenHandle(*script)); |
| 9335 while (i::SharedFunctionInfo* info = iter.Next()) { |
| 9336 info->set_computed_debug_is_blackboxed(false); |
| 9337 } |
| 9321 } | 9338 } |
| 9322 | 9339 |
| 9323 Local<String> CpuProfileNode::GetFunctionName() const { | 9340 Local<String> CpuProfileNode::GetFunctionName() const { |
| 9324 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 9341 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 9325 i::Isolate* isolate = node->isolate(); | 9342 i::Isolate* isolate = node->isolate(); |
| 9326 const i::CodeEntry* entry = node->entry(); | 9343 const i::CodeEntry* entry = node->entry(); |
| 9327 i::Handle<i::String> name = | 9344 i::Handle<i::String> name = |
| 9328 isolate->factory()->InternalizeUtf8String(entry->name()); | 9345 isolate->factory()->InternalizeUtf8String(entry->name()); |
| 9329 if (!entry->has_name_prefix()) { | 9346 if (!entry->has_name_prefix()) { |
| 9330 return ToApiHandle<String>(name); | 9347 return ToApiHandle<String>(name); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10005 Address callback_address = | 10022 Address callback_address = |
| 10006 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10023 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 10007 VMState<EXTERNAL> state(isolate); | 10024 VMState<EXTERNAL> state(isolate); |
| 10008 ExternalCallbackScope call_scope(isolate, callback_address); | 10025 ExternalCallbackScope call_scope(isolate, callback_address); |
| 10009 callback(info); | 10026 callback(info); |
| 10010 } | 10027 } |
| 10011 | 10028 |
| 10012 | 10029 |
| 10013 } // namespace internal | 10030 } // namespace internal |
| 10014 } // namespace v8 | 10031 } // namespace v8 |
| OLD | NEW |