Updates:
Status: PendingFurtherInfo
Comment #2 on issue 2245 by [email protected]: Handle<Value>() is
slower than Undefined(info.GetIsolate())
http://code.google.com/p/v8/issues/detail?id=2245
Unfortunately I am unable to reproduce these numbers. Have you compiled the
code in release mode? Because in debug mode we do additional checking that
might explain the bad performance. Could you make sure that you compiled in
release mode with -O2 or -O3 and that V8_ENABLE_CHECKS is not defined.
If that doesn't resolve the issue, could you attach your test harness so
that I can reproduce your numbers?
I disassembled the three accessors and the generated code looks exactly as
expected. The first one performs a call into V8, the second one has an
inlined fast path and the third one is basically a one word stack
allocation. So the empty handle should obviously be the fastest.
---
v8::Handle<Value> tstGetterA(Local<String> name, const AccessorInfo& info) {
return v8::Undefined();
}
Disassembly of
section .text._Z10tstGetterAN2v85LocalINS_6StringEEERKNS_12AccessorInfoE:
00000000 <_Z10tstGetterAN2v85LocalINS_6StringEEERKNS_12AccessorInfoE>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 8d 45 f4 lea -0xc(%ebp),%eax
7: 83 ec 24 sub $0x24,%esp
a: 8b 5d 08 mov 0x8(%ebp),%ebx
d: 89 04 24 mov %eax,(%esp)
10: e8 fc ff ff ff call 11
<_Z10tstGetterAN2v85LocalINS_6StringEEERKNS_12AccessorInfoE+0x11>
15: 8b 45 f4 mov -0xc(%ebp),%eax
18: 89 03 mov %eax,(%ebx)
1a: 89 d8 mov %ebx,%eax
1c: 8b 5d fc mov -0x4(%ebp),%ebx
1f: 83 ec 04 sub $0x4,%esp
22: c9 leave
23: c2 04 00 ret $0x4
---
v8::Handle<Value> tstGetterB(Local<String> name, const AccessorInfo& info) {
return v8::Undefined(info.GetIsolate());
}
Disassembly of
section .text._Z10tstGetterBN2v85LocalINS_6StringEEERKNS_12AccessorInfoE:
00000000 <_Z10tstGetterBN2v85LocalINS_6StringEEERKNS_12AccessorInfoE>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 24 sub $0x24,%esp
7: 8b 45 10 mov 0x10(%ebp),%eax
a: 8b 5d 08 mov 0x8(%ebp),%ebx
d: 8b 00 mov (%eax),%eax
f: 8b 40 f4 mov -0xc(%eax),%eax
12: 83 38 01 cmpl $0x1,(%eax)
15: 75 11 jne 28
<_Z10tstGetterBN2v85LocalINS_6StringEEERKNS_12AccessorInfoE+0x28>
17: 83 c0 20 add $0x20,%eax
1a: 89 03 mov %eax,(%ebx)
1c: 89 d8 mov %ebx,%eax
1e: 8b 5d fc mov -0x4(%ebp),%ebx
21: c9 leave
22: c2 04 00 ret $0x4
25: 8d 76 00 lea 0x0(%esi),%esi
28: 8d 45 f4 lea -0xc(%ebp),%eax
2b: 89 04 24 mov %eax,(%esp)
2e: e8 fc ff ff ff call 2f
<_Z10tstGetterBN2v85LocalINS_6StringEEERKNS_12AccessorInfoE+0x2f>
33: 8b 45 f4 mov -0xc(%ebp),%eax
36: 89 03 mov %eax,(%ebx)
38: 89 d8 mov %ebx,%eax
3a: 8b 5d fc mov -0x4(%ebp),%ebx
3d: 83 ec 04 sub $0x4,%esp
40: c9 leave
41: c2 04 00 ret $0x4
---
v8::Handle<Value> tstGetterC(Local<String> name, const AccessorInfo& info) {
return v8::Handle<v8::Value>();
}
Disassembly of
section .text._Z10tstGetterCN2v85LocalINS_6StringEEERKNS_12AccessorInfoE:
00000000 <_Z10tstGetterCN2v85LocalINS_6StringEEERKNS_12AccessorInfoE>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 8b 45 08 mov 0x8(%ebp),%eax
6: c7 00 00 00 00 00 movl $0x0,(%eax)
c: 5d pop %ebp
d: c2 04 00 ret $0x4
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev