Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/llv8-constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,13 @@ void Types::Load() {
kLastContextType = LoadConstant("LastContextType");

kJSErrorType = LoadConstant("type_JSError__JS_ERROR_TYPE");
kJSPromiseType = LoadConstant("type_JSPromise__JS_PROMISE_TYPE");
if (kJSPromiseType == -1) {
// NOTE(mmarchini): On Node.js v10.x, JS_PROMISE always comes after
// JS_MESSAGE_OBJECT_TYPE in the InstanceType enum.
kJSPromiseType =
LoadConstant("type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE") + 1;
}
kHeapNumberType = LoadConstant("type_HeapNumber__HEAP_NUMBER_TYPE");
kMapType = LoadConstant("type_Map__MAP_TYPE");
kGlobalObjectType =
Expand Down
1 change: 1 addition & 0 deletions src/llv8-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ class Types : public Module {
int64_t kLastContextType;

int64_t kJSErrorType;
int64_t kJSPromiseType;
int64_t kHeapNumberType;
int64_t kMapType;
int64_t kGlobalObjectType;
Expand Down
1 change: 1 addition & 0 deletions src/llv8-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ inline bool JSObject::IsObjectType(LLV8* v8, int64_t type) {
return type == v8->types()->kJSObjectType ||
type == v8->types()->kJSAPIObjectType ||
type == v8->types()->kJSErrorType ||
type == v8->types()->kJSPromiseType ||
type == v8->types()->kJSSpecialAPIObjectType;
}

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/inspect-scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function closure() {
c.hashmap['stringifiedError'] = new Error('test');
c.hashmap['stringifiedErrorStack'] = c.hashmap['stringifiedError'].stack;

c.hashmap['promise'] = new Promise(() => {});

c.hashmap[0] = null;
c.hashmap[4] = undefined;
c.hashmap[23] = /regexp/;
Expand Down
4 changes: 4 additions & 0 deletions test/plugin/inspect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ const hashMapTests = {
});
}
},
'promise': {
re: /.promise=(0x[0-9a-f]+):<Object: Promise>/,
desc: '.promise Promise property'
},
// .array=0x000003df9cbe7919:<Array: length=6>,
'array': {
re: /.array=(0x[0-9a-f]+):<Array: length=6>/,
Expand Down