diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-12-05 16:41:55 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-12-06 12:52:07 +0100 |
commit | 1854ba04e9a68f062beb299dd6e1479279b26363 (patch) | |
tree | d5b2df9b8c1deb6388f7a728fca8e1c98c779abe /deps/v8/src/runtime/runtime-debug.cc | |
parent | b52c23b75f96e1c9d2c7b3a7e5619170d0a0d8e1 (diff) | |
download | android-node-v8-1854ba04e9a68f062beb299dd6e1479279b26363.tar.gz android-node-v8-1854ba04e9a68f062beb299dd6e1479279b26363.tar.bz2 android-node-v8-1854ba04e9a68f062beb299dd6e1479279b26363.zip |
deps: update V8 to 6.3.292.46
PR-URL: https://github.com/nodejs/node/pull/16271
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/src/runtime/runtime-debug.cc')
-rw-r--r-- | deps/v8/src/runtime/runtime-debug.cc | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/deps/v8/src/runtime/runtime-debug.cc b/deps/v8/src/runtime/runtime-debug.cc index 5d8852d943..9251fa3a7f 100644 --- a/deps/v8/src/runtime/runtime-debug.cc +++ b/deps/v8/src/runtime/runtime-debug.cc @@ -4,6 +4,8 @@ #include "src/runtime/runtime-utils.h" +#include <vector> + #include "src/arguments.h" #include "src/compiler.h" #include "src/debug/debug-coverage.h" @@ -19,8 +21,7 @@ #include "src/isolate-inl.h" #include "src/objects/debug-objects-inl.h" #include "src/runtime/runtime.h" -#include "src/wasm/wasm-module.h" -#include "src/wasm/wasm-objects.h" +#include "src/wasm/wasm-objects-inl.h" namespace v8 { namespace internal { @@ -586,13 +587,13 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { } } - List<Handle<Object>> locals; + std::vector<Handle<Object>> locals; // Fill in the values of the locals. int i = 0; for (; i < scope_info->StackLocalCount(); ++i) { // Use the value from the stack. if (ScopeInfo::VariableIsSynthetic(scope_info->LocalName(i))) continue; - locals.Add(Handle<String>(scope_info->LocalName(i), isolate)); + locals.emplace_back(scope_info->LocalName(i), isolate); Handle<Object> value = frame_inspector.GetExpression(scope_info->StackLocalIndex(i)); // TODO(yangguo): We convert optimized out values to {undefined} when they @@ -600,9 +601,9 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { if (value->IsOptimizedOut(isolate)) { value = isolate->factory()->undefined_value(); } - locals.Add(value); + locals.push_back(value); } - if (locals.length() < local_count * 2) { + if (static_cast<int>(locals.size()) < local_count * 2) { // Get the context containing declarations. DCHECK(maybe_context->IsContext()); Handle<Context> context(Context::cast(*maybe_context)->closure_context()); @@ -613,11 +614,11 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { VariableMode mode; InitializationFlag init_flag; MaybeAssignedFlag maybe_assigned_flag; - locals.Add(name); + locals.push_back(name); int context_slot_index = ScopeInfo::ContextSlotIndex( scope_info, name, &mode, &init_flag, &maybe_assigned_flag); Object* value = context->get(context_slot_index); - locals.Add(Handle<Object>(value, isolate)); + locals.emplace_back(value, isolate); } } @@ -641,7 +642,8 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { // information (except for what is collected above) is the same. if ((inlined_frame_index == 0) && it.javascript_frame()->has_adapted_arguments()) { - it.AdvanceToArgumentsFrame(); + it.AdvanceOneFrame(); + DCHECK(it.frame()->is_arguments_adaptor()); frame_inspector.SetArgumentsFrame(it.frame()); } @@ -849,17 +851,18 @@ RUNTIME_FUNCTION(Runtime_GetAllScopesDetails) { } FrameInspector frame_inspector(frame, inlined_frame_index, isolate); - List<Handle<JSObject>> result(4); + std::vector<Handle<JSObject>> result; ScopeIterator it(isolate, &frame_inspector, option); for (; !it.Done(); it.Next()) { Handle<JSObject> details; ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, details, it.MaterializeScopeDetails()); - result.Add(details); + result.push_back(details); } - Handle<FixedArray> array = isolate->factory()->NewFixedArray(result.length()); - for (int i = 0; i < result.length(); ++i) { + int result_size = static_cast<int>(result.size()); + Handle<FixedArray> array = isolate->factory()->NewFixedArray(result_size); + for (int i = 0; i < result_size; ++i) { array->set(i, *result[i]); } return *isolate->factory()->NewJSArrayWithElements(array); @@ -1028,12 +1031,13 @@ RUNTIME_FUNCTION(Runtime_DebugPrintScopes) { #ifdef DEBUG // Print the scopes for the top frame. - StackFrameLocator locator(isolate); - JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); - FrameInspector frame_inspector(frame, 0, isolate); - - for (ScopeIterator it(isolate, &frame_inspector); !it.Done(); it.Next()) { - it.DebugPrint(); + JavaScriptFrameIterator it(isolate); + if (!it.done()) { + JavaScriptFrame* frame = it.frame(); + FrameInspector frame_inspector(frame, 0, isolate); + for (ScopeIterator si(isolate, &frame_inspector); !si.Done(); si.Next()) { + si.DebugPrint(); + } } #endif return isolate->heap()->undefined_value(); @@ -1298,7 +1302,7 @@ RUNTIME_FUNCTION(Runtime_DebugReferencedBy) { CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); CHECK(max_references >= 0); - List<Handle<JSObject> > instances; + std::vector<Handle<JSObject>> instances; Heap* heap = isolate->heap(); { HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); @@ -1320,8 +1324,8 @@ RUNTIME_FUNCTION(Runtime_DebugReferencedBy) { if (obj->IsJSGlobalObject()) { obj = JSGlobalObject::cast(obj)->global_proxy(); } - instances.Add(Handle<JSObject>(obj)); - if (instances.length() == max_references) break; + instances.emplace_back(obj); + if (static_cast<int32_t>(instances.size()) == max_references) break; } // Iterate the rest of the heap to satisfy HeapIterator constraints. while (iterator.next()) { @@ -1329,15 +1333,16 @@ RUNTIME_FUNCTION(Runtime_DebugReferencedBy) { } Handle<FixedArray> result; - if (instances.length() == 1 && instances.last().is_identical_to(target)) { + if (instances.size() == 1 && instances.back().is_identical_to(target)) { // Check for circular reference only. This can happen when the object is // only referenced from mirrors and has a circular reference in which case // the object is not really alive and would have been garbage collected if // not referenced from the mirror. result = isolate->factory()->empty_fixed_array(); } else { - result = isolate->factory()->NewFixedArray(instances.length()); - for (int i = 0; i < instances.length(); ++i) result->set(i, *instances[i]); + int instances_size = static_cast<int>(instances.size()); + result = isolate->factory()->NewFixedArray(instances_size); + for (int i = 0; i < instances_size; ++i) result->set(i, *instances[i]); } return *isolate->factory()->NewJSArrayWithElements(result); } @@ -1353,7 +1358,7 @@ RUNTIME_FUNCTION(Runtime_DebugConstructedBy) { CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]); CHECK(max_references >= 0); - List<Handle<JSObject> > instances; + std::vector<Handle<JSObject>> instances; Heap* heap = isolate->heap(); { HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); @@ -1362,17 +1367,17 @@ RUNTIME_FUNCTION(Runtime_DebugConstructedBy) { if (!heap_obj->IsJSObject()) continue; JSObject* obj = JSObject::cast(heap_obj); if (obj->map()->GetConstructor() != *constructor) continue; - instances.Add(Handle<JSObject>(obj)); - if (instances.length() == max_references) break; + instances.emplace_back(obj); + if (static_cast<int32_t>(instances.size()) == max_references) break; } // Iterate the rest of the heap to satisfy HeapIterator constraints. while (iterator.next()) { } } - Handle<FixedArray> result = - isolate->factory()->NewFixedArray(instances.length()); - for (int i = 0; i < instances.length(); ++i) result->set(i, *instances[i]); + int instances_size = static_cast<int>(instances.size()); + Handle<FixedArray> result = isolate->factory()->NewFixedArray(instances_size); + for (int i = 0; i < instances_size; ++i) result->set(i, *instances[i]); return *isolate->factory()->NewJSArrayWithElements(result); } @@ -1919,9 +1924,9 @@ RUNTIME_FUNCTION(Runtime_DebugCollectCoverage) { // Collect coverage data. std::unique_ptr<Coverage> coverage; if (isolate->is_best_effort_code_coverage()) { - coverage.reset(Coverage::CollectBestEffort(isolate)); + coverage = Coverage::CollectBestEffort(isolate); } else { - coverage.reset(Coverage::CollectPrecise(isolate)); + coverage = Coverage::CollectPrecise(isolate); } Factory* factory = isolate->factory(); // Turn the returned data structure into JavaScript. @@ -1984,8 +1989,6 @@ RUNTIME_FUNCTION(Runtime_IncBlockCounter) { CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_SMI_ARG_CHECKED(coverage_array_slot_index, 1); - DCHECK(FLAG_block_coverage); - // It's quite possible that a function contains IncBlockCounter bytecodes, but // no coverage info exists. This happens e.g. by selecting the best-effort // coverage collection mode, which triggers deletion of all coverage infos in |