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 namespace interpreter { | 26 namespace interpreter { |
27 | 27 |
28 using compiler::Node; | 28 using compiler::Node; |
29 typedef CodeStubAssembler::Label Label; | 29 typedef CodeStubAssembler::Label Label; |
30 typedef CodeStubAssembler::Variable Variable; | 30 typedef CodeStubAssembler::Variable Variable; |
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 InterpreterCompilationJob(CompilationInfo* info, LazyCompilationMode mode); | 36 explicit InterpreterCompilationJob(CompilationInfo* info); |
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 class TimerScope final { | 44 class TimerScope final { |
45 public: | 45 public: |
46 TimerScope(RuntimeCallStats* stats, RuntimeCallStats::CounterId counter_id) | 46 TimerScope(RuntimeCallStats* stats, RuntimeCallStats::CounterId counter_id) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 dispatch_table_[i] = reinterpret_cast<Code*>(code)->entry(); | 184 dispatch_table_[i] = reinterpret_cast<Code*>(code)->entry(); |
185 } | 185 } |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 // static | 189 // static |
190 int Interpreter::InterruptBudget() { | 190 int Interpreter::InterruptBudget() { |
191 return FLAG_interrupt_budget * kCodeSizeMultiplier; | 191 return FLAG_interrupt_budget * kCodeSizeMultiplier; |
192 } | 192 } |
193 | 193 |
194 InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info, | 194 InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info) |
195 LazyCompilationMode mode) | |
196 : CompilationJob(info->isolate(), info, "Ignition"), | 195 : CompilationJob(info->isolate(), info, "Ignition"), |
197 generator_(info, mode), | 196 generator_(info), |
198 runtime_call_stats_(info->isolate()->counters()->runtime_call_stats()), | 197 runtime_call_stats_(info->isolate()->counters()->runtime_call_stats()), |
199 background_execute_counter_("CompileBackgroundIgnition") {} | 198 background_execute_counter_("CompileBackgroundIgnition") {} |
200 | 199 |
201 InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() { | 200 InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() { |
202 CodeGenerator::MakeCodePrologue(info(), "interpreter"); | 201 CodeGenerator::MakeCodePrologue(info(), "interpreter"); |
203 if (FLAG_print_bytecode) { | 202 if (FLAG_print_bytecode) { |
204 OFStream os(stdout); | 203 OFStream os(stdout); |
205 std::unique_ptr<char[]> name = info()->GetDebugName(); | 204 std::unique_ptr<char[]> name = info()->GetDebugName(); |
206 os << "[generating bytecode for function: " << info()->GetDebugName().get() | 205 os << "[generating bytecode for function: " << info()->GetDebugName().get() |
207 << "]" << std::endl | 206 << "]" << std::endl |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 OFStream os(stdout); | 245 OFStream os(stdout); |
247 bytecodes->Print(os); | 246 bytecodes->Print(os); |
248 os << std::flush; | 247 os << std::flush; |
249 } | 248 } |
250 | 249 |
251 info()->SetBytecodeArray(bytecodes); | 250 info()->SetBytecodeArray(bytecodes); |
252 info()->SetCode(info()->isolate()->builtins()->InterpreterEntryTrampoline()); | 251 info()->SetCode(info()->isolate()->builtins()->InterpreterEntryTrampoline()); |
253 return SUCCEEDED; | 252 return SUCCEEDED; |
254 } | 253 } |
255 | 254 |
256 CompilationJob* Interpreter::NewCompilationJob(CompilationInfo* info, | 255 CompilationJob* Interpreter::NewCompilationJob(CompilationInfo* info) { |
257 LazyCompilationMode mode) { | 256 return new InterpreterCompilationJob(info); |
258 return new InterpreterCompilationJob(info, mode); | |
259 } | 257 } |
260 | 258 |
261 bool Interpreter::IsDispatchTableInitialized() { | 259 bool Interpreter::IsDispatchTableInitialized() { |
262 return dispatch_table_[0] != nullptr; | 260 return dispatch_table_[0] != nullptr; |
263 } | 261 } |
264 | 262 |
265 bool Interpreter::ShouldInitializeDispatchTable() { | 263 bool Interpreter::ShouldInitializeDispatchTable() { |
266 if (FLAG_trace_ignition || FLAG_trace_ignition_codegen || | 264 if (FLAG_trace_ignition || FLAG_trace_ignition_codegen || |
267 FLAG_trace_ignition_dispatches) { | 265 FLAG_trace_ignition_dispatches) { |
268 // Regenerate table to add bytecode tracing operations, print the assembly | 266 // Regenerate table to add bytecode tracing operations, print the assembly |
(...skipping 2990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3259 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 3257 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
3260 __ SmiTag(new_state)); | 3258 __ SmiTag(new_state)); |
3261 __ SetAccumulator(old_state); | 3259 __ SetAccumulator(old_state); |
3262 | 3260 |
3263 __ Dispatch(); | 3261 __ Dispatch(); |
3264 } | 3262 } |
3265 | 3263 |
3266 } // namespace interpreter | 3264 } // namespace interpreter |
3267 } // namespace internal | 3265 } // namespace internal |
3268 } // namespace v8 | 3266 } // namespace v8 |
OLD | NEW |