Status: New
Owner: ----
CC: [email protected]
Labels: Type-Bug Priority-Medium
New issue 3118 by [email protected]: Improve costant folding of typeof x
=== <typename>
http://code.google.com/p/v8/issues/detail?id=3118
function loop() {
var a = 'a', x;
for (var i = 0; i < 1000; i++) {
x = typeof a === "undefined";
}
return x;
}
Generated code:
;;; <@26,#10> constant-t
0x32f46f62 66 b9d10b2149 mov ecx,0x49210bd1 ;; debug:
position 30
;; object:
0x49210bd1 <String[1]: a>
;;; <@29,#36> typeof-is-and-branch
0x32f46f67 71 81f99180903e cmp ecx,0x3e908091 ;; debug:
position 91
;; object:
0x3e908091 <undefined>
0x32f46f6d 77 0f841c000000 jz 111 (0x32f46f8f)
0x32f46f73 83 f6c101 test_b cl,0x1
0x32f46f76 86 740d jz 101 (0x32f46f85)
0x32f46f78 88 8b49ff mov ecx,[ecx+0xff]
0x32f46f7b 91 f6410920 test_b [ecx+0x9],0x20
0x32f46f7f 95 0f850a000000 jnz 111 (0x32f46f8f)
The same for the case when a is undefined.
This should help produce more specialized code for inlined functions that
do typeof on their optional arguments.
I tried with various <typename> (e.g. function and having a = function ()
{}) and almost nothing is constant folded.
It seems the only case that is supported is numerics: typeof i === "number"
was constant folded away.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.