v8 on the iPhone

101 views
Skip to first unread message

BenV

unread,
Sep 5, 2008, 6:39:01 PM9/5/08
to v8-users
Has anyone got v8 working on the iPhone yet? I was able to get it
compiling with a few SConscript and code changes (mainly around
mcontext_t use in platform-macos.cc and the use of
sys_icache_invalidate instead of the inline assembly in cpu-arm.cc),
but am having issues getting it to run - I get crashes when Invoke
tries to jump into the generated code.

My stack is:
#0 0x04000b68 in ??
#1 0x000a9ba0 in Invoke at execution.cc:86
#2 0x000aa51c in v8::internal::Execution::Call at execution.cc:117
#3 0x00041558 in v8::internal::Genesis::CompileScriptCached at
bootstrapper.cc:785
#4 0x00041e5c in v8::internal::Genesis::CompileNative at
bootstrapper.cc:737
#5 0x00041f98 in v8::internal::Genesis::CompileBuiltin at
bootstrapper.cc:729
#6 0x000438c0 in v8::internal::Genesis::InstallNatives at
bootstrapper.cc:931
#7 0x0004bcf0 in v8::internal::Genesis::Genesis at bootstrapper.cc:
1334
#8 0x0004be20 in v8::internal::Bootstrapper::CreateEnvironment at
bootstrapper.cc:341
#9 0x000257d4 in v8::Context::New at api.cc:2121

It's trying to compile the builtin scripts. I enabled code printing
and got an entire code dump, and it all looks good (code-gen wise).
The interesting thing, though, is the address ranges that get printed
out look slightly different than the JSEntryFunction entry var in
Invoke that is getting called (top of the stack): 0x4000b68

From the dump, I have this:
0x4002b14 embedded object (0x4000135 <undefined>)
0x4002b1c embedded object (0x3c16571 <FixedArray[94]>)
0x4002b34 code target (STUB) (0x40029dc)
0x4002b3c code target (STUB) (0x4002a10)
0x4002b40 statement position (121)
0x4002b40 embedded object (0x4001ee9 <String[7]: $Object>)
0x4002b50 embedded object (0x4001df5 <String[6]: global>)
0x4002b58 code target (context) (LOAD_IC) (0x4001430)
0x4002b60 position (143)
0x4002b60 embedded object (0x40001c5 <String[6]: Object>)
0x4002b68 code target (LOAD_IC) (0x4001430)
0x4002b74 code target (STUB) (0x4002a64)

Note that all the addresses are 0x400__2__, where as the entry address
is 0x400__0__. If the code does live at 0x4002... then it would make
sense that it's dying as it jumps into nowhere.
What gives?

Anyone know the best way to diagnose this? Or has anyone got it
working? I really, really want v8 running :)

Ivan Posva

unread,
Sep 5, 2008, 7:02:32 PM9/5/08
to v8-u...@googlegroups.com
Ben,

Have you checked whether porting and running V8 on the iPhone is
covered by your iPhone SDK Agreement? Judging from publicly available
reports I would guess that there are parts that make your endeavor
impossible.

Cheers,
-Ivan

BenV

unread,
Sep 5, 2008, 7:11:24 PM9/5/08
to v8-users
This is more of an experiment than anything, but the agreement
specifically prevents loading of plugins or running interpreted code
that has been _downloaded_ - my scripts are embedded within the
application and used purely to ease development. What I'm doing isn't
prohibited by the agreement - what I want to eventually do is, but I'm
hoping they'll open things up by the time I get that far ;)

On Sep 5, 4:02 pm, "Ivan Posva" <ipo...@chromium.org> wrote:
> Ben,
>
> Have you checked whether porting and running V8 on the iPhone is
> covered by your iPhone SDK Agreement? Judging from publicly available
> reports I would guess that there are parts that make your endeavor
> impossible.
>
> Cheers,
> -Ivan
>
Reply all
Reply to author
Forward
0 new messages