`
kangkapo
  • 浏览: 2707 次
  • 性别: Icon_minigender_1
  • 来自: 西安
最近访客 更多访客>>
社区版块
存档分类
最新评论

Android: Your JS Engine is not always V8

阅读更多
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.

分享到:
评论

相关推荐

    Metal by Tutorials: Beginning game engine development with Metal-2019-pdf.rar

    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 ...

    velocity-engine-core-2.3-API文档-中英对照版.zip

    赠送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;...

    Google v8 javascript engine source code

    谷歌V8 JavaScript引擎是Google开发的一款高性能的JavaScript和WebAssembly执行环境,被广泛应用于Chrome浏览器以及Node.js等项目。V8引擎以其快速的解析、编译和执行JavaScript代码的能力而闻名,它通过即时编译...

    delphi调用v8引擎.zip

    V8引擎则是Google开发的一个开源JavaScript运行时环境,广泛应用于Chrome浏览器和Node.js服务器端JavaScript执行。"delphi调用v8引擎.zip"这个压缩包文件很可能是提供了一个示例或教程,展示了如何在Delphi项目中...

    activiti-engine-5.21.0-API文档-中文版.zip

    赠送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引擎的PHP扩展v8js.zip

    V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine 标签:v8js

    Metal by Tutorials: Beginning game engine development with Metal-2019_code1

    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 ...

    Metal by Tutorials: Beginning game engine development with Metal-2019_code2

    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 ...

    .NET V8Engine Wrapper

    V8Engine是Google开发的一个高性能JavaScript引擎,广泛应用于Chrome浏览器以及Node.js等项目。通过.NET V8Engine Wrapper,.NET开发者可以利用V8的强大性能来执行JavaScript代码,同时无缝地在.NET和JavaScript世界...

    c# asp.net 在后台使用谷歌V8引擎执行js

    c# 、asp.net 在后台使用谷歌V8引擎执行js,将示例工程中的GoogleV8Engine.cs文件复制到你的项目中。将GoogleV8Engine_x64.dll 和 GoogleV8Engine_x86.dll 两个非托管DLL文件拷贝到工程部署的DLL目录下(ASP.Net拷贝...

    google v8 javascript engine源码

    google v8 javascript engine源代码

    velocity-engine-core-2.3-API文档-中文版.zip

    赠送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无法启动提示: Default storage engine (InnoDB) is not available的解决方法

    看下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运行时

    Unreal.js:Unreal.js:为UnrealEngine 4构建的Javascript运行时

    linphone-android最新sdk

    **linphone-android SDK详解** **一、linphone简介** Linphone是一款开源的VoIP(Voice over IP)软件,它提供了跨平台的语音、视频通话功能,支持多种协议,如SIP(Session Initiation Protocol)、RTP(Real-...

    activiti-engine-5.21.0-API文档-中英对照版.zip

    赠送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; 包含...

    S60 Platform: 2D Game Engine Example

    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

    google v8引擎编译后的dll及头文件

    V8引擎是Google开发的一款高性能的JavaScript和WebAssembly运行时环境,它被广泛应用于Chrome浏览器以及Node.js等服务器端JavaScript平台。V8引擎以其高效、快速的解释和编译JavaScript代码而闻名,它实现了...

    delphi 调用google v8 引擎 最新版本

    Google V8则是一款开源的JavaScript引擎,被广泛应用于Chrome浏览器和Node.js环境中,以提供高性能的JavaScript执行能力。本篇文章将深入探讨如何在Delphi项目中调用Google V8引擎,实现高效率执行JavaScript代码。 ...

    3D WebView for Android with Gecko Engine Web Browser

    3D WebView for Android with Gecko Engine Web Browser 4.1版本 该版本官方发布时间:2022年5月16日 此插件199美刀,unity版本要使用2018.4.36以上的版本 作者用的2019.4.14 完美没有报错 作者有使用这案例的教程,...

Global site tag (gtag.js) - Google Analytics