Status: Assigned
Owner: [email protected]
CC: [email protected]
Labels: Type-Bug Priority-Medium Harmony

New issue 3958 by [email protected]: Raw strings for tagged templates are being recorded incorrectly
https://code.google.com/p/v8/issues/detail?id=3958

In working on fixing chromium:450942, I notice that we report the wrong result for "tag`1``2``3``4`" where "tag" returns the tag function until the last call, which then returns the callsite.

This results in:

```
tag called with i=0 with callsite + ["1"]
returning tag
tag called with i=1 with callsite + ["2"]
returning tag
tag called with i=2 with callsite + ["2"]
returning cs for i=2
2
```

while on traceur and firefox we end up with

```
tag called with i=0 with callsite ["1"]
returning tag
tag called with i=1 with callsite ["2"]
returning tag
tag called with i=2 with callsite ["3"]
returning cs for i=2
3
```

Debugging this reveals that when multiple templates occur in order like this, the raw strings are recorded incorrectly:

```
(lldb) p cooked_strings->length()
(int) $10 = 1
(lldb) p cooked_strings->at(0)->AsLiteral()->raw_value()->AsString()->raw_data()
(const unsigned char *) $11 = 0x0000000103829a58 "1"
(lldb) p raw_strings->at(0)->AsLiteral()->raw_value()->AsString()->raw_data()
(const unsigned char *) $12 = 0x0000000103829a90 "2"
```

In this case, the raw string and cooked string should have identical values, but the first raw string has the value of the second --- so we end up with a hash collision and pass the wrong callsite to the tag function.


--
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/d/optout.

Reply via email to