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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 2399463008: Create multiple compilation jobs for ignition if compiling multiple literals (Closed)
Patch Set: updates Created 4 years, 2 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 15 matching lines...) Expand all
26 26
27 using compiler::Node; 27 using compiler::Node;
28 typedef CodeStubAssembler::Label Label; 28 typedef CodeStubAssembler::Label Label;
29 typedef CodeStubAssembler::Variable Variable; 29 typedef CodeStubAssembler::Variable Variable;
30 typedef InterpreterAssembler::Arg Arg; 30 typedef InterpreterAssembler::Arg Arg;
31 31
32 #define __ assembler-> 32 #define __ assembler->
33 33
34 class InterpreterCompilationJob final : public CompilationJob { 34 class InterpreterCompilationJob final : public CompilationJob {
35 public: 35 public:
36 explicit InterpreterCompilationJob(CompilationInfo* info); 36 InterpreterCompilationJob(CompilationInfo* info,
37 ShouldCompile should_compile);
37 38
38 protected: 39 protected:
39 Status PrepareJobImpl() final; 40 Status PrepareJobImpl() final;
40 Status ExecuteJobImpl() final; 41 Status ExecuteJobImpl() final;
41 Status FinalizeJobImpl() final; 42 Status FinalizeJobImpl() final;
42 43
43 private: 44 private:
44 BytecodeGenerator* generator() { return &generator_; } 45 BytecodeGenerator* generator() { return &generator_; }
45 46
46 BytecodeGenerator generator_; 47 BytecodeGenerator generator_;
47 48
49 ShouldCompile should_compile_;
50
48 DISALLOW_COPY_AND_ASSIGN(InterpreterCompilationJob); 51 DISALLOW_COPY_AND_ASSIGN(InterpreterCompilationJob);
49 }; 52 };
50 53
51 Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) { 54 Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {
52 memset(dispatch_table_, 0, sizeof(dispatch_table_)); 55 memset(dispatch_table_, 0, sizeof(dispatch_table_));
53 } 56 }
54 57
55 void Interpreter::Initialize() { 58 void Interpreter::Initialize() {
56 if (IsDispatchTableInitialized()) return; 59 if (IsDispatchTableInitialized()) return;
57 Zone zone(isolate_->allocator()); 60 Zone zone(isolate_->allocator());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 dispatch_table_[i] = reinterpret_cast<Code*>(code)->entry(); 146 dispatch_table_[i] = reinterpret_cast<Code*>(code)->entry();
144 } 147 }
145 } 148 }
146 } 149 }
147 150
148 // static 151 // static
149 int Interpreter::InterruptBudget() { 152 int Interpreter::InterruptBudget() {
150 return FLAG_interrupt_budget * kCodeSizeMultiplier; 153 return FLAG_interrupt_budget * kCodeSizeMultiplier;
151 } 154 }
152 155
153 InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info) 156 InterpreterCompilationJob::InterpreterCompilationJob(
154 : CompilationJob(info->isolate(), info, "Ignition"), generator_(info) {} 157 CompilationInfo* info, ShouldCompile should_compile)
158 : CompilationJob(info->isolate(), info, "Ignition"),
159 generator_(info),
160 should_compile_(should_compile) {}
155 161
156 InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() { 162 InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() {
157 if (FLAG_print_bytecode || FLAG_print_ast) { 163 if (FLAG_print_bytecode || FLAG_print_ast) {
158 OFStream os(stdout); 164 OFStream os(stdout);
159 std::unique_ptr<char[]> name = info()->GetDebugName(); 165 std::unique_ptr<char[]> name = info()->GetDebugName();
160 os << "[generating bytecode for function: " << info()->GetDebugName().get() 166 os << "[generating bytecode for function: " << info()->GetDebugName().get()
161 << "]" << std::endl 167 << "]" << std::endl
162 << std::flush; 168 << std::flush;
163 } 169 }
164 170
(...skipping 20 matching lines...) Expand all
185 191
186 generator()->GenerateBytecode(stack_limit()); 192 generator()->GenerateBytecode(stack_limit());
187 193
188 if (generator()->HasStackOverflow()) { 194 if (generator()->HasStackOverflow()) {
189 return FAILED; 195 return FAILED;
190 } 196 }
191 return SUCCEEDED; 197 return SUCCEEDED;
192 } 198 }
193 199
194 InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() { 200 InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() {
195 Handle<BytecodeArray> bytecodes = generator()->FinalizeBytecode(isolate()); 201 Handle<BytecodeArray> bytecodes =
202 generator()->FinalizeBytecode(isolate(), should_compile_);
196 if (generator()->HasStackOverflow()) { 203 if (generator()->HasStackOverflow()) {
197 return FAILED; 204 return FAILED;
198 } 205 }
199 206
200 if (FLAG_print_bytecode) { 207 if (FLAG_print_bytecode) {
201 OFStream os(stdout); 208 OFStream os(stdout);
202 bytecodes->Print(os); 209 bytecodes->Print(os);
203 os << std::flush; 210 os << std::flush;
204 } 211 }
205 212
206 info()->SetBytecodeArray(bytecodes); 213 info()->SetBytecodeArray(bytecodes);
207 info()->SetCode(info()->isolate()->builtins()->InterpreterEntryTrampoline()); 214 info()->SetCode(info()->isolate()->builtins()->InterpreterEntryTrampoline());
208 return SUCCEEDED; 215 return SUCCEEDED;
209 } 216 }
210 217
211 CompilationJob* Interpreter::NewCompilationJob(CompilationInfo* info) { 218 CompilationJob* Interpreter::NewCompilationJob(CompilationInfo* info,
212 return new InterpreterCompilationJob(info); 219 ShouldCompile should_compile) {
220 return new InterpreterCompilationJob(info, should_compile);
213 } 221 }
214 222
215 bool Interpreter::IsDispatchTableInitialized() { 223 bool Interpreter::IsDispatchTableInitialized() {
216 if (FLAG_trace_ignition || FLAG_trace_ignition_codegen || 224 if (FLAG_trace_ignition || FLAG_trace_ignition_codegen ||
217 FLAG_trace_ignition_dispatches) { 225 FLAG_trace_ignition_dispatches) {
218 // Regenerate table to add bytecode tracing operations, print the assembly 226 // Regenerate table to add bytecode tracing operations, print the assembly
219 // code generated by TurboFan or instrument handlers with dispatch counters. 227 // code generated by TurboFan or instrument handlers with dispatch counters.
220 return false; 228 return false;
221 } 229 }
222 return dispatch_table_[0] != nullptr; 230 return dispatch_table_[0] != nullptr;
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2643 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2636 __ SmiTag(new_state)); 2644 __ SmiTag(new_state));
2637 __ SetAccumulator(old_state); 2645 __ SetAccumulator(old_state);
2638 2646
2639 __ Dispatch(); 2647 __ Dispatch();
2640 } 2648 }
2641 2649
2642 } // namespace interpreter 2650 } // namespace interpreter
2643 } // namespace internal 2651 } // namespace internal
2644 } // namespace v8 2652 } // namespace v8
OLDNEW
« src/compiler.cc ('K') | « src/interpreter/interpreter.h ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698