Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V8 13.0 Deprecations #55452

Open
2 of 7 tasks
RedYetiDev opened this issue Oct 18, 2024 · 6 comments
Open
2 of 7 tasks

V8 13.0 Deprecations #55452

RedYetiDev opened this issue Oct 18, 2024 · 6 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. deprecations Issues and PRs related to deprecations. v8 engine Issues and PRs related to the V8 dependency.

Comments

@RedYetiDev
Copy link
Member

RedYetiDev commented Oct 18, 2024

Another PR is updated V8 to 13.0, so I compiled a list of deprecations from that version onward. While they don't need to be fixed immediately, it's important to know they exist.

  • template<class T> struct v8::FastApiTypedArray

    • Reason: When an API function expects a TypedArray as a parameter, the type in the signature should be v8::Local<v8::Value> instead of FastApiTypedArray<>.
    • Action: Type-check the parameter and convert it to v8::Local<v8::TypedArray> to access the data. Handle the parameter the same way as for a regular API call.
    • Details:
      ‘template<class T> struct v8::FastApiTypedArray’ is deprecated: 
      When an API function expects a TypedArray as a parameter, 
      the type in the signature should be `v8::Local<v8::Value>` instead of FastApiTypedArray<>. 
      The API function then has to type-check the parameter and convert it to a `v8::Local<v8::TypedArray` to access the data. 
      In essence, the parameter should be handled the same as for a regular API call. 
      
  • v8::Local<v8::Value> v8::Object::GetPrototype() (src: switch from Get/SetPrototype to Get/SetPrototypeV2 #55453)

    • Reason: V8 will stop providing access to the hidden prototype (i.e., JSGlobalObject).
    • Action: Use GetPrototypeV2() instead.
    • Reference: crbug.com/333672197
    • Details:
      ‘v8::Local<v8::Value> v8::Object::GetPrototype()’ is deprecated: 
      V8 will stop providing access to hidden prototype (i.e. JSGlobalObject). 
      Use GetPrototypeV2() instead. See http://crbug.com/333672197. 
      
  • v8::Maybe<bool> v8::Object::SetPrototype(v8::Local<v8::Context>, v8::Local<v8::Value>) (src: switch from Get/SetPrototype to Get/SetPrototypeV2 #55453)

    • Reason: V8 will stop providing access to the hidden prototype (i.e., JSGlobalObject).
    • Action: Use SetPrototypeV2() instead.
    • Reference: crbug.com/333672197
    • Details:
      ‘v8::Maybe<bool> v8::Object::SetPrototype(v8::Local<v8::Context>, v8::Local<v8::Value>)’ is deprecated: 
      V8 will stop providing access to hidden prototype (i.e. JSGlobalObject). 
      Use SetPrototypeV2() instead. See http://crbug.com/333672197. 
      
  • v8::SnapshotCreator::SnapshotCreator(v8::Isolate*, const intptr_t*, const v8::StartupData*, bool) (src: migrate from deprecated SnapshotCreator constructor #55337)

    • Reason: Deprecated in favor of a version that passes CreateParams.
    • Action: Use the version that passes CreateParams.
    • Details:
      ‘v8::SnapshotCreator::SnapshotCreator(v8::Isolate*, const intptr_t*, const v8::StartupData*, bool)’ is deprecated: 
      Use the version that passes CreateParams instead. 
      
  • v8::String::Value::Value(v8::Isolate*, v8::Local<v8::Value>) (src: migrate String::Value to String::ValueView #55458)

    • Reason: Prefer alternatives for better performance.
    • Action: Use String::ValueView if possible, or use string->Write to a buffer if not.
    • Details:
      ‘v8::String::Value::Value(v8::Isolate*, v8::Local<v8::Value>)’ is deprecated: 
      Prefer using String::ValueView if you can, or string->Write to a buffer if you cannot. 
      
  • void v8::Isolate::AttachCppHeap(v8::CppHeap*)

    • Reason: Set the heap on Isolate creation.
    • Action: Use CreateParams instead.
    • Details:
      ‘void v8::Isolate::AttachCppHeap(v8::CppHeap*)’ is deprecated: 
      Set the heap on Isolate creation using CreateParams instead. 
      
  • void v8::Isolate::DetachCppHeap()

    • Reason: Set the heap on Isolate creation.
    • Action: Use CreateParams instead.
    • Details:
      ‘void v8::Isolate::DetachCppHeap()’ is deprecated: 
      Set the heap on Isolate creation using CreateParams instead. 
      
@RedYetiDev RedYetiDev added c++ Issues and PRs that require attention from people who are familiar with C++. v8 engine Issues and PRs related to the V8 dependency. deprecations Issues and PRs related to deprecations. labels Oct 18, 2024
@richardlau
Copy link
Member

* [ ]  **`v8::SnapshotCreator::SnapshotCreator(v8::Isolate*, const intptr_t*, const v8::StartupData*, bool)`**
  
  * **Reason**: Deprecated in favor of a version that passes `CreateParams`.
  * **Action**: Use the version that passes `CreateParams`.
  * **Details**:
    ```
    ‘v8::SnapshotCreator::SnapshotCreator(v8::Isolate*, const intptr_t*, const v8::StartupData*, bool)’ is deprecated: 
    Use the version that passes CreateParams instead. 
    ```

Refs: #55337

@malinjawi
Copy link

malinjawi commented Oct 20, 2024

hey @RedYetiDev I am gonna try to have a crack at solving one of these tasks. I am new to node.js and looking forward to making my first contribution.

@RedYetiDev
Copy link
Member Author

I am new to node.js and looking forward to making my first contribution.

Be my guest 😃. By the way, for issues specifically labeled to help get you started, see issues with the "good first issue" label.

@ronag
Copy link
Member

ronag commented Oct 21, 2024

template struct v8::FastApiTypedArray

Regarding this one. Both us (me) and Deno has commented on the Chromium issue tracker that we believe this deprecation is problematic. IMHO we should try to stick with it while it still works even if deprecated. The alternative is significantly slower (at least the way we compile V8).

Refs: https://issues.chromium.org/issues/356158110
Refs: https://x.com/rough__sea/status/1819296459071598668
Refs: v8#197
Refs: #54087
Refs: #54103

nodejs-github-bot pushed a commit that referenced this issue Oct 29, 2024
Fixes #54417
Ref: #55452

PR-URL: #55458
Refs: #55452
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this issue Oct 30, 2024
Fixes nodejs#54417
Ref: nodejs#55452

PR-URL: nodejs#55458
Refs: nodejs#55452
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
RafaelGSS pushed a commit that referenced this issue Nov 1, 2024
Fixes #54417
Ref: #55452

PR-URL: #55458
Refs: #55452
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
louwers pushed a commit to louwers/node that referenced this issue Nov 2, 2024
Fixes nodejs#54417
Ref: nodejs#55452

PR-URL: nodejs#55458
Refs: nodejs#55452
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@targos
Copy link
Member

targos commented Nov 14, 2024

@ronag FastApiTypedArray has just been removed from upstream: https://chromium-review.googlesource.com/c/v8/v8/+/5982984

@targos
Copy link
Member

targos commented Nov 14, 2024

IIUC we should use this instead: https://chromium-review.googlesource.com/c/v8/v8/+/5915615

tpoisseau pushed a commit to tpoisseau/node that referenced this issue Nov 21, 2024
Fixes nodejs#54417
Ref: nodejs#55452

PR-URL: nodejs#55458
Refs: nodejs#55452
Reviewed-By: Vladimir Morozov <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. deprecations Issues and PRs related to deprecations. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

5 participants