I am trying to implement a fastpath for regular expressions in arm/code-stubs-arm.cc
in the RegExpExecStub::Generate
function. The subject string is stored in the register 'r4'. I need to traverse character by character in the string but I can't seem to be able to do it. I have tried things like:
__ ldrb( r3, MemOperand(r4,0));
//to get to 0th char and store it to r3
Or:
__ ldrb( r3, MemOperand(r4,String::kLengthOffset));
//to do the same thing as above in case the data begins after length field.
I am using the d8 shell to check the value of the registers by stopping at a breakpoint after the above statements and doing a print r3
to check if the character is loaded or not. However, I see random values in the register when I try the above statements. Ideally I should see the character in hex form.
Turns out the correct offset should be String::kSize-1 and so on.