Permalink
Browse files

core, feat: support isFrozen function.

  • Loading branch information...
xicilion committed Aug 15, 2018
1 parent 7da2020 commit 62ae2a17fccd9ed47b3c6025de8ff1e562a53d2d
Showing with 15 additions and 7 deletions.
  1. +2 −0 fibjs/include/v8_api.h
  2. +13 −7 fibjs/src/base/v8_api.cpp
View
@@ -27,6 +27,8 @@ void beginCoverage(v8::Isolate* isolate);
void pauseCoverage(v8::Isolate* isolate);
void WriteLcovData(v8::Isolate* isolate, FILE* file);
bool isFrozen(v8::Handle<v8::Object> object);
} /* namespace fibjs */
#endif /* _V8_API_H_ */
View
@@ -26,10 +26,11 @@ namespace fibjs {
bool path_isAbsolute(exlib::string path);
v8::Local<v8::BigInt> BigInt_New(v8::Isolate* isolate, uint64_t value) {
v8::internal::Isolate* internal_isolate = reinterpret_cast<v8::internal::Isolate*>(isolate);
v8::internal::Handle<v8::internal::BigInt> result = v8::internal::BigInt::FromUint64(internal_isolate, value);
return v8::Utils::ToLocal(result);
v8::Local<v8::BigInt> BigInt_New(v8::Isolate* isolate, uint64_t value)
{
v8::internal::Isolate* internal_isolate = reinterpret_cast<v8::internal::Isolate*>(isolate);
v8::internal::Handle<v8::internal::BigInt> result = v8::internal::BigInt::FromUint64(internal_isolate, value);
return v8::Utils::ToLocal(result);
}
void InvokeApiInterruptCallbacks(v8::Isolate* isolate)
@@ -118,9 +119,7 @@ exlib::string traceInfo(v8::Isolate* isolate, int32_t deep, void* entry_fp, void
exlib::string traceInfo(v8::Isolate* isolate, int32_t deep)
{
v8::internal::Isolate* v8_isolate = (v8::internal::Isolate*)isolate;
return traceInfo(isolate, deep
, (void*)*v8_isolate->c_entry_fp_address()
, (void*)*v8_isolate->handler_address());
return traceInfo(isolate, deep, (void*)*v8_isolate->c_entry_fp_address(), (void*)*v8_isolate->handler_address());
}
void beginCoverage(v8::Isolate* isolate)
@@ -227,4 +226,11 @@ void WriteLcovData(v8::Isolate* isolate, FILE* file)
fclose(file);
}
bool isFrozen(v8::Handle<v8::Object> object)
{
auto obj = v8::Utils::OpenHandle(*object);
v8::Maybe<bool> test = v8::internal::JSReceiver::TestIntegrityLevel(obj, v8::internal::FROZEN);
return test.ToChecked();
}
}

0 comments on commit 62ae2a1

Please sign in to comment.