Skip to content

Commit

Permalink
src: remove redundant v8 namespaces in env.cc
Browse files Browse the repository at this point in the history
PR-URL: #38792
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
  • Loading branch information
juanarbol committed May 26, 2021
1 parent bbab59d commit d398712
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
namespace node {

using errors::TryCatchScope;
using v8::Array;
using v8::Boolean;
using v8::Context;
using v8::EmbedderGraph;
using v8::Function;
using v8::FunctionTemplate;
using v8::HandleScope;
using v8::HeapSpaceStatistics;
using v8::Integer;
using v8::Isolate;
using v8::Local;
Expand Down Expand Up @@ -1013,11 +1015,11 @@ void Environment::CollectUVExceptionInfo(Local<Value> object,
syscall, message, path, dest);
}

ImmediateInfo::ImmediateInfo(v8::Isolate* isolate, const SerializeInfo* info)
ImmediateInfo::ImmediateInfo(Isolate* isolate, const SerializeInfo* info)
: fields_(isolate, kFieldsCount, MAYBE_FIELD_PTR(info, fields)) {}

ImmediateInfo::SerializeInfo ImmediateInfo::Serialize(
v8::Local<v8::Context> context, v8::SnapshotCreator* creator) {
Local<Context> context, SnapshotCreator* creator) {
return {fields_.Serialize(context, creator)};
}

Expand All @@ -1035,8 +1037,8 @@ void ImmediateInfo::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("fields", fields_);
}

TickInfo::SerializeInfo TickInfo::Serialize(v8::Local<v8::Context> context,
v8::SnapshotCreator* creator) {
TickInfo::SerializeInfo TickInfo::Serialize(Local<Context> context,
SnapshotCreator* creator) {
return {fields_.Serialize(context, creator)};
}

Expand All @@ -1054,17 +1056,17 @@ void TickInfo::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("fields", fields_);
}

TickInfo::TickInfo(v8::Isolate* isolate, const SerializeInfo* info)
TickInfo::TickInfo(Isolate* isolate, const SerializeInfo* info)
: fields_(
isolate, kFieldsCount, info == nullptr ? nullptr : &(info->fields)) {}

AsyncHooks::AsyncHooks(v8::Isolate* isolate, const SerializeInfo* info)
AsyncHooks::AsyncHooks(Isolate* isolate, const SerializeInfo* info)
: async_ids_stack_(isolate, 16 * 2, MAYBE_FIELD_PTR(info, async_ids_stack)),
fields_(isolate, kFieldsCount, MAYBE_FIELD_PTR(info, fields)),
async_id_fields_(
isolate, kUidFieldsCount, MAYBE_FIELD_PTR(info, async_id_fields)),
info_(info) {
v8::HandleScope handle_scope(isolate);
HandleScope handle_scope(isolate);
if (info == nullptr) {
clear_async_id_stack();

Expand Down Expand Up @@ -1092,21 +1094,18 @@ void AsyncHooks::Deserialize(Local<Context> context) {
fields_.Deserialize(context);
async_id_fields_.Deserialize(context);
if (info_->js_execution_async_resources != 0) {
v8::Local<v8::Array> arr = context
->GetDataFromSnapshotOnce<v8::Array>(
info_->js_execution_async_resources)
.ToLocalChecked();
Local<Array> arr = context->GetDataFromSnapshotOnce<Array>(
info_->js_execution_async_resources)
.ToLocalChecked();
js_execution_async_resources_.Reset(context->GetIsolate(), arr);
}

native_execution_async_resources_.resize(
info_->native_execution_async_resources.size());
for (size_t i = 0; i < info_->native_execution_async_resources.size(); ++i) {
v8::Local<v8::Object> obj =
context
->GetDataFromSnapshotOnce<v8::Object>(
info_->native_execution_async_resources[i])
.ToLocalChecked();
Local<Object> obj = context->GetDataFromSnapshotOnce<Object>(
info_->native_execution_async_resources[i])
.ToLocalChecked();
native_execution_async_resources_[i].Reset(context->GetIsolate(), obj);
}
info_ = nullptr;
Expand Down Expand Up @@ -1523,7 +1522,7 @@ size_t Environment::NearHeapLimitCallback(void* data,
size_t young_gen_size = 0;
size_t old_gen_size = 0;

v8::HeapSpaceStatistics stats;
HeapSpaceStatistics stats;
size_t num_heap_spaces = env->isolate()->NumberOfHeapSpaces();
for (size_t i = 0; i < num_heap_spaces; ++i) {
env->isolate()->GetHeapSpaceStatistics(&stats, i);
Expand Down

0 comments on commit d398712

Please sign in to comment.