Android: Your JS Engine is not always V8 | January 14th, 2011 Joe Bowser’s Blog
Recently, I watched some Mobile Web training, and I noticed that people overlook many things about Android. Namely these facts:
WebKit is different on every phone
The Browser and the WebKit engine are different things.
WebKit can have a different engine
So, as usual I will talk about how the source to Android is OPEN, and how with the source code, I can look at the build scripts and find out what Android ACTUALLY supports instead of doing feature detection or the other things people in turtlenecks use to decide what Android can and can’t do very well. Below is the applicable Makefile for WebKit:
# To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
# variable to true.
# Read JS_ENGINE environment variable
JAVASCRIPT_ENGINE = $(JS_ENGINE)
# The default / alternative engine depends on the device class.
# On devices with a lot of memory (e.g. Passion/Sholes), the
# default is V8. On everything else, the only choice is JSC.
# TODO: use ARCH_ARM_HAVE_ARMV7 once that variable is added to
# the build system.
ifeq ($(ARCH_ARM_HAVE_VFP),true)
DEFAULT_ENGINE = v8
ALT_ENGINE = jsc
else
DEFAULT_ENGINE = jsc
ALT_ENGINE = jsc
endif
ifneq ($(JAVASCRIPT_ENGINE),jsc)
ifneq ($(JAVASCRIPT_ENGINE),v8)
# No JS engine is specified, pickup the one we want as default.
ifeq ($(USE_ALT_JS_ENGINE),true)
JAVASCRIPT_ENGINE = $(ALT_ENGINE)
else
JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
endif
endif
endif
# Two ways to control which JS engine is used:
# 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
# This is the preferred way.
# 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
# up a default engine to build.
# To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
# can be set to true, so that two builds can be different but without
# specifying which JS engine to use.
# To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
# variable to true.
# Read JS_ENGINE environment variable
JAVASCRIPT_ENGINE = $(JS_ENGINE)
# The default / alternative engine depends on the device class.
# On devices with a lot of memory (e.g. Passion/Sholes), the
# default is V8. On everything else, the only choice is JSC.
# TODO: use ARCH_ARM_HAVE_ARMV7 once that variable is added to
# the build system.
ifeq ($(ARCH_ARM_HAVE_VFP),true)
DEFAULT_ENGINE = v8
ALT_ENGINE = jsc
else
DEFAULT_ENGINE = jsc
ALT_ENGINE = jsc
endif
ifneq ($(JAVASCRIPT_ENGINE),jsc)
ifneq ($(JAVASCRIPT_ENGINE),v8)
# No JS engine is specified, pickup the one we want as default.
ifeq ($(USE_ALT_JS_ENGINE),true)
JAVASCRIPT_ENGINE = $(ALT_ENGINE)
else
JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
endif
endif
endif
So, if you’re running a low-end Android device, like a Motorola Quench, your Javascript Engine will be different from the Nexus S, HTC EVO with CM7, the Motorola Droid, the Nexus One, etc. Since nobody has seen the official Android 2.3 on anything other than the Nexus S, I can only really do experiments with Cyanogen on an HTC Dream, which isn’t really accurate.
Recently, there was an issue with the emulator image on Android 2.3 that directly affected PhoneGap. Because I have no idea what Javascript Engine is on the emulators, I suspect that this image may creep up again on low-end phones and cause even more fragmentation than before. This is a REALLY bad thing, since it makes web development on Android even more frustrating, and will chase developers away from that platform. Like everything else in Android, things are always changing, so if any phone manufacturers are reading this and can test PhoneGap on their low-end line and get back to me, that would be greatly appreciated.
分享到:
相关推荐
You’ll build your own game engine in Metal where you can create 3D scenes and build your own 3D games. This book is for intermediate Swift developers interested in learning 3D graphics or gaining a ...
赠送jar包:velocity-engine-core-2.3.jar; 赠送原API文档:velocity-engine-core-2.3-javadoc.jar; 赠送源代码:velocity-engine-core-2.3-sources.jar; 赠送Maven依赖信息文件:velocity-engine-core-2.3.pom;...
谷歌V8 JavaScript引擎是Google开发的一款高性能的JavaScript和WebAssembly执行环境,被广泛应用于Chrome浏览器以及Node.js等项目。V8引擎以其快速的解析、编译和执行JavaScript代码的能力而闻名,它通过即时编译...
赠送jar包:activiti-engine-5.21.0.jar; 赠送原API文档:activiti-engine-5.21.0-javadoc.jar; 赠送源代码:activiti-engine-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-engine-5.21.0.pom; 包含...
V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine 标签:v8js
You’ll build your own game engine in Metal where you can create 3D scenes and build your own 3D games. This book is for intermediate Swift developers interested in learning 3D graphics or gaining a ...
You’ll build your own game engine in Metal where you can create 3D scenes and build your own 3D games. This book is for intermediate Swift developers interested in learning 3D graphics or gaining a ...
V8Engine是Google开发的一个高性能JavaScript引擎,广泛应用于Chrome浏览器以及Node.js等项目。通过.NET V8Engine Wrapper,.NET开发者可以利用V8的强大性能来执行JavaScript代码,同时无缝地在.NET和JavaScript世界...
c# 、asp.net 在后台使用谷歌V8引擎执行js,将示例工程中的GoogleV8Engine.cs文件复制到你的项目中。将GoogleV8Engine_x64.dll 和 GoogleV8Engine_x86.dll 两个非托管DLL文件拷贝到工程部署的DLL目录下(ASP.Net拷贝...
google v8 javascript engine源代码
赠送jar包:velocity-engine-core-2.3.jar 赠送原API文档:velocity-engine-core-2.3-javadoc.jar 赠送源代码:velocity-engine-core-2.3-sources.jar 包含翻译后的API文档:velocity-engine-core-2.3-javadoc-...
看下mysql目录的错误日志: 引用 090613 10:15:27 [ERROR] Default storage engine (InnoDB) is not available 090613 10:15:27 [ERROR] Aborting 090613 10:15:27 [Note] C:\www\mysql\bin\mysqld-nt: Shutdown ...
Unreal.js:Unreal.js:为UnrealEngine 4构建的Javascript运行时
V8引擎是Google开发的一款高性能的JavaScript和WebAssembly运行时环境,它被广泛应用于Chrome浏览器以及Node.js等服务器端JavaScript平台。V8引擎以其高效、快速的解释和编译JavaScript代码而闻名,它实现了...
赠送jar包:activiti-engine-5.21.0.jar; 赠送原API文档:activiti-engine-5.21.0-javadoc.jar; 赠送源代码:activiti-engine-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-engine-5.21.0.pom; 包含...
The code example is based on an earlier published Symbian OS: 2D Game Engine Example, which supports, for example, S60 2nd Edition and Series 80 2nd Edition. Main classes: CFbsBitmap, RBackedupWindow
3D WebView for Android with Gecko Engine Web Browser 4.1版本 该版本官方发布时间:2022年5月16日 此插件199美刀,unity版本要使用2018.4.36以上的版本 作者用的2019.4.14 完美没有报错 作者有使用这案例的教程,...
Winsoft JSEngine 3.0是一款专为Delphi开发者设计的JavaScript引擎,它为Delphi应用程序提供了执行JavaScript代码的能力,从而极大地扩展了Delphi开发者的工具箱。这个版本支持从Delphi 6到Delphi 10.2的多个开发...
一个基于V8 JavaScript Engine非常简单的JavaScript解密小程序。 程序功能:将加密的JavaScript代码拷贝到test/input.txt文件中,解密结果生成到test/output.txt文件中
谷歌V8引擎是一款开源的JavaScript执行环境,它由Google为Chrome浏览器开发,但现在已经广泛应用于许多其他项目和平台。V8以其高效的代码编译、执行速度以及对最新JavaScript特性的支持而著名。下面我们将深入探讨V8...