nodejs v8.getHeapStatistics method

Some good explanation from gc-heap-stats package: total_heap_size: Number of bytes V8 has allocated for the heap. This can grow if usedHeap needs more. used_heap_size: Number of bytes in used by application data total_heap_size_executable: Number of bytes for compiled bytecode and JITed code heap_size_limit: The absolute limit the heap cannot exceed (default limit or –max_old_space_size) total_physical_size: … Read more

How is asynchronous javascript interpreted and executed in Node.js?

Basically what you are looking for is V8 Templates. It exposes all your C++ code as JavaScript functions that you can call from within the V8 Virtual Machine. You can associate C++ callbacks when functions are invoked or when specific object properties are accessed (Read Accessors and Interceptors). I found a very good article which … Read more

node.js in Eclipse – which plugin(s) are most people using?

There is Nodeclipse.org effort. Current version is 0.16 update site is http://www.nodeclipse.org/updates/ When you want to help in any way, start by raising issue Features Creating default structure for New Node Project and New Node Source File Generating Express project with Wizard JavaScript Syntax highlighting Bracket matching and marking selection occurences with background color Content … Read more

How to embed V8 in a Java application?

You can use J2V8 https://github.com/eclipsesource/J2V8. It’s even available in Maven Central. Below is a Hello, World! program using J2V8. package com.example; import com.eclipsesource.v8.V8; public class EclipseCon_snippet5 { public static class Printer { public void print(String string) { System.out.println(string); } } public static void main(String[] args) { V8 v8 = V8.createV8Runtime(); v8.registerJavaMethod(new Printer(), “print”, “print”, new … Read more

Access function location programmatically

The answer, for now, is no. The [[FunctionLocation]] property you see in Inspector is added in V8Debugger::internalProperties() in the debugger’s C++ code, which uses another C++ function V8Debugger::functionLocation() to gather information about the function. functionLocation() then uses a number of V8-specific C++ APIs such as v8::Function::GetScriptLineNumber() and GetScriptColumnNumber() to find out the exact information. All … Read more

Calling a v8 javascript function from c++ with an argument

I haven’t tested this, but it’s possible that something like this will work: // …define and compile “test_function” Handle<v8::Object> global = context->Global(); Handle<v8::Value> value = global->Get(String::New(“test_function”)); if (value->IsFunction()) { Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(value); Handle<Value> args[2]; args[0] = v8::String::New(“value1”); args[1] = v8::String::New(“value2”); Handle<Value> js_result = func->Call(global, 2, args); if (js_result->IsInt32()) { int32_t result = js_result->ToInt32().Value(); // … Read more

How does setInterval and setTimeout work?

Javascript is singled-threaded but the browser is not. The browser has at least three threads: Javascript engine thread, UI thread, and timing thread, where the timing of setTimeout and setInterval are done by the timing thread. When calling setTimeout or setInterval, a timer thread in the browser starts counting down and when time up puts … Read more

tech