@@ -1526,6 +1526,14 @@ uint32_t FastWriteString(Local<Value> receiver,
|
1526 | 1526 | uint32_t max_length, |
1527 | 1527 | // NOLINTNEXTLINE(runtime/references) |
1528 | 1528 | FastApiCallbackOptions& options) { |
| 1529 | +// Just a heads up... this is a v8 fast api function. The use of |
| 1530 | +// FastOneByteString has some caveats. Specifically, a GC occurring |
| 1531 | +// between the time the FastOneByteString is created and the time |
| 1532 | +// we use it below can cause the FastOneByteString to become invalid |
| 1533 | +// and produce garbage data. This is not a problem here because we |
| 1534 | +// are not performing any allocations or other operations that would |
| 1535 | +// trigger a GC before the FastOneByteString is used. Take care when |
| 1536 | +// modifying this code to ensure that no operations would trigger a GC. |
1529 | 1537 | HandleScope handle_scope(options.isolate); |
1530 | 1538 | SPREAD_BUFFER_ARG(dst_obj, dst); |
1531 | 1539 | CHECK(offset <= dst_length); |
|