Skip to content

Commit

Permalink
core, bugfix: unordered_map compile error on android.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion committed Jun 9, 2023
1 parent e5cfac7 commit d76e916
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 28 deletions.
2 changes: 1 addition & 1 deletion fibjs/include/HeapProxy.h
Expand Up @@ -10,7 +10,7 @@
#include "ifs/HeapSnapshot.h"
#include "ifs/HeapGraphEdge.h"
#include <v8/include/v8-profiler.h>
#include <map>
#include <unordered_map>

namespace fibjs {

Expand Down
2 changes: 1 addition & 1 deletion fibjs/include/HeapSnapshot.h
Expand Up @@ -9,7 +9,7 @@

#include "ifs/HeapSnapshot.h"
#include <v8/include/v8-profiler.h>
#include <map>
#include <unordered_map>

namespace fibjs {

Expand Down
2 changes: 1 addition & 1 deletion fibjs/include/Redis.h
Expand Up @@ -13,7 +13,7 @@
#include "Variant.h"
#include "QuickArray.h"
#include "Buffer.h"
#include <map>
#include <unordered_map>
#include <inttypes.h>

namespace fibjs {
Expand Down
2 changes: 1 addition & 1 deletion fibjs/include/SandBox.h
Expand Up @@ -11,7 +11,7 @@
#include "ifs/Stream.h"
#include "ifs/process.h"
#include "ifs/Worker.h"
#include <map>
#include <unordered_map>
#include <vector>

namespace fibjs {
Expand Down
2 changes: 1 addition & 1 deletion fibjs/include/SimpleObject.h
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <map>
#include <unordered_map>
#include <algorithm>

namespace fibjs {
Expand Down
2 changes: 1 addition & 1 deletion fibjs/src/console/console.cpp
Expand Up @@ -12,7 +12,7 @@
#include "ifs/process.h"
#include "ifs/util.h"
#include "ifs/tty.h"
#include <map>
#include <unordered_map>
#include "console.h"
#include <stdlib.h>

Expand Down
2 changes: 1 addition & 1 deletion fibjs/src/crypto/X509Cert.cpp
Expand Up @@ -13,7 +13,7 @@
#include "PKey.h"
#include "StringBuffer.h"
#include "Buffer.h"
#include <map>
#include <unordered_map>

namespace fibjs {

Expand Down
50 changes: 33 additions & 17 deletions fibjs/src/profiler/HeapDiff.cpp
Expand Up @@ -10,7 +10,7 @@
#include "ifs/HeapGraphEdge.h"
#include "ifs/profiler.h"
#include <set>
#include <map>
#include <unordered_map>

namespace fibjs {

Expand Down Expand Up @@ -129,15 +129,20 @@ inline v8::Local<v8::Value> changesetToObject(Isolate* isolate, changeset& chang
changeset::iterator it = its[i];
v8::Local<v8::Object> d = v8::Object::New(isolate->m_isolate);
d->Set(context, isolate->NewString("type"),
isolate->NewString(it->first)).IsJust();
isolate->NewString(it->first))
.IsJust();
d->Set(context, isolate->NewString("size_bytes"),
v8::Integer::New(isolate->m_isolate, (int32_t)it->second.size)).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)it->second.size))
.IsJust();
d->Set(context, isolate->NewString("size"),
isolate->NewString(niceSize(it->second.size))).IsJust();
isolate->NewString(niceSize(it->second.size)))
.IsJust();
d->Set(context, isolate->NewString("+"),
v8::Integer::New(isolate->m_isolate, (int32_t)it->second.added)).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)it->second.added))
.IsJust();
d->Set(context, isolate->NewString("-"),
v8::Integer::New(isolate->m_isolate, (int32_t)it->second.released)).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)it->second.released))
.IsJust();
a->Set(context, a->Length(), d).IsJust();
}

Expand All @@ -160,7 +165,8 @@ result_t HeapSnapshot::diff(HeapSnapshot_base* before, HeapSnapshot_base* after,
before->get_nodes(nodes);
_count = nodes->length();
b->Set(context, isolate->NewString("nodes"),
v8::Integer::New(isolate->m_isolate, _count)).IsJust();
v8::Integer::New(isolate->m_isolate, _count))
.IsJust();

before->get_time(d);
b->Set(context, isolate->NewString("time"), d.value(isolate->m_isolate)).IsJust();
Expand All @@ -170,7 +176,8 @@ result_t HeapSnapshot::diff(HeapSnapshot_base* before, HeapSnapshot_base* after,
after->get_nodes(nodes);
_count = nodes->length();
a->Set(context, isolate->NewString("nodes"),
v8::Integer::New(isolate->m_isolate, _count)).IsJust();
v8::Integer::New(isolate->m_isolate, _count))
.IsJust();
after->get_time(d);
a->Set(context, isolate->NewString("time"), d.value(isolate->m_isolate)).IsJust();
o->Set(context, isolate->NewString("after"), a).IsJust();
Expand All @@ -181,32 +188,39 @@ result_t HeapSnapshot::diff(HeapSnapshot_base* before, HeapSnapshot_base* after,
buildIDSet(&beforeIDs, before, s);

b->Set(context, isolate->NewString("size_bytes"),
v8::Integer::New(isolate->m_isolate, (int32_t)s)).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)s))
.IsJust();
b->Set(context, isolate->NewString("size"),
isolate->NewString(niceSize(s))).IsJust();
isolate->NewString(niceSize(s)))
.IsJust();

diffBytes = s;
s = 0;
buildIDSet(&afterIDs, after, s);

a->Set(context, isolate->NewString("size_bytes"),
v8::Integer::New(isolate->m_isolate, (int32_t)s)).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)s))
.IsJust();
a->Set(context, isolate->NewString("size"),
isolate->NewString(niceSize(s))).IsJust();
isolate->NewString(niceSize(s)))
.IsJust();

diffBytes = s - diffBytes;

v8::Local<v8::Object> c = v8::Object::New(isolate->m_isolate);
c->Set(context, isolate->NewString("size_bytes"),
v8::Integer::New(isolate->m_isolate, (int32_t)diffBytes)).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)diffBytes))
.IsJust();
c->Set(context, isolate->NewString("size"),
isolate->NewString(niceSize(diffBytes))).IsJust();
isolate->NewString(niceSize(diffBytes)))
.IsJust();
o->Set(context, isolate->NewString("change"), c).IsJust();

std::vector<int32_t> changedIDs;
setDiff(beforeIDs, afterIDs, changedIDs);
c->Set(context, isolate->NewString("freed_nodes"),
v8::Integer::New(isolate->m_isolate, (int32_t)changedIDs.size())).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)changedIDs.size()))
.IsJust();

changeset changes;

Expand All @@ -222,7 +236,8 @@ result_t HeapSnapshot::diff(HeapSnapshot_base* before, HeapSnapshot_base* after,
setDiff(afterIDs, beforeIDs, changedIDs);

c->Set(context, isolate->NewString("allocated_nodes"),
v8::Integer::New(isolate->m_isolate, (int32_t)changedIDs.size())).IsJust();
v8::Integer::New(isolate->m_isolate, (int32_t)changedIDs.size()))
.IsJust();

for (size_t i = 0; i < changedIDs.size(); i++) {
obj_ptr<HeapGraphNode_base> n;
Expand All @@ -232,7 +247,8 @@ result_t HeapSnapshot::diff(HeapSnapshot_base* before, HeapSnapshot_base* after,
}

c->Set(context, isolate->NewString("details"),
changesetToObject(isolate, changes)).IsJust();
changesetToObject(isolate, changes))
.IsJust();

retVal = o;

Expand Down
2 changes: 1 addition & 1 deletion fibjs/src/util/util.cpp
Expand Up @@ -11,7 +11,7 @@
#include "QuickArray.h"
#include "parse.h"
#include "SimpleObject.h"
#include <map>
#include <unordered_map>

namespace fibjs {

Expand Down
2 changes: 1 addition & 1 deletion fibjs/src/util/util_format.cpp
Expand Up @@ -12,7 +12,7 @@
#include "StringBuffer.h"
#include "TextColor.h"
#include "Buffer.h"
#include <map>
#include <unordered_map>

namespace fibjs {

Expand Down
2 changes: 1 addition & 1 deletion fibjs/src/util/util_format_table.cpp
Expand Up @@ -13,7 +13,7 @@
#include "StringBuffer.h"
#include "TextColor.h"
#include "Buffer.h"
#include <map>
#include <unordered_map>

namespace fibjs {

Expand Down
2 changes: 1 addition & 1 deletion fibjs/src/xml/XmlParser.cpp
Expand Up @@ -14,7 +14,7 @@
#include "XmlText.h"
#include "XmlCDATASection.h"
#include "Runtime.h"
#include <map>
#include <unordered_map>
#define XML_STATIC
#include <expat/include/expat.h>

Expand Down

0 comments on commit d76e916

Please sign in to comment.