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 9032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9043 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { | 9043 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { |
9044 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9044 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
9045 ENTER_V8(isolate); | 9045 ENTER_V8(isolate); |
9046 CHECK(isolate->debug()->CheckExecutionState()); | 9046 CHECK(isolate->debug()->CheckExecutionState()); |
9047 // Clear all current stepping setup. | 9047 // Clear all current stepping setup. |
9048 isolate->debug()->ClearStepping(); | 9048 isolate->debug()->ClearStepping(); |
9049 // Prepare step. | 9049 // Prepare step. |
9050 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action)); | 9050 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action)); |
9051 } | 9051 } |
9052 | 9052 |
9053 void debug::ClearStepping(Isolate* v8_isolate) { | 9053 bool debug::HasNonBlackboxedFrameOnStack(Isolate* v8_isolate) { |
9054 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9054 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
9055 ENTER_V8(isolate); | 9055 ENTER_V8(isolate); |
9056 // Clear all current stepping setup. | 9056 for (i::StackTraceFrameIterator it(isolate); !it.done(); it.Advance()) { |
9057 isolate->debug()->ClearStepping(); | 9057 if (!it.is_javascript()) continue; |
| 9058 if (!it.javascript_frame()->function()->shared()->DebugIsBlackboxed()) |
| 9059 return true; |
| 9060 } |
| 9061 return false; |
9058 } | 9062 } |
9059 | 9063 |
9060 v8::Isolate* debug::Script::GetIsolate() const { | 9064 v8::Isolate* debug::Script::GetIsolate() const { |
9061 return reinterpret_cast<v8::Isolate*>(Utils::OpenHandle(this)->GetIsolate()); | 9065 return reinterpret_cast<v8::Isolate*>(Utils::OpenHandle(this)->GetIsolate()); |
9062 } | 9066 } |
9063 | 9067 |
9064 ScriptOriginOptions debug::Script::OriginOptions() const { | 9068 ScriptOriginOptions debug::Script::OriginOptions() const { |
9065 return Utils::OpenHandle(this)->origin_options(); | 9069 return Utils::OpenHandle(this)->origin_options(); |
9066 } | 9070 } |
9067 | 9071 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9322 result = i::Compiler::GetSharedFunctionInfoForScript( | 9326 result = i::Compiler::GetSharedFunctionInfoForScript( |
9323 str, i::Handle<i::Object>(), 0, 0, origin_options, | 9327 str, i::Handle<i::Object>(), 0, 0, origin_options, |
9324 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data, | 9328 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data, |
9325 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE); | 9329 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE); |
9326 has_pending_exception = result.is_null(); | 9330 has_pending_exception = result.is_null(); |
9327 RETURN_ON_FAILED_EXECUTION(UnboundScript); | 9331 RETURN_ON_FAILED_EXECUTION(UnboundScript); |
9328 } | 9332 } |
9329 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); | 9333 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); |
9330 } | 9334 } |
9331 | 9335 |
9332 void debug::SetDebugEventListener(Isolate* v8_isolate, | 9336 void debug::SetDebugDelegate(Isolate* v8_isolate, |
9333 debug::DebugEventListener* listener) { | 9337 debug::DebugDelegate* delegate) { |
9334 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9338 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
9335 ENTER_V8(isolate); | 9339 ENTER_V8(isolate); |
9336 isolate->debug()->SetDebugEventListener(listener); | 9340 isolate->debug()->SetDebugDelegate(delegate); |
| 9341 } |
| 9342 |
| 9343 void debug::ResetBlackboxedStateCache(Isolate* v8_isolate, |
| 9344 v8::Local<debug::Script> script) { |
| 9345 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9346 ENTER_V8(isolate); |
| 9347 i::DisallowHeapAllocation no_gc; |
| 9348 i::SharedFunctionInfo::ScriptIterator iter(Utils::OpenHandle(*script)); |
| 9349 while (i::SharedFunctionInfo* info = iter.Next()) { |
| 9350 info->set_computed_debug_is_blackboxed(false); |
| 9351 } |
9337 } | 9352 } |
9338 | 9353 |
9339 Local<String> CpuProfileNode::GetFunctionName() const { | 9354 Local<String> CpuProfileNode::GetFunctionName() const { |
9340 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 9355 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
9341 i::Isolate* isolate = node->isolate(); | 9356 i::Isolate* isolate = node->isolate(); |
9342 const i::CodeEntry* entry = node->entry(); | 9357 const i::CodeEntry* entry = node->entry(); |
9343 i::Handle<i::String> name = | 9358 i::Handle<i::String> name = |
9344 isolate->factory()->InternalizeUtf8String(entry->name()); | 9359 isolate->factory()->InternalizeUtf8String(entry->name()); |
9345 if (!entry->has_name_prefix()) { | 9360 if (!entry->has_name_prefix()) { |
9346 return ToApiHandle<String>(name); | 9361 return ToApiHandle<String>(name); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10021 Address callback_address = | 10036 Address callback_address = |
10022 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10037 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10023 VMState<EXTERNAL> state(isolate); | 10038 VMState<EXTERNAL> state(isolate); |
10024 ExternalCallbackScope call_scope(isolate, callback_address); | 10039 ExternalCallbackScope call_scope(isolate, callback_address); |
10025 callback(info); | 10040 callback(info); |
10026 } | 10041 } |
10027 | 10042 |
10028 | 10043 |
10029 } // namespace internal | 10044 } // namespace internal |
10030 } // namespace v8 | 10045 } // namespace v8 |
OLD | NEW |