Not sure I understand. If nothing is printed, are you sure the function gets optimised at all?
On 22 September 2015 at 10:42, D T <[email protected]> wrote: > Thanks for your quick answer, Andreas! > > So, I got the snippet I showed you avove by mail to look over the ASM code > (I dont have much experience with Javascript ;) ). > When run the d8 as follows: > v8/out/ia32.release/d8 --print_opt_code test.js > > With the code printed in the RAW section (slightly modified, like): > function foo(n) > { > return Math.floor(Math.random() * n); > } > > V8 prints just nothing... > Am I missing something? > > > Am Dienstag, 22. September 2015 08:34:46 UTC+2 schrieb Andreas Rossberg: >> >> The printed raw source _is_ the exact source of that individual function >> (minus the 'function' prefix). What are you missing? >> >> On 21 September 2015 at 23:49, D T <[email protected]> wrote: >> >>> Hi v8 users, >>> >>> I am using d8 version 4.7.0 on Ubuntu Linux vivid. I played around with >>> d8 a little bit and used the following command line: >>> user@debugbox: v8/out/ia32.release/d8 --print_opt_code test.js >>> >>> >>> >>> >>> Which leads to the following output: >>> --- Raw source --- >>> (n) >>> { >>> return Math.floor(Math.random() * n); >>> } >>> >>> >>> >>> >>> --- Optimized code --- >>> optimization_id = 0 >>> source_position = 27528 >>> kind = OPTIMIZED_FUNCTION >>> name = rnd >>> stack_slots = 2 >>> compiler = crankshaft >>> Instructions (size = 612) >>> 0x2020e060 0 55 push ebp >>> 0x2020e061 1 89e5 mov ebp,esp >>> 0x2020e063 3 56 push esi >>> 0x2020e064 4 57 push edi >>> 0x2020e065 5 83ec08 sub esp,0x8 >>> 0x2020e068 8 50 push eax >>> 0x2020e069 9 c7c002000000 mov eax,0x2 >>> 0x2020e06f 15 c70484efdeefbe mov [esp+eax*4],0xbeefdeef >>> 0x2020e076 22 48 dec eax >>> 0x2020e077 23 75f6 jnz 15 (0x2020e06f) >>> 0x2020e079 25 58 pop eax >>> 0x2020e07a 26 c745f400000000 mov [ebp-0xc],0x0 >>> 0x2020e081 33 8b45fc mov eax,[ebp-0x4] >>> 0x2020e084 36 8945f0 mov [ebp-0x10],eax >>> 0x2020e087 39 89c6 mov esi,eax >>> 0x2020e089 41 3b25241aa009 cmp esp,[0x9a01a24] ;; >>> external reference (StackGuard::address_of_jslimit()) >>> 0x2020e08f 47 7305 jnc 54 (0x2020e096) >>> 0x2020e091 49 e8ea15321b call StackCheck (0x3b52f680) ;; >>> code: BUILTIN >>> 0x2020e096 54 b805cfb729 mov eax,0x29b7cf05 >>> [snip] >>> >>> >>> >>> Is there any way, to print the _original_ javascript code I feeded into >>> v8 (since the raw source here is not the exact same code as the input >>> code), before printing the optimized, corresponding code? >>> >>> Thanks! >>> >>> -- >>> -- >>> v8-users mailing list >>> [email protected] >>> http://groups.google.com/group/v8-users >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "v8-users" 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/d/optout. >>> >> >> -- > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" 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/d/optout. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" 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/d/optout.
