v8

What is the correct way to use v8::Locker, and why must I use it?

时间秒杀一切 提交于 2019-12-07 03:11:41
问题 I'm trying to embed v8 in an Android application using NDK. I have a JNI module that looks something like this (JNI mapping code not shown): #include <jni.h> #include <android/log.h> #include <v8.h> using namespace v8; static jlong getMagicNumber() { HandleScope handle_scope; Persistent<Context> context = Context::New(); Context::Scope context_scope(context); Handle<String> source = String::New("40 + 2"); Handle<Script> script = Script::Compile(source); Handle<Value> result = script->Run();

nodejs profiling; what can 'Unknown' be

拥有回忆 提交于 2019-12-07 02:13:31
问题 While profiling a nodejs program, I see that 61% of the ticks are caused by 'Unknown' (see below). What can this be? What should I look for? gr, Coen Statistical profiling result from node, (14907 ticks, 9132 unaccounted, 0 excluded). [Unknown]: ticks total nonlib name 9132 61.3% [Shared libraries]: ticks total nonlib name 1067 7.2% 0.0% C:\Windows\SYSTEM32\ntdll.dll 55 0.4% 0.0% C:\Windows\system32\kernel32.dll [JavaScript]: ticks total nonlib name 1381 9.3% 10.0% LazyCompile: *RowDataPacket

javascript internals: how events are implemented?

♀尐吖头ヾ 提交于 2019-12-07 01:40:27
问题 My question is related to how the JS engines implement the pattern of asynchronous events when we do something like bind event handlers on a dom for lets say a click event.? Do they have something like a separate thread that is listening to all the click events ? When an event does occur , do they refer the bind list and bubble up the events ? Similar is with Ajax,the asynchronous network call, where the browser spans a new thread that would start listening to the data from the server and

How is asynchronous callback implemented?

限于喜欢 提交于 2019-12-07 00:19:54
问题 How do all the languages implements asynchronous callbacks? For example in C++, one need to have a "monitor thread" to start a std::async . If it is started in main thread, it has to wait for the callback. std::thread t{[]{std::async(callback_function).get();}}.detach(); v.s. std::async(callback_function).get(); //Main thread will have to wait What about asynchronous callbacks in JavaScript? In JS callbacks are massively used... How does V8 implement them? Does V8 create a lot of threads to

How to understand “hasOwnProperty” and “__proto__” in Js?

半腔热情 提交于 2019-12-06 16:56:15
In ECMAScript,there is not __proto__ of an object: Array.hasOwnProperty('prototype') //true var arr = new Array() arr.hasOwnProperty('__proto__') //false then, we can find: Object.getOwnPropertyDescriptors(arr) Output: length:{value: 1, writable: true, enumerable: false, configurable: false} __proto__:Object So, I am confused: Does arr has his own property __proto__ ? When I try to do follow things: arr.unshift("2") Where does Js engine find unshift method? Is there any information let Js engine find unshift ? Where does Js engine find unshift method? On Array.prototype , from which arr

Difficulty installing therubyracer 0.10.2 and apple-gcc42 on Mac OSX 10.12.6 Sierra

孤街浪徒 提交于 2019-12-06 15:27:47
The answer to this similar question doesn't solve my problem. Here is the answer from that question: If you decide to use a newer therubyracer gem version, you will no longer have this problem Otherwise: brew tap homebrew/dupes # Thanks Tom brew install apple-gcc42 export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 brew uninstall v8 gem uninstall libv8 gem install therubyracer -v '0.10.2' # specify version The problem I'm running into with this

How to build V8 without “external startup data”?

前提是你 提交于 2019-12-06 13:46:04
I want a standalone JavaScript library for embedding. I already build V8 and its working correctly, but binary needs two "external data" files. I don want this files. I was trying to build V8 without "external startup data". I tried to set v8_use_external_startup_data : 0, in build.common.gypi and build/standalone.gypi, but then make is reporting failure at some point. I'm using following code to build v8: git clone https://chromium.googlesource.com/chromium/tool/depot_tools.git export PATH=`pwd`/depot_tools:"$PATH" fetch v8 gclient sync cd v8 git checkout branch-heads/5.1 # ... modifying gyni

Rubyracer (V8 binding for Ruby) performs really slow

折月煮酒 提交于 2019-12-06 13:02:41
So, I have a TCP server in eventmachine and therubyracer is used as a way to pre-pend operations (like filters or extensions) to the server. It all works charming when the server is not receiving a lot of data, but when it's being flooded (it is required sometimes) it becomes really slow. So, I did a small benchmark to see how slower the rubyracer is compared to Ruby, and I was shocked when I saw the results: user system total real V8: 0.060000 0.000000 0.060000 ( 0.059903) Ruby: 0.000000 0.000000 0.000000 ( 0.000524) I don't mind if it's slow, to be honest, but I don't want it to lock up my

关于编译多目标平台abi的控制的随笔记录

本秂侑毒 提交于 2019-12-06 12:18:53
关于编译多目标平台abi的控制注意事项 即编译出"armeabi-v7a", "arm64-v8a"的控制。 对应用控制 ndk的abi类型有助于较少apk的包体大小 最终输出的平台类型数量与最终执行编译命令的工程gradle配置有关 假设 某lib配置了 ndk { abiFilters "armeabi-v7a", "arm64-v8a" } 当触发lib的编译操作时 则会在该lib的buidl/intermediates中输出 "armeabi-v7a"和"arm64-v8a"的对应文件 如主app模块配置为 ndk { abiFilters "armeabi-v7a" } 则app和lib模块均只产生 "armeabi-v7a"的目录和文件 总结: 以触发编译时的模块为准 来源: https://my.oschina.net/u/1446823/blog/3137366

控制引入的so文件在debug编译时输出目标平台ABI类型(arm-v7a,arm64-v8a)

亡梦爱人 提交于 2019-12-06 12:16:32
控制引入的so文件在debug编译时输出目标平台ABI类型(arm-v7a,arm64-v8a) buildTypes { debug { jniDebuggable false ndk { abiFilters "armeabi-v7a", "arm64-v8a" } } release { minifyEnabled false ndk { abiFilters "armeabi-v7a", "arm64-v8a" } } } 来源: https://my.oschina.net/u/1446823/blog/3137352