• Leszek Swirski's avatar
    [offthread] Add string access lock to GetChars · df842562
    Leszek Swirski authored
    Add a requirement to String::GetChars that we either have a string
    access lock, or a string access lock is not needed. This prevents us
    from reading strings during internalization that may be in the middle
    of being made external.
    
    To avoid taking the lock too often when known to be unnecessary (e.g.
    for strings that were only just created), there's now a static
    SharedStringAccessGuardIfNeeded::NotNeeded(). This is hopefully ugly
    enough that it's used sparingly.
    
    One fix required for this is to enter the Isolate when tearing down
    IsolateData in inspector tests -- this is so that the V8Inspector
    instance being torn down will see the current Isolate and be able to
    verify its thread id against the current thread.
    
    Bug: chromium:1011762, chromium:1148680
    Change-Id: Ic5d29c1b066ebae5a351c7b4bb116b9b1bf61889
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2536465
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71197}
    df842562
string-inl.h 31.4 KB