[v8-users] IsFunction() on v8::Name returns false

2019-09-26 Thread Gautham B A
Hi all, Calling IsFunction() on v8::Local is returning false, even though v8::Local was pointing to a function in JavaScript. Is this expected? Consider the following code - #include #include #include #include void Getter(v8::Local key, const v8::PropertyCallbackInfo ) {

Re: [v8-users] How to run a v8 shell standalone and inspect / debug with Chrome DevTools

2019-05-20 Thread Gautham B A
b.com/hsharsha/v8inspector in a separate > directory and I'm trying to execute cmake. > > Is there a way to tell FindV8.cmake, where to look for v8 header files and > libs in my system? > > > Thanks, > Joe > > > On Monday, 20 May 2019 10:11:24 UTC+5:30, Gautham B A

[v8-users] Callback when variable is no longer valid

2019-05-19 Thread Gautham B A
Hi all, I'm trying to track when a variable becomes invalid. Consider the following code where the variable goes out of scope - function SomeFunction() { for(let i = 0; i < 10; ++i) { let instance = new MyClass(); // MyClass is implemented in C++ } // instance goes out of scope and isn't

Re: [v8-users] How to run a v8 shell standalone and inspect / debug with Chrome DevTools

2019-05-19 Thread Gautham B A
Checkout this project - https://github.com/hsharsha/v8inspector . It does exactly what you're looking for. We're using the same at Couchbase and it's working absolutely fine. On Sunday, 19 May 2019 13:50:30 UTC+5:30, joe lewis wrote: > > A bit more reading and I understood how dumb the question

[v8-users] Segmentation fault in v8::Context::New

2019-01-31 Thread Gautham B A
Hi all, I have the following implementation - class Evaluator { public: Evaluator(); void AddFunction(); private: v8::Isolate *isolate_; }; Evaluator::Evaluator() { v8::V8::InitializeICUDefaultLocation(""); auto platform = v8::platform::CreateDefaultPlatform();

Re: [v8-users] Returning v8::MaybeLocal from C++ functions

2018-11-23 Thread Gautham B A
Thank you. I'm using v8 5.9.211. It doesn't have the EscapableHandleScope::EscapeMaybe() function. Is there any other way to achieve this? On Friday, 23 November 2018 13:59:09 UTC+5:30, Ben Noordhuis wrote: > > On Fri, Nov 23, 2018 at 7:09 AM Gautham B A > wrote: > > Hi a

[v8-users] Returning v8::MaybeLocal from C++ functions

2018-11-22 Thread Gautham B A
Hi all, I was wondering if it's alright to just return a *v8::MaybeLocal* from a C++ function. We know that* v8::Local* objects must be escaped using a *v8::EscapableHandleScope* if we are to return v8::Local from a function. But I couldn't find the corresponding *Escape()* overload for

[v8-users] Creating custom Error types by inheriting from JavaScript Error class in v8

2018-11-21 Thread Gautham B A
Hi all, I'm trying to create a *CustomError* class by inheriting from the JavaScript *Error* class. So, I have a FunctionTemplate for CustomError auto custom_err_template = v8::FunctionTemplate::New(isolate); In the v8 docs on FunctionTemplate -

[v8-users] Right usage of v8::EscapableHandleScope

2018-11-12 Thread Gautham B A
Hi all, >From the v8 docs, we know that whenever a v8::Local variable needs to live beyond the function where it was created, we need to escape it with a v8::EscapableHandleScope. Should I call Escape() when I'm setting a v8::Local variable as a property of some other v8::Local? Please see

[v8-users] base64 encode/decode in v8

2018-08-20 Thread Gautham B A
Hello folks, I was wondering if there's any v8 API that allows one to do base64 encoding/decoding. Browsers have window.btoa, but it's not part of the global object in v8. Thanks, --Gautham -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users ---

Re: [v8-users] Is it necessary to check if v8::Local is empty before using it?

2018-05-15 Thread Gautham B A
uis wrote: > > On Tue, May 15, 2018 at 12:10 PM, Gautham B A > <gautham@gmail.com > wrote: > > Hi all, > > > > Please consider the following code - > > void ParseJSON(v8::Isolate *isolate, const v8::Local > _str) { > > v8::HandleScope hand

[v8-users] Is it necessary to check if v8::Local is empty before using it?

2018-05-15 Thread Gautham B A
Hi all, Please consider the following code - void ParseJSON(v8::Isolate *isolate, const v8::Local _str) { v8::HandleScope handle_scope(isolate); auto v8val_json = v8::JSON::Parse(isolate, v8_str); v8::Local v8obj_json; if (!v8val_json.ToLocal(_json)) { // Empty return; } //

[v8-users] Parsing only select fields of a JSON in v8

2018-04-24 Thread Gautham B A
Hi all, As per the JSON spec, there's some mention about JSON pointers which says JSON Pointer defines a string syntax for identifying a specific value >within a JavaScript Object Notation (JSON) document. > > https://tools.ietf.org/html/rfc6901 Consider a large JSON { "a" : 1234, "b" : [1,

Re: [v8-users] ICU data file missing?

2017-10-02 Thread Gautham B A
I'm trying to do the same with v8 5.9.211 on Windows and I have some problems. I created a new Visual Studio 2015 project and added hello-world.cc as its source. I setup the include and lib directories in project configuration and it builds without any warnings/errors. As suggested in the

Re: [v8-users] Is it safe to consume v8::Private methods?

2017-07-13 Thread Gautham B A
No, .ToLocalChecked() is called by my code, not from V8. I would like to know if the APIs under v8::Private namespace has been battle tested. On Wednesday, 12 July 2017 14:53:57 UTC+5:30, Ben Noordhuis wrote: > > On Wed, Jul 12, 2017 at 11:15 AM, Gautham B A > <gautham@gmail

Re: [v8-users] Is it safe to consume v8::Private methods?

2017-07-12 Thread Gautham B A
I've observed that the exception thrown is - # # Fatal error in v8::ToLocalChecked # Empty MaybeLocal. # Is it possible to catch that exception to prevent v8 process from crashing? On Wednesday, 12 July 2017 12:15:51 UTC+5:30, Ben Noordhuis wrote: > > On Wed, Jul 12, 2017 at 7:34 AM, Gau

[v8-users] Is it safe to consume v8::Private methods?

2017-07-11 Thread Gautham B A
Hi all, I'm trying to use the private field of a v8::Object to store some data in it as shown here - https://github.com/nodejs/nan/issues/587. I was wondering if it's safe to use because when I try to read the private field (Using FromJust() in the process), in the documentation

Re: [v8-users] Memory leak on script crash

2017-05-01 Thread Gautham B A
@Brendan, could you please post how you managed to overcome this issue? On Monday, 1 May 2017 20:15:09 UTC+5:30, Gautham B A wrote: > > Hi Brendan, > > I managed to design a work around for this issue. I moved the class that I > was trying to expose from C++ world to JavaSc

Re: [v8-users] Memory leak on script crash

2017-05-01 Thread Gautham B A
am On Monday, 1 May 2017 19:55:27 UTC+5:30, Brendan Bates wrote: > Hey Gautham B A, > > I am currently experiencing a similar issue. I have found that using > NewInstance() causes a slow memory growth/leak in our application. We > aggressively call LowMemoryNotification() >

Re: [v8-users] Memory leak on script crash

2017-04-18 Thread Gautham B A
d onto the JS world). On Tuesday, 18 April 2017 14:49:11 UTC+5:30, Ben Noordhuis wrote: > > On Tue, Apr 18, 2017 at 9:31 AM, Gautham B A > <gautham@gmail.com > wrote: > > Thank you Ben. > > Yes, there's a try_catch.HasCaught() before running the script in or

Re: [v8-users] Memory leak on script crash

2017-04-18 Thread Gautham B A
without shutting the VM down? On Tuesday, 18 April 2017 12:42:58 UTC+5:30, Ben Noordhuis wrote: > > On Tue, Apr 18, 2017 at 7:32 AM, Gautham B A > <gautham@gmail.com > wrote: > > Hi all, > > > > I'm observing a memory leak when the script crashes at ru

[v8-users] Memory leak on script crash

2017-04-17 Thread Gautham B A
Hi all, I'm observing a memory leak when the script crashes at runtime. Here the JavaScript code (made to crash on purpose by throwing Exception). var res = new N1qlQuery('SELECT * FROM `sample`'); throw 'error'; // purposefully crash. The corresponding C++ code for N1qlQuery is as follows -

[v8-users] Re: Building v8 with Visual Studio 2015 on Windows 10

2017-03-30 Thread Gautham B A
es there: > > fetch v8 > git checkout branch-heads/4.8 > > ;) > > On Sunday, March 5, 2017 at 12:56:15 AM UTC-5, Gautham B A wrote: >> >> Hi all, >> >> I was able to build v8 (branch 4.8) on Windows 10 using Visual Studio >> 2015. I followed these

[v8-users] Re: Building v8 with Visual Studio 2015 on Windows 10

2017-03-04 Thread Gautham B A
Hi all, I was able to build v8 (branch 4.8) on Windows 10 using Visual Studio 2015. I followed these instructions - set DEPOT_TOOLS_WIN_TOOLCHAIN=0 set GYP_MSVS_VERSION=2015 set GYP_GENERATORS=msvs wget https://storage.googleapis.com/chrome-infra/depot_tools.zip -OutFile depot_tools.zip