Commit 50683aa6 authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

[api] Deprecate PersistentValueVector

Users can just use std::vector<Global<T>>.

Bug: v8:12915
Change-Id: I59fc8458e336df0dfaa3524f1197d4423482530e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3695578Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81023}
parent ea28ceee
...@@ -537,7 +537,6 @@ class StdGlobalValueMap : public GlobalValueMap<K, V, Traits> { ...@@ -537,7 +537,6 @@ class StdGlobalValueMap : public GlobalValueMap<K, V, Traits> {
: GlobalValueMap<K, V, Traits>(isolate) {} : GlobalValueMap<K, V, Traits>(isolate) {}
}; };
class DefaultPersistentValueVectorTraits { class DefaultPersistentValueVectorTraits {
public: public:
typedef std::vector<PersistentContainerValue> Impl; typedef std::vector<PersistentContainerValue> Impl;
...@@ -562,7 +561,6 @@ class DefaultPersistentValueVectorTraits { ...@@ -562,7 +561,6 @@ class DefaultPersistentValueVectorTraits {
} }
}; };
/** /**
* A vector wrapper that safely stores Global values. * A vector wrapper that safely stores Global values.
* C++11 embedders don't need this class, as they can use Global * C++11 embedders don't need this class, as they can use Global
...@@ -573,8 +571,8 @@ class DefaultPersistentValueVectorTraits { ...@@ -573,8 +571,8 @@ class DefaultPersistentValueVectorTraits {
* PersistentContainerValue, with all conversion into and out of V8 * PersistentContainerValue, with all conversion into and out of V8
* handles being transparently handled by this class. * handles being transparently handled by this class.
*/ */
template<typename V, typename Traits = DefaultPersistentValueVectorTraits> template <typename V, typename Traits = DefaultPersistentValueVectorTraits>
class PersistentValueVector { class V8_DEPRECATE_SOON("Use std::vector<Global<V>>.") PersistentValueVector {
public: public:
explicit PersistentValueVector(Isolate* isolate) : isolate_(isolate) { } explicit PersistentValueVector(Isolate* isolate) : isolate_(isolate) { }
......
...@@ -449,11 +449,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { ...@@ -449,11 +449,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
#endif // V8_SANDBOXED_POINTERS #endif // V8_SANDBOXED_POINTERS
struct SnapshotCreatorData { struct SnapshotCreatorData {
explicit SnapshotCreatorData(Isolate* v8_isolate) explicit SnapshotCreatorData(Isolate* v8_isolate) : isolate_(v8_isolate) {}
: isolate_(v8_isolate),
default_context_(),
contexts_(v8_isolate),
created_(false) {}
static SnapshotCreatorData* cast(void* data) { static SnapshotCreatorData* cast(void* data) {
return reinterpret_cast<SnapshotCreatorData*>(data); return reinterpret_cast<SnapshotCreatorData*>(data);
...@@ -463,9 +459,9 @@ struct SnapshotCreatorData { ...@@ -463,9 +459,9 @@ struct SnapshotCreatorData {
Isolate* isolate_; Isolate* isolate_;
Persistent<Context> default_context_; Persistent<Context> default_context_;
SerializeInternalFieldsCallback default_embedder_fields_serializer_; SerializeInternalFieldsCallback default_embedder_fields_serializer_;
PersistentValueVector<Context> contexts_; std::vector<Global<Context>> contexts_;
std::vector<SerializeInternalFieldsCallback> embedder_fields_serializers_; std::vector<SerializeInternalFieldsCallback> embedder_fields_serializers_;
bool created_; bool created_ = false;
}; };
} // namespace } // namespace
...@@ -530,8 +526,8 @@ size_t SnapshotCreator::AddContext(Local<Context> context, ...@@ -530,8 +526,8 @@ size_t SnapshotCreator::AddContext(Local<Context> context,
DCHECK(!data->created_); DCHECK(!data->created_);
Isolate* v8_isolate = data->isolate_; Isolate* v8_isolate = data->isolate_;
CHECK_EQ(v8_isolate, context->GetIsolate()); CHECK_EQ(v8_isolate, context->GetIsolate());
size_t index = data->contexts_.Size(); size_t index = data->contexts_.size();
data->contexts_.Append(context); data->contexts_.emplace_back(v8_isolate, context);
data->embedder_fields_serializers_.push_back(callback); data->embedder_fields_serializers_.push_back(callback);
return index; return index;
} }
...@@ -607,11 +603,12 @@ void ConvertSerializedObjectsToFixedArray(i::Isolate* i_isolate) { ...@@ -607,11 +603,12 @@ void ConvertSerializedObjectsToFixedArray(i::Isolate* i_isolate) {
StartupData SnapshotCreator::CreateBlob( StartupData SnapshotCreator::CreateBlob(
SnapshotCreator::FunctionCodeHandling function_code_handling) { SnapshotCreator::FunctionCodeHandling function_code_handling) {
SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(data->isolate_); Isolate* isolate = data->isolate_;
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
DCHECK(!data->created_); DCHECK(!data->created_);
DCHECK(!data->default_context_.IsEmpty()); DCHECK(!data->default_context_.IsEmpty());
const int num_additional_contexts = static_cast<int>(data->contexts_.Size()); const int num_additional_contexts = static_cast<int>(data->contexts_.size());
const int num_contexts = num_additional_contexts + 1; // The default context. const int num_contexts = num_additional_contexts + 1; // The default context.
// Create and store lists of embedder-provided data needed during // Create and store lists of embedder-provided data needed during
...@@ -625,7 +622,7 @@ StartupData SnapshotCreator::CreateBlob( ...@@ -625,7 +622,7 @@ StartupData SnapshotCreator::CreateBlob(
ConvertSerializedObjectsToFixedArray( ConvertSerializedObjectsToFixedArray(
data->default_context_.Get(data->isolate_)); data->default_context_.Get(data->isolate_));
for (int i = 0; i < num_additional_contexts; i++) { for (int i = 0; i < num_additional_contexts; i++) {
ConvertSerializedObjectsToFixedArray(data->contexts_.Get(i)); ConvertSerializedObjectsToFixedArray(data->contexts_[i].Get(isolate));
} }
// We need to store the global proxy size upfront in case we need the // We need to store the global proxy size upfront in case we need the
...@@ -635,7 +632,7 @@ StartupData SnapshotCreator::CreateBlob( ...@@ -635,7 +632,7 @@ StartupData SnapshotCreator::CreateBlob(
i::AllocationType::kOld); i::AllocationType::kOld);
for (int i = 0; i < num_additional_contexts; i++) { for (int i = 0; i < num_additional_contexts; i++) {
i::Handle<i::Context> context = i::Handle<i::Context> context =
v8::Utils::OpenHandle(*data->contexts_.Get(i)); v8::Utils::OpenHandle(*data->contexts_[i].Get(isolate));
global_proxy_sizes->set(i, global_proxy_sizes->set(i,
i::Smi::FromInt(context->global_proxy().Size())); i::Smi::FromInt(context->global_proxy().Size()));
} }
...@@ -673,10 +670,10 @@ StartupData SnapshotCreator::CreateBlob( ...@@ -673,10 +670,10 @@ StartupData SnapshotCreator::CreateBlob(
data->default_context_.Reset(); data->default_context_.Reset();
for (int i = 0; i < num_additional_contexts; i++) { for (int i = 0; i < num_additional_contexts; i++) {
i::Handle<i::Context> context = i::Handle<i::Context> context =
v8::Utils::OpenHandle(*data->contexts_.Get(i)); v8::Utils::OpenHandle(*data->contexts_[i].Get(isolate));
contexts.push_back(*context); contexts.push_back(*context);
} }
data->contexts_.Clear(); data->contexts_.clear();
} }
// Check that values referenced by global/eternal handles are accounted for. // Check that values referenced by global/eternal handles are accounted for.
......
...@@ -872,7 +872,7 @@ int Location::GetColumnNumber() const { ...@@ -872,7 +872,7 @@ int Location::GetColumnNumber() const {
bool Location::IsEmpty() const { return is_empty_; } bool Location::IsEmpty() const { return is_empty_; }
void GetLoadedScripts(Isolate* v8_isolate, void GetLoadedScripts(Isolate* v8_isolate,
PersistentValueVector<Script>& scripts) { std::vector<v8::Global<Script>>& scripts) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
{ {
...@@ -891,7 +891,7 @@ void GetLoadedScripts(Isolate* v8_isolate, ...@@ -891,7 +891,7 @@ void GetLoadedScripts(Isolate* v8_isolate,
if (!script.HasValidSource()) continue; if (!script.HasValidSource()) continue;
i::HandleScope handle_scope(isolate); i::HandleScope handle_scope(isolate);
i::Handle<i::Script> script_handle(script, isolate); i::Handle<i::Script> script_handle(script, isolate);
scripts.Append(ToApiHandle<Script>(script_handle)); scripts.emplace_back(v8_isolate, ToApiHandle<Script>(script_handle));
} }
} }
} }
...@@ -1140,7 +1140,7 @@ v8::MaybeLocal<v8::Value> EvaluateGlobalForTesting( ...@@ -1140,7 +1140,7 @@ v8::MaybeLocal<v8::Value> EvaluateGlobalForTesting(
void QueryObjects(v8::Local<v8::Context> v8_context, void QueryObjects(v8::Local<v8::Context> v8_context,
QueryObjectPredicate* predicate, QueryObjectPredicate* predicate,
PersistentValueVector<v8::Object>* objects) { std::vector<v8::Global<v8::Object>>* objects) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_context->GetIsolate()); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_context->GetIsolate());
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
isolate->heap_profiler()->QueryObjects(Utils::OpenHandle(*v8_context), isolate->heap_profiler()->QueryObjects(Utils::OpenHandle(*v8_context),
...@@ -1148,7 +1148,7 @@ void QueryObjects(v8::Local<v8::Context> v8_context, ...@@ -1148,7 +1148,7 @@ void QueryObjects(v8::Local<v8::Context> v8_context,
} }
void GlobalLexicalScopeNames(v8::Local<v8::Context> v8_context, void GlobalLexicalScopeNames(v8::Local<v8::Context> v8_context,
v8::PersistentValueVector<v8::String>* names) { std::vector<v8::Global<v8::String>>* names) {
i::Handle<i::Context> context = Utils::OpenHandle(*v8_context); i::Handle<i::Context> context = Utils::OpenHandle(*v8_context);
i::Isolate* isolate = context->GetIsolate(); i::Isolate* isolate = context->GetIsolate();
i::Handle<i::ScriptContextTable> table( i::Handle<i::ScriptContextTable> table(
...@@ -1161,7 +1161,8 @@ void GlobalLexicalScopeNames(v8::Local<v8::Context> v8_context, ...@@ -1161,7 +1161,8 @@ void GlobalLexicalScopeNames(v8::Local<v8::Context> v8_context,
i::Handle<i::ScopeInfo> scope_info(script_context->scope_info(), isolate); i::Handle<i::ScopeInfo> scope_info(script_context->scope_info(), isolate);
for (auto it : i::ScopeInfo::IterateLocalNames(scope_info)) { for (auto it : i::ScopeInfo::IterateLocalNames(scope_info)) {
if (i::ScopeInfo::VariableIsSynthetic(it->name())) continue; if (i::ScopeInfo::VariableIsSynthetic(it->name())) continue;
names->Append(Utils::ToLocal(handle(it->name(), isolate))); names->emplace_back(reinterpret_cast<Isolate*>(isolate),
Utils::ToLocal(handle(it->name(), isolate)));
} }
} }
} }
......
...@@ -254,8 +254,8 @@ class WasmScript : public Script { ...@@ -254,8 +254,8 @@ class WasmScript : public Script {
}; };
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
V8_EXPORT_PRIVATE void GetLoadedScripts(Isolate* isolate, V8_EXPORT_PRIVATE void GetLoadedScripts(
PersistentValueVector<Script>& scripts); Isolate* isolate, std::vector<v8::Global<Script>>& scripts);
MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* isolate, MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* isolate,
Local<String> source); Local<String> source);
...@@ -553,10 +553,10 @@ class QueryObjectPredicate { ...@@ -553,10 +553,10 @@ class QueryObjectPredicate {
void QueryObjects(v8::Local<v8::Context> context, void QueryObjects(v8::Local<v8::Context> context,
QueryObjectPredicate* predicate, QueryObjectPredicate* predicate,
v8::PersistentValueVector<v8::Object>* objects); std::vector<v8::Global<v8::Object>>* objects);
void GlobalLexicalScopeNames(v8::Local<v8::Context> context, void GlobalLexicalScopeNames(v8::Local<v8::Context> context,
v8::PersistentValueVector<v8::String>* names); std::vector<v8::Global<v8::String>>* names);
void SetReturnValue(v8::Isolate* isolate, v8::Local<v8::Value> value); void SetReturnValue(v8::Isolate* isolate, v8::Local<v8::Value> value);
......
...@@ -139,10 +139,10 @@ std::vector<std::unique_ptr<V8DebuggerScript>> V8Debugger::getCompiledScripts( ...@@ -139,10 +139,10 @@ std::vector<std::unique_ptr<V8DebuggerScript>> V8Debugger::getCompiledScripts(
int contextGroupId, V8DebuggerAgentImpl* agent) { int contextGroupId, V8DebuggerAgentImpl* agent) {
std::vector<std::unique_ptr<V8DebuggerScript>> result; std::vector<std::unique_ptr<V8DebuggerScript>> result;
v8::HandleScope scope(m_isolate); v8::HandleScope scope(m_isolate);
v8::PersistentValueVector<v8::debug::Script> scripts(m_isolate); std::vector<v8::Global<v8::debug::Script>> scripts;
v8::debug::GetLoadedScripts(m_isolate, scripts); v8::debug::GetLoadedScripts(m_isolate, scripts);
for (size_t i = 0; i < scripts.Size(); ++i) { for (size_t i = 0; i < scripts.size(); ++i) {
v8::Local<v8::debug::Script> script = scripts.Get(i); v8::Local<v8::debug::Script> script = scripts[i].Get(m_isolate);
if (!script->WasCompiled()) continue; if (!script->WasCompiled()) continue;
if (!script->IsEmbedded()) { if (!script->IsEmbedded()) {
int contextId; int contextId;
...@@ -809,17 +809,17 @@ v8::MaybeLocal<v8::Array> V8Debugger::internalProperties( ...@@ -809,17 +809,17 @@ v8::MaybeLocal<v8::Array> V8Debugger::internalProperties(
v8::Local<v8::Array> V8Debugger::queryObjects(v8::Local<v8::Context> context, v8::Local<v8::Array> V8Debugger::queryObjects(v8::Local<v8::Context> context,
v8::Local<v8::Object> prototype) { v8::Local<v8::Object> prototype) {
v8::Isolate* isolate = context->GetIsolate(); v8::Isolate* isolate = context->GetIsolate();
v8::PersistentValueVector<v8::Object> v8Objects(isolate); std::vector<v8::Global<v8::Object>> v8_objects;
MatchPrototypePredicate predicate(m_inspector, context, prototype); MatchPrototypePredicate predicate(m_inspector, context, prototype);
v8::debug::QueryObjects(context, &predicate, &v8Objects); v8::debug::QueryObjects(context, &predicate, &v8_objects);
v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope microtasksScope(isolate,
v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Local<v8::Array> resultArray = v8::Array::New( v8::Local<v8::Array> resultArray = v8::Array::New(
m_inspector->isolate(), static_cast<int>(v8Objects.Size())); m_inspector->isolate(), static_cast<int>(v8_objects.size()));
for (size_t i = 0; i < v8Objects.Size(); ++i) { for (size_t i = 0; i < v8_objects.size(); ++i) {
createDataProperty(context, resultArray, static_cast<int>(i), createDataProperty(context, resultArray, static_cast<int>(i),
v8Objects.Get(i)); v8_objects[i].Get(isolate));
} }
return resultArray; return resultArray;
} }
......
...@@ -672,12 +672,12 @@ Response V8RuntimeAgentImpl::globalLexicalScopeNames( ...@@ -672,12 +672,12 @@ Response V8RuntimeAgentImpl::globalLexicalScopeNames(
response = scope.initialize(); response = scope.initialize();
if (!response.IsSuccess()) return response; if (!response.IsSuccess()) return response;
v8::PersistentValueVector<v8::String> names(m_inspector->isolate()); std::vector<v8::Global<v8::String>> names;
v8::debug::GlobalLexicalScopeNames(scope.context(), &names); v8::debug::GlobalLexicalScopeNames(scope.context(), &names);
*outNames = std::make_unique<protocol::Array<String16>>(); *outNames = std::make_unique<protocol::Array<String16>>();
for (size_t i = 0; i < names.Size(); ++i) { for (size_t i = 0; i < names.size(); ++i) {
(*outNames)->emplace_back( (*outNames)->emplace_back(toProtocolString(
toProtocolString(m_inspector->isolate(), names.Get(i))); m_inspector->isolate(), names[i].Get(m_inspector->isolate())));
} }
return Response::Success(); return Response::Success();
} }
......
...@@ -241,7 +241,7 @@ Isolate* HeapProfiler::isolate() const { return heap()->isolate(); } ...@@ -241,7 +241,7 @@ Isolate* HeapProfiler::isolate() const { return heap()->isolate(); }
void HeapProfiler::QueryObjects(Handle<Context> context, void HeapProfiler::QueryObjects(Handle<Context> context,
debug::QueryObjectPredicate* predicate, debug::QueryObjectPredicate* predicate,
PersistentValueVector<v8::Object>* objects) { std::vector<v8::Global<v8::Object>>* objects) {
{ {
HandleScope handle_scope(isolate()); HandleScope handle_scope(isolate());
std::vector<Handle<JSTypedArray>> on_heap_typed_arrays; std::vector<Handle<JSTypedArray>> on_heap_typed_arrays;
...@@ -279,7 +279,7 @@ void HeapProfiler::QueryObjects(Handle<Context> context, ...@@ -279,7 +279,7 @@ void HeapProfiler::QueryObjects(Handle<Context> context,
v8::Local<v8::Object> v8_obj( v8::Local<v8::Object> v8_obj(
Utils::ToLocal(handle(JSObject::cast(heap_obj), isolate()))); Utils::ToLocal(handle(JSObject::cast(heap_obj), isolate())));
if (!predicate->Filter(v8_obj)) continue; if (!predicate->Filter(v8_obj)) continue;
objects->Append(v8_obj); objects->emplace_back(reinterpret_cast<v8::Isolate*>(isolate()), v8_obj);
} }
} }
......
...@@ -90,7 +90,7 @@ class HeapProfiler : public HeapObjectAllocationTracker { ...@@ -90,7 +90,7 @@ class HeapProfiler : public HeapObjectAllocationTracker {
void QueryObjects(Handle<Context> context, void QueryObjects(Handle<Context> context,
debug::QueryObjectPredicate* predicate, debug::QueryObjectPredicate* predicate,
v8::PersistentValueVector<v8::Object>* objects); std::vector<v8::Global<v8::Object>>* objects);
private: private:
void MaybeClearStringsStorage(); void MaybeClearStringsStorage();
......
...@@ -4395,8 +4395,7 @@ TEST(GlobalValueMap) { ...@@ -4395,8 +4395,7 @@ TEST(GlobalValueMap) {
TestGlobalValueMap<WeakMap>(); TestGlobalValueMap<WeakMap>();
} }
TEST(VectorOfGlobals) {
TEST(PersistentValueVector) {
LocalContext env; LocalContext env;
v8::Isolate* isolate = env->GetIsolate(); v8::Isolate* isolate = env->GetIsolate();
v8::internal::GlobalHandles* global_handles = v8::internal::GlobalHandles* global_handles =
...@@ -4404,41 +4403,40 @@ TEST(PersistentValueVector) { ...@@ -4404,41 +4403,40 @@ TEST(PersistentValueVector) {
size_t handle_count = global_handles->handles_count(); size_t handle_count = global_handles->handles_count();
HandleScope scope(isolate); HandleScope scope(isolate);
v8::PersistentValueVector<v8::Object> vector(isolate); std::vector<v8::Global<v8::Object>> vector;
Local<v8::Object> obj1 = v8::Object::New(isolate); Local<v8::Object> obj1 = v8::Object::New(isolate);
Local<v8::Object> obj2 = v8::Object::New(isolate); Local<v8::Object> obj2 = v8::Object::New(isolate);
v8::Global<v8::Object> obj3(isolate, v8::Object::New(isolate)); v8::Global<v8::Object> obj3(isolate, v8::Object::New(isolate));
CHECK(vector.IsEmpty()); CHECK(vector.empty());
CHECK_EQ(0, static_cast<int>(vector.Size())); CHECK_EQ(0, static_cast<int>(vector.size()));
vector.ReserveCapacity(3); vector.reserve(3);
CHECK(vector.IsEmpty()); CHECK(vector.empty());
vector.Append(obj1); vector.emplace_back(isolate, obj1);
vector.Append(obj2); vector.emplace_back(isolate, obj2);
vector.Append(obj1); vector.emplace_back(isolate, obj1);
vector.Append(obj3.Pass()); vector.emplace_back(obj3.Pass());
vector.Append(obj1); vector.emplace_back(isolate, obj1);
CHECK(!vector.IsEmpty()); CHECK(!vector.empty());
CHECK_EQ(5, static_cast<int>(vector.Size())); CHECK_EQ(5, static_cast<int>(vector.size()));
CHECK(obj3.IsEmpty()); CHECK(obj3.IsEmpty());
CHECK(obj1->Equals(env.local(), vector.Get(0)).FromJust()); CHECK(obj1->Equals(env.local(), vector[0].Get(isolate)).FromJust());
CHECK(obj1->Equals(env.local(), vector.Get(2)).FromJust()); CHECK(obj1->Equals(env.local(), vector[2].Get(isolate)).FromJust());
CHECK(obj1->Equals(env.local(), vector.Get(4)).FromJust()); CHECK(obj1->Equals(env.local(), vector[4].Get(isolate)).FromJust());
CHECK(obj2->Equals(env.local(), vector.Get(1)).FromJust()); CHECK(obj2->Equals(env.local(), vector[1].Get(isolate)).FromJust());
CHECK_EQ(5 + handle_count, global_handles->handles_count()); CHECK_EQ(5 + handle_count, global_handles->handles_count());
vector.Clear(); vector.clear();
CHECK(vector.IsEmpty()); CHECK(vector.empty());
CHECK_EQ(0, static_cast<int>(vector.Size())); CHECK_EQ(0, static_cast<int>(vector.size()));
CHECK_EQ(handle_count, global_handles->handles_count()); CHECK_EQ(handle_count, global_handles->handles_count());
} }
THREADED_TEST(GlobalHandleUpcast) { THREADED_TEST(GlobalHandleUpcast) {
v8::Isolate* isolate = CcTest::isolate(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
...@@ -4519,11 +4519,11 @@ TEST(DebugGetPossibleBreakpointsReturnLocations) { ...@@ -4519,11 +4519,11 @@ TEST(DebugGetPossibleBreakpointsReturnLocations) {
" return x > 2 ? fib(x - 1) + fib(x - 2) : fib(1) + fib(0);\n" " return x > 2 ? fib(x - 1) + fib(x - 2) : fib(1) + fib(0);\n"
"}"); "}");
CompileRun(source); CompileRun(source);
v8::PersistentValueVector<v8::debug::Script> scripts(isolate); std::vector<v8::Global<v8::debug::Script>> scripts;
v8::debug::GetLoadedScripts(isolate, scripts); v8::debug::GetLoadedScripts(isolate, scripts);
CHECK_EQ(scripts.Size(), 1); CHECK_EQ(scripts.size(), 1);
std::vector<v8::debug::BreakLocation> locations; std::vector<v8::debug::BreakLocation> locations;
CHECK(scripts.Get(0)->GetPossibleBreakpoints( CHECK(scripts[0].Get(isolate)->GetPossibleBreakpoints(
v8::debug::Location(0, 17), v8::debug::Location(), true, &locations)); v8::debug::Location(0, 17), v8::debug::Location(), true, &locations));
int returns_count = 0; int returns_count = 0;
for (size_t i = 0; i < locations.size(); ++i) { for (size_t i = 0; i < locations.size(); ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment