Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/compiler/pipeline.cc

Issue 2684033007: Allow a ParseInfo without a script for %SetCode users (Closed)
Patch Set: Some comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/pipeline.h" 5 #include "src/compiler/pipeline.h"
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <memory> 8 #include <memory>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 json_of << "\",\n\"phases\":["; 538 json_of << "\",\n\"phases\":[";
539 } 539 }
540 540
541 return pipeline_statistics; 541 return pipeline_statistics;
542 } 542 }
543 543
544 } // namespace 544 } // namespace
545 545
546 class PipelineCompilationJob final : public CompilationJob { 546 class PipelineCompilationJob final : public CompilationJob {
547 public: 547 public:
548 PipelineCompilationJob(Isolate* isolate, Handle<JSFunction> function) 548 PipelineCompilationJob(ParseInfo* parse_info, Handle<JSFunction> function)
549 // Note that the CompilationInfo is not initialized at the time we pass it 549 // Note that the CompilationInfo is not initialized at the time we pass it
550 // to the CompilationJob constructor, but it is not dereferenced there. 550 // to the CompilationJob constructor, but it is not dereferenced there.
551 : CompilationJob(isolate, &info_, "TurboFan"), 551 : CompilationJob(parse_info->isolate(), &info_, "TurboFan"),
552 parse_info_(handle(function->shared())), 552 parse_info_(parse_info),
553 zone_stats_(isolate->allocator()), 553 zone_stats_(parse_info->isolate()->allocator()),
554 info_(parse_info_.zone(), &parse_info_, function), 554 info_(parse_info_.get()->zone(), parse_info_.get(), function),
555 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)), 555 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)),
556 data_(&zone_stats_, info(), pipeline_statistics_.get()), 556 data_(&zone_stats_, info(), pipeline_statistics_.get()),
557 pipeline_(&data_), 557 pipeline_(&data_),
558 linkage_(nullptr) {} 558 linkage_(nullptr) {}
559 559
560 protected: 560 protected:
561 Status PrepareJobImpl() final; 561 Status PrepareJobImpl() final;
562 Status ExecuteJobImpl() final; 562 Status ExecuteJobImpl() final;
563 Status FinalizeJobImpl() final; 563 Status FinalizeJobImpl() final;
564 564
565 private: 565 private:
566 ParseInfo parse_info_; 566 std::unique_ptr<ParseInfo> parse_info_;
567 ZoneStats zone_stats_; 567 ZoneStats zone_stats_;
568 CompilationInfo info_; 568 CompilationInfo info_;
569 std::unique_ptr<PipelineStatistics> pipeline_statistics_; 569 std::unique_ptr<PipelineStatistics> pipeline_statistics_;
570 PipelineData data_; 570 PipelineData data_;
571 PipelineImpl pipeline_; 571 PipelineImpl pipeline_;
572 Linkage* linkage_; 572 Linkage* linkage_;
573 573
574 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob); 574 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob);
575 }; 575 };
576 576
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 json_of << "{\"function\":\"" << info->GetDebugName().get() 1743 json_of << "{\"function\":\"" << info->GetDebugName().get()
1744 << "\", \"source\":\"\",\n\"phases\":["; 1744 << "\", \"source\":\"\",\n\"phases\":[";
1745 } 1745 }
1746 // TODO(rossberg): Should this really be untyped? 1746 // TODO(rossberg): Should this really be untyped?
1747 pipeline.RunPrintAndVerify("Machine", true); 1747 pipeline.RunPrintAndVerify("Machine", true);
1748 1748
1749 return pipeline.ScheduleAndGenerateCode(call_descriptor); 1749 return pipeline.ScheduleAndGenerateCode(call_descriptor);
1750 } 1750 }
1751 1751
1752 // static 1752 // static
1753 CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function) { 1753 CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function,
1754 return new PipelineCompilationJob(function->GetIsolate(), function); 1754 bool has_script) {
1755 Isolate* isolate = function->shared()->GetIsolate();
Michael Starzinger 2017/02/15 14:51:48 nit: The isolate is only used for the handle alloc
mvstanton 2017/02/15 15:18:46 Done.
1756 Handle<SharedFunctionInfo> shared = handle(function->shared(), isolate);
1757 ParseInfo* p;
Michael Starzinger 2017/02/15 14:51:48 nit: s/p/parse_info/
mvstanton 2017/02/15 15:18:47 Done.
1758 if (!has_script) {
1759 p = ParseInfo::AllocateWithoutScript(shared);
1760 } else {
1761 p = new ParseInfo(shared);
1762 }
1763 return new PipelineCompilationJob(p, function);
1755 } 1764 }
1756 1765
1757 // static 1766 // static
1758 CompilationJob* Pipeline::NewWasmCompilationJob( 1767 CompilationJob* Pipeline::NewWasmCompilationJob(
1759 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor, 1768 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor,
1760 SourcePositionTable* source_positions, 1769 SourcePositionTable* source_positions,
1761 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions, 1770 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions,
1762 bool allow_signalling_nan) { 1771 bool allow_signalling_nan) {
1763 return new PipelineWasmCompilationJob( 1772 return new PipelineWasmCompilationJob(
1764 info, jsgraph, descriptor, source_positions, protected_instructions, 1773 info, jsgraph, descriptor, source_positions, protected_instructions,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 data->DeleteRegisterAllocationZone(); 2028 data->DeleteRegisterAllocationZone();
2020 } 2029 }
2021 2030
2022 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 2031 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
2023 2032
2024 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 2033 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
2025 2034
2026 } // namespace compiler 2035 } // namespace compiler
2027 } // namespace internal 2036 } // namespace internal
2028 } // namespace v8 2037 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698