Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81de533

Browse filesBrowse files
ulanMylesBorins
authored andcommitted
src: create per-isolate strings after platform setup
Allocation of strings may cause a garbage collection that uses the platform to post tasks. PR-URL: #20175 Fixes: #20171 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent b646566 commit 81de533
Copy full SHA for 81de533

File tree

Expand file treeCollapse file tree

1 file changed

+34
-32
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+34
-32
lines changed
Open diff view settings
Collapse file

‎src/env.cc‎

Copy file name to clipboardExpand all lines: src/env.cc
+34-32Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,44 +28,46 @@ IsolateData::IsolateData(Isolate* isolate,
2828
uv_loop_t* event_loop,
2929
MultiIsolatePlatform* platform,
3030
uint32_t* zero_fill_field) :
31-
32-
// Create string and private symbol properties as internalized one byte strings.
33-
//
34-
// Internalized because it makes property lookups a little faster and because
35-
// the string is created in the old space straight away. It's going to end up
36-
// in the old space sooner or later anyway but now it doesn't go through
37-
// v8::Eternal's new space handling first.
38-
//
39-
// One byte because our strings are ASCII and we can safely skip V8's UTF-8
40-
// decoding step. It's a one-time cost, but why pay it when you don't have to?
41-
#define V(PropertyName, StringValue) \
42-
PropertyName ## _( \
43-
isolate, \
44-
Private::New( \
45-
isolate, \
46-
String::NewFromOneByte( \
47-
isolate, \
48-
reinterpret_cast<const uint8_t*>(StringValue), \
49-
v8::NewStringType::kInternalized, \
50-
sizeof(StringValue) - 1).ToLocalChecked())),
51-
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V)
52-
#undef V
53-
#define V(PropertyName, StringValue) \
54-
PropertyName ## _( \
55-
isolate, \
56-
String::NewFromOneByte( \
57-
isolate, \
58-
reinterpret_cast<const uint8_t*>(StringValue), \
59-
v8::NewStringType::kInternalized, \
60-
sizeof(StringValue) - 1).ToLocalChecked()),
61-
PER_ISOLATE_STRING_PROPERTIES(V)
62-
#undef V
6331
isolate_(isolate),
6432
event_loop_(event_loop),
6533
zero_fill_field_(zero_fill_field),
6634
platform_(platform) {
6735
if (platform_ != nullptr)
6836
platform_->RegisterIsolate(this, event_loop);
37+
38+
// Create string and private symbol properties as internalized one byte
39+
// strings after the platform is properly initialized.
40+
//
41+
// Internalized because it makes property lookups a little faster and
42+
// because the string is created in the old space straight away. It's going
43+
// to end up in the old space sooner or later anyway but now it doesn't go
44+
// through v8::Eternal's new space handling first.
45+
//
46+
// One byte because our strings are ASCII and we can safely skip V8's UTF-8
47+
// decoding step.
48+
49+
#define V(PropertyName, StringValue) \
50+
PropertyName ## _.Set( \
51+
isolate, \
52+
Private::New( \
53+
isolate, \
54+
String::NewFromOneByte( \
55+
isolate, \
56+
reinterpret_cast<const uint8_t*>(StringValue), \
57+
v8::NewStringType::kInternalized, \
58+
sizeof(StringValue) - 1).ToLocalChecked()));
59+
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V)
60+
#undef V
61+
#define V(PropertyName, StringValue) \
62+
PropertyName ## _.Set( \
63+
isolate, \
64+
String::NewFromOneByte( \
65+
isolate, \
66+
reinterpret_cast<const uint8_t*>(StringValue), \
67+
v8::NewStringType::kInternalized, \
68+
sizeof(StringValue) - 1).ToLocalChecked());
69+
PER_ISOLATE_STRING_PROPERTIES(V)
70+
#undef V
6971
}
7072

7173
IsolateData::~IsolateData() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.