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 9024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9035 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { | 9035 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { |
9036 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9036 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
9037 ENTER_V8(isolate); | 9037 ENTER_V8(isolate); |
9038 CHECK(isolate->debug()->CheckExecutionState()); | 9038 CHECK(isolate->debug()->CheckExecutionState()); |
9039 // Clear all current stepping setup. | 9039 // Clear all current stepping setup. |
9040 isolate->debug()->ClearStepping(); | 9040 isolate->debug()->ClearStepping(); |
9041 // Prepare step. | 9041 // Prepare step. |
9042 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action)); | 9042 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action)); |
9043 } | 9043 } |
9044 | 9044 |
9045 void debug::ClearStepping(Isolate* v8_isolate) { | |
9046 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | |
9047 ENTER_V8(isolate); | |
9048 // Clear all current stepping setup. | |
9049 isolate->debug()->ClearStepping(); | |
9050 } | |
9051 | |
9052 v8::Isolate* debug::Script::GetIsolate() const { | 9045 v8::Isolate* debug::Script::GetIsolate() const { |
9053 return reinterpret_cast<v8::Isolate*>(Utils::OpenHandle(this)->GetIsolate()); | 9046 return reinterpret_cast<v8::Isolate*>(Utils::OpenHandle(this)->GetIsolate()); |
9054 } | 9047 } |
9055 | 9048 |
9056 ScriptOriginOptions debug::Script::OriginOptions() const { | 9049 ScriptOriginOptions debug::Script::OriginOptions() const { |
9057 return Utils::OpenHandle(this)->origin_options(); | 9050 return Utils::OpenHandle(this)->origin_options(); |
9058 } | 9051 } |
9059 | 9052 |
9060 bool debug::Script::WasCompiled() const { | 9053 bool debug::Script::WasCompiled() const { |
9061 return Utils::OpenHandle(this)->compilation_state() == | 9054 return Utils::OpenHandle(this)->compilation_state() == |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9133 i::Handle<i::Object> value(script->source(), isolate); | 9126 i::Handle<i::Object> value(script->source(), isolate); |
9134 if (!value->IsString()) return MaybeLocal<String>(); | 9127 if (!value->IsString()) return MaybeLocal<String>(); |
9135 return Utils::ToLocal( | 9128 return Utils::ToLocal( |
9136 handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value))); | 9129 handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value))); |
9137 } | 9130 } |
9138 | 9131 |
9139 bool debug::Script::IsWasm() const { | 9132 bool debug::Script::IsWasm() const { |
9140 return Utils::OpenHandle(this)->type() == i::Script::TYPE_WASM; | 9133 return Utils::OpenHandle(this)->type() == i::Script::TYPE_WASM; |
9141 } | 9134 } |
9142 | 9135 |
9136 void debug::Script::BlackboxStateChanged() const { | |
dgozman
2017/01/19 21:49:14
Why doesn't this get a bool parameter |blackboxed|
kozy
2017/01/20 02:32:36
After offline discussion we decided to try to intr
| |
9137 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | |
9138 i::HandleScope handle_scope(isolate); | |
9139 i::Handle<i::Script> script = Utils::OpenHandle(this); | |
9140 i::SharedFunctionInfo::ScriptIterator iterator(script); | |
9141 for (i::SharedFunctionInfo* info = iterator.Next(); info != nullptr; | |
9142 info = iterator.Next()) { | |
9143 info->set_computed_debug_is_blackboxed(false); | |
9144 } | |
9145 } | |
9146 | |
9143 namespace { | 9147 namespace { |
9144 int GetSmiValue(i::Handle<i::FixedArray> array, int index) { | 9148 int GetSmiValue(i::Handle<i::FixedArray> array, int index) { |
9145 return i::Smi::cast(array->get(index))->value(); | 9149 return i::Smi::cast(array->get(index))->value(); |
9146 } | 9150 } |
9147 } // namespace | 9151 } // namespace |
9148 | 9152 |
9149 bool debug::Script::GetPossibleBreakpoints( | 9153 bool debug::Script::GetPossibleBreakpoints( |
9150 const debug::Location& start, const debug::Location& end, | 9154 const debug::Location& start, const debug::Location& end, |
9151 std::vector<debug::Location>* locations) const { | 9155 std::vector<debug::Location>* locations) const { |
9152 CHECK(!start.IsEmpty()); | 9156 CHECK(!start.IsEmpty()); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9321 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); | 9325 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); |
9322 } | 9326 } |
9323 | 9327 |
9324 void debug::SetDebugEventListener(Isolate* v8_isolate, | 9328 void debug::SetDebugEventListener(Isolate* v8_isolate, |
9325 debug::DebugEventListener* listener) { | 9329 debug::DebugEventListener* listener) { |
9326 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9330 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
9327 ENTER_V8(isolate); | 9331 ENTER_V8(isolate); |
9328 isolate->debug()->SetDebugEventListener(listener); | 9332 isolate->debug()->SetDebugEventListener(listener); |
9329 } | 9333 } |
9330 | 9334 |
9335 void debug::SetIsBlackboxedCallback(Isolate* v8_isolate, | |
9336 IsBlackboxedCallback callback, void* data) { | |
9337 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | |
9338 ENTER_V8(isolate); | |
9339 isolate->debug()->SetIsBlackboxedCallback(callback, data); | |
9340 } | |
9341 | |
9342 bool debug::HasUserFrameOnStack(Isolate* v8_isolate) { | |
9343 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | |
9344 ENTER_V8(isolate); | |
9345 for (i::StackTraceFrameIterator it(isolate); !it.done(); it.Advance()) { | |
9346 if (!it.is_javascript()) continue; | |
9347 if (!it.javascript_frame()->function()->shared()->DebugIsBlackboxed()) | |
9348 return true; | |
9349 } | |
9350 return false; | |
9351 } | |
9352 | |
9331 Local<String> CpuProfileNode::GetFunctionName() const { | 9353 Local<String> CpuProfileNode::GetFunctionName() const { |
9332 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 9354 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
9333 i::Isolate* isolate = node->isolate(); | 9355 i::Isolate* isolate = node->isolate(); |
9334 const i::CodeEntry* entry = node->entry(); | 9356 const i::CodeEntry* entry = node->entry(); |
9335 i::Handle<i::String> name = | 9357 i::Handle<i::String> name = |
9336 isolate->factory()->InternalizeUtf8String(entry->name()); | 9358 isolate->factory()->InternalizeUtf8String(entry->name()); |
9337 if (!entry->has_name_prefix()) { | 9359 if (!entry->has_name_prefix()) { |
9338 return ToApiHandle<String>(name); | 9360 return ToApiHandle<String>(name); |
9339 } else { | 9361 } else { |
9340 // We do not expect this to fail. Change this if it does. | 9362 // We do not expect this to fail. Change this if it does. |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10013 Address callback_address = | 10035 Address callback_address = |
10014 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10036 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10015 VMState<EXTERNAL> state(isolate); | 10037 VMState<EXTERNAL> state(isolate); |
10016 ExternalCallbackScope call_scope(isolate, callback_address); | 10038 ExternalCallbackScope call_scope(isolate, callback_address); |
10017 callback(info); | 10039 callback(info); |
10018 } | 10040 } |
10019 | 10041 |
10020 | 10042 |
10021 } // namespace internal | 10043 } // namespace internal |
10022 } // namespace v8 | 10044 } // namespace v8 |
OLD | NEW |