deps: V8: cherry-pick d82c9af · nodejs/node@8181811 (original) (raw)

7 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@
37 37
38 38 # Reset this number to 0 on major V8 upgrades.
39 39 # Increment by one for each non-official patch applied to deps/v8.
40 -'v8_embedder_string': '-node.8',
40 +'v8_embedder_string': '-node.9',
41 41
42 42 ##### V8 defaults for Node.js #####
43 43
Original file line number Diff line number Diff line change
@@ -1535,7 +1535,12 @@ class V8_EXPORT ScriptCompiler {
1535 1535 public:
1536 1536 enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 };
1537 1537
1538 -StreamedSource(ExternalSourceStream* source_stream, Encoding encoding);
1538 +V8_DEPRECATE_SOON(
1539 +"This class takes ownership of source_stream, so use the constructor "
1540 +"taking a unique_ptr to make these semantics clearer",
1541 +StreamedSource(ExternalSourceStream* source_stream, Encoding encoding));
1542 +StreamedSource(std::unique_ptr source_stream,
1543 + Encoding encoding);
1539 1544 ~StreamedSource();
1540 1545
1541 1546 internal::ScriptStreamingData* impl() const { return impl_.get(); }
Original file line number Diff line number Diff line change
@@ -2071,7 +2071,11 @@ void ScriptCompiler::ExternalSourceStream::ResetToBookmark() { UNREACHABLE(); }
2071 2071
2072 2072 ScriptCompiler::StreamedSource::StreamedSource(ExternalSourceStream* stream,
2073 2073 Encoding encoding)
2074 - : impl_(new i::ScriptStreamingData(stream, encoding)) {}
2074 + : StreamedSource(std::unique_ptr(stream), encoding) {}
2075 +
2076 +ScriptCompiler::StreamedSource::StreamedSource(
2077 + std::unique_ptr stream, Encoding encoding)
2078 + : impl_(new i::ScriptStreamingData(std::move(stream), encoding)) {}
2075 2079
2076 2080 ScriptCompiler::StreamedSource::~StreamedSource() = default;
2077 2081
Original file line number Diff line number Diff line change
@@ -2173,9 +2173,9 @@ void Compiler::PostInstantiation(Handle function,
2173 2173 // Implementation of ScriptStreamingData
2174 2174
2175 2175 ScriptStreamingData::ScriptStreamingData(
2176 - ScriptCompiler::ExternalSourceStream* source_stream,
2176 +std::unique_ptrScriptCompiler::ExternalSourceStream\ source_stream,
2177 2177 ScriptCompiler::StreamedSource::Encoding encoding)
2178 - : source_stream(source_stream), encoding(encoding) {}
2178 + : source_stream(std::move(source_stream)), encoding(encoding) {}
2179 2179
2180 2180 ScriptStreamingData::~ScriptStreamingData() = default;
2181 2181
Original file line number Diff line number Diff line change
@@ -376,8 +376,9 @@ class V8_EXPORT_PRIVATE BackgroundCompileTask {
376 376 // Contains all data which needs to be transmitted between threads for
377 377 // background parsing and compiling and finalizing it on the main thread.
378 378 struct ScriptStreamingData {
379 -ScriptStreamingData(ScriptCompiler::ExternalSourceStream* source_stream,
380 - ScriptCompiler::StreamedSource::Encoding encoding);
379 +ScriptStreamingData(
380 + std::unique_ptrScriptCompiler::ExternalSourceStream source_stream,
381 + ScriptCompiler::StreamedSource::Encoding encoding);
381 382 ~ScriptStreamingData();
382 383
383 384 void Release();
Original file line number Diff line number Diff line change
@@ -413,7 +413,7 @@ class BackgroundCompileThread : public base::Thread {
413 413 BackgroundCompileThread(Isolate* isolate, Local source)
414 414 : base::Thread(GetThreadOptions("BackgroundCompileThread")),
415 415 source_(source),
416 - streamed_source_(new DummySourceStream(source, isolate),
416 + streamed_source_(base::make_unique<DummySourceStream>(source, isolate),
417 417 v8::ScriptCompiler::StreamedSource::UTF8),
418 418 task_(v8::ScriptCompiler::StartStreamingScript(isolate,
419 419 &streamed_source_)) {}
Original file line number Diff line number Diff line change
@@ -24799,8 +24799,8 @@ void RunStreamingTest(const char** chunks,
24799 24799 v8::HandleScope scope(isolate);
24800 24800 v8::TryCatch try_catch(isolate);
24801 24801
24802 - v8::ScriptCompiler::StreamedSource source(new TestSourceStream(chunks),
24803 - encoding);
24802 + v8::ScriptCompiler::StreamedSource source(
24803 +v8::base::make_unique(chunks), encoding);
24804 24804 v8::ScriptCompiler::ScriptStreamingTask* task =
24805 24805 v8::ScriptCompiler::StartStreamingScript(isolate, &source);
24806 24806
@@ -25071,7 +25071,7 @@ TEST(StreamingWithDebuggingEnabledLate) {
25071 25071 v8::TryCatch try_catch(isolate);
25072 25072
25073 25073 v8::ScriptCompiler::StreamedSource source(
25074 -new TestSourceStream(chunks),
25074 +v8::base::make_unique<TestSourceStream>(chunks),
25075 25075 v8::ScriptCompiler::StreamedSource::ONE_BYTE);
25076 25076 v8::ScriptCompiler::ScriptStreamingTask* task =
25077 25077 v8::ScriptCompiler::StartStreamingScript(isolate, &source);
@@ -25179,7 +25179,7 @@ TEST(StreamingWithHarmonyScopes) {
25179 25179
25180 25180 v8::TryCatch try_catch(isolate);
25181 25181 v8::ScriptCompiler::StreamedSource source(
25182 -new TestSourceStream(chunks),
25182 +v8::base::make_unique<TestSourceStream>(chunks),
25183 25183 v8::ScriptCompiler::StreamedSource::ONE_BYTE);
25184 25184 v8::ScriptCompiler::ScriptStreamingTask* task =
25185 25185 v8::ScriptCompiler::StartStreamingScript(isolate, &source);