Hi all. Tring to understand CharCodeAtIntrinsic in DFG. As I understand it has to call stringProtoFuncCharCodeAt(ExecState*) function, but in produced assembly thera is no call instruction under StringCharCodeAt Node Here is the test script var b=0; function f() { var str="hello"; var a=str.charCodeAt(0); b=b+a; } var i=0; for(i=0;i<2500;i++) { f(); } print(b); And the part of procused assembly. .............................................. 24: < 1:5> GetIndexedPropertyStorage(@4<String>, Storage|PureInt|CanExit, String, bc#20) 0x7fc503077871: mov 0x10(%rax), %rcx 0x7fc503077875: test %ecx, %ecx 0x7fc503077877: jz 0x7fc5030779c0 0x7fc50307787d: mov 0x8(%rcx), %rcx 15: < 1:5> StringCharCodeAt(@4<String>, @13<Int32>, @24, Int32|CanExit, String, bc#20) 0x7fc503077881: xor %ebx, %ebx 0x7fc503077883: cmp 0xc(%rax), %ebx 0x7fc503077886: jae 0x7fc5030779e1 0x7fc50307788c: mov 0x10(%rax), %rdi 0x7fc503077890: test $0x40, 0x18(%rdi) 0x7fc503077897: jz 0x7fc5030778a6 0x7fc50307789d: movzx (%rcx,%rbx), %edi 0x7fc5030778a1: jmp 0x7fc5030778aa 0x7fc5030778a6: movzx (%rcx,%rbx,2), %edi 0x7fc5030778aa: mov $0xffffffff, %r11 0x7fc5030778b4: cmp %r11, %rdi 0x7fc5030778b7: jbe 0x7fc5030778be 0x7fc5030778bd: int3 16: skipped < 0:-> SetLocal(@15<Int32>, <empty>, r1(H), bc#20) 17: < 1:4> GetGlobalVar(JS, global4(0x7fc5478bfa00), bc#29) predicting Int 0x7fc5030778be: mov $0x7fc5478bfa00, %rsi 0x7fc5030778c8: mov (%rsi), %rsi .............................................. As I understand from assembly, StringCharCodeAt only loads "h" to edi. So the question is how StringCharCodeAt calls stringProtoFuncCharCodeAt or where the actual converting from char to unicode is done?
participants (2)
-
Darin Adler
-
wingoog moon