OLD | NEW |
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 Loading... |
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, LazyCompilationMode mode); |
37 | 37 |
38 protected: | 38 protected: |
39 Status PrepareJobImpl() final; | 39 Status PrepareJobImpl() final; |
40 Status ExecuteJobImpl() final; | 40 Status ExecuteJobImpl() final; |
41 Status FinalizeJobImpl() final; | 41 Status FinalizeJobImpl() final; |
42 | 42 |
43 private: | 43 private: |
44 BytecodeGenerator* generator() { return &generator_; } | 44 BytecodeGenerator* generator() { return &generator_; } |
45 | 45 |
46 BytecodeGenerator generator_; | 46 BytecodeGenerator generator_; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 dispatch_table_[i] = reinterpret_cast<Code*>(code)->entry(); | 152 dispatch_table_[i] = reinterpret_cast<Code*>(code)->entry(); |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 // static | 157 // static |
158 int Interpreter::InterruptBudget() { | 158 int Interpreter::InterruptBudget() { |
159 return FLAG_interrupt_budget * kCodeSizeMultiplier; | 159 return FLAG_interrupt_budget * kCodeSizeMultiplier; |
160 } | 160 } |
161 | 161 |
162 InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info) | 162 InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info, |
163 : CompilationJob(info->isolate(), info, "Ignition"), generator_(info) {} | 163 LazyCompilationMode mode) |
| 164 : CompilationJob(info->isolate(), info, "Ignition"), |
| 165 generator_(info, mode) {} |
164 | 166 |
165 InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() { | 167 InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() { |
166 CodeGenerator::MakeCodePrologue(info(), "interpreter"); | 168 CodeGenerator::MakeCodePrologue(info(), "interpreter"); |
167 if (FLAG_print_bytecode) { | 169 if (FLAG_print_bytecode) { |
168 OFStream os(stdout); | 170 OFStream os(stdout); |
169 std::unique_ptr<char[]> name = info()->GetDebugName(); | 171 std::unique_ptr<char[]> name = info()->GetDebugName(); |
170 os << "[generating bytecode for function: " << info()->GetDebugName().get() | 172 os << "[generating bytecode for function: " << info()->GetDebugName().get() |
171 << "]" << std::endl | 173 << "]" << std::endl |
172 << std::flush; | 174 << std::flush; |
173 } | 175 } |
(...skipping 27 matching lines...) Expand all Loading... |
201 OFStream os(stdout); | 203 OFStream os(stdout); |
202 bytecodes->Print(os); | 204 bytecodes->Print(os); |
203 os << std::flush; | 205 os << std::flush; |
204 } | 206 } |
205 | 207 |
206 info()->SetBytecodeArray(bytecodes); | 208 info()->SetBytecodeArray(bytecodes); |
207 info()->SetCode(info()->isolate()->builtins()->InterpreterEntryTrampoline()); | 209 info()->SetCode(info()->isolate()->builtins()->InterpreterEntryTrampoline()); |
208 return SUCCEEDED; | 210 return SUCCEEDED; |
209 } | 211 } |
210 | 212 |
211 CompilationJob* Interpreter::NewCompilationJob(CompilationInfo* info) { | 213 CompilationJob* Interpreter::NewCompilationJob(CompilationInfo* info, |
212 return new InterpreterCompilationJob(info); | 214 LazyCompilationMode mode) { |
| 215 return new InterpreterCompilationJob(info, mode); |
213 } | 216 } |
214 | 217 |
215 bool Interpreter::IsDispatchTableInitialized() { | 218 bool Interpreter::IsDispatchTableInitialized() { |
216 return dispatch_table_[0] != nullptr; | 219 return dispatch_table_[0] != nullptr; |
217 } | 220 } |
218 | 221 |
219 bool Interpreter::ShouldInitializeDispatchTable() { | 222 bool Interpreter::ShouldInitializeDispatchTable() { |
220 if (FLAG_trace_ignition || FLAG_trace_ignition_codegen || | 223 if (FLAG_trace_ignition || FLAG_trace_ignition_codegen || |
221 FLAG_trace_ignition_dispatches) { | 224 FLAG_trace_ignition_dispatches) { |
222 // Regenerate table to add bytecode tracing operations, print the assembly | 225 // Regenerate table to add bytecode tracing operations, print the assembly |
(...skipping 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2855 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2853 __ SmiTag(new_state)); | 2856 __ SmiTag(new_state)); |
2854 __ SetAccumulator(old_state); | 2857 __ SetAccumulator(old_state); |
2855 | 2858 |
2856 __ Dispatch(); | 2859 __ Dispatch(); |
2857 } | 2860 } |
2858 | 2861 |
2859 } // namespace interpreter | 2862 } // namespace interpreter |
2860 } // namespace internal | 2863 } // namespace internal |
2861 } // namespace v8 | 2864 } // namespace v8 |
OLD | NEW |