-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
src: use Utf8Value
and TwoByteValue
instead of V8 helpers
#60244
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
base: main
Are you sure you want to change the base?
Conversation
Our own helper classes have the advantage of using stack storage a lot of the time, so they should always be preferred.
We should be using our own helpers for this instead.
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60244 +/- ##
==========================================
- Coverage 88.56% 88.55% -0.02%
==========================================
Files 704 704
Lines 208123 208152 +29
Branches 40014 40011 -3
==========================================
- Hits 184330 184319 -11
- Misses 15815 15861 +46
+ Partials 7978 7972 -6
🚀 New features to boost your workflow:
|
Local<String> type = | ||
String::NewFromUtf8(isolate, name, NewStringType::kInternalized) | ||
.ToLocalChecked(); | ||
Local<String> type = ToV8Value(isolate->GetCurrentContext(), name, isolate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, this new code behaves a bit differently from the old one: it creates a normal string, while before it used to created an internalized string.
Should we add ToV8InternalizedString
utility function? Or add optional string type parameter to ToV8Value
. Otherwise, we can keep it here as
String::NewFromUtf8(isolate, name.data(), NewStringType::kInternalized, name.size())
src: use
Utf8Value
andTwoByteValue
instead of V8 helpersOur own helper classes have the advantage of using stack storage
a lot of the time, so they should always be preferred.
tools: add C++ lint rule to avoid using
String::Utf8Value
We should be using our own helpers for this instead.