Hi:

      I try to read/understand some code in v8 csa sub-system, like this:

``` c++
  DebugBreak(); // [+] @a
  if (IsHoleyElementsKind(kind)) {   // [+] if statement
    condition = UintPtrGreaterThanOrEqual(key, length);
  } else {
    DebugBreak(); // [+] @b
    // We don't support growing here unless the value is being appended.
    condition = WordEqual(key, length);
  }
  Branch(condition, &grow_case, &no_grow_case);  // [+] Branch statement
```
I inserted two breakpoints at points A and B. I originally thought that 
between these two breakpoints, the code corresponding to 
|IsHoleyElementsKind(kind)| would be generated to check |kind|. However, it 
was not the case. There is no other code between the two |DebugBreak| 
instructions.  

``` c++
00007ff6`97326605 cc int 3 
00007ff6`97326606 cc int 3 
00007ff6`97326607 4d8be0 mov r12,r8
```

This means that my assumption was obviously wrong. It seems that I confused 
the difference between the if keyword and the Branch keyword. So, I came up 
with the following hypothesis:

   1. If we want to achieve an effect similar to if in CSA, we need to use 
   keywords like Branch.
   2. What is the role of if in CSA? I suspect that it is handled by 
   mksnapshot to generate different backup codes for different kind. Suppose 
   there are five kinds in total, then five similar pieces of code would be 
   generated.

Please tell me if my assumption is correct. If not, what is the difference 
between if and Branch in CSA?

If my assumption is correct, it seems that the kind should only be 
determined at runtime, so how does V8 know which piece of code to use?

Thank you.


-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/0a76378c-191f-45ad-b1e8-285e041a7890n%40googlegroups.com.

Reply via email to