| 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 | 8 |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const int kCodeSizeMultiplier = 32; | 130 const int kCodeSizeMultiplier = 32; |
| 131 return FLAG_interrupt_budget * kCodeSizeMultiplier; | 131 return FLAG_interrupt_budget * kCodeSizeMultiplier; |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool Interpreter::MakeBytecode(CompilationInfo* info) { | 134 bool Interpreter::MakeBytecode(CompilationInfo* info) { |
| 135 RuntimeCallTimerScope runtimeTimer(info->isolate(), | 135 RuntimeCallTimerScope runtimeTimer(info->isolate(), |
| 136 &RuntimeCallStats::CompileIgnition); | 136 &RuntimeCallStats::CompileIgnition); |
| 137 TimerEventScope<TimerEventCompileIgnition> timer(info->isolate()); | 137 TimerEventScope<TimerEventCompileIgnition> timer(info->isolate()); |
| 138 TRACE_EVENT0("v8", "V8.CompileIgnition"); | 138 TRACE_EVENT0("v8", "V8.CompileIgnition"); |
| 139 | 139 |
| 140 if (FLAG_print_bytecode || FLAG_print_source || FLAG_print_ast) { | 140 if (FLAG_print_bytecode || FLAG_print_ast) { |
| 141 OFStream os(stdout); | 141 OFStream os(stdout); |
| 142 base::SmartArrayPointer<char> name = info->GetDebugName(); | 142 base::SmartArrayPointer<char> name = info->GetDebugName(); |
| 143 os << "[generating bytecode for function: " << info->GetDebugName().get() | 143 os << "[generating bytecode for function: " << info->GetDebugName().get() |
| 144 << "]" << std::endl | 144 << "]" << std::endl |
| 145 << std::flush; | 145 << std::flush; |
| 146 } | 146 } |
| 147 | 147 |
| 148 #ifdef DEBUG | 148 #ifdef DEBUG |
| 149 if (info->parse_info() && FLAG_print_source) { | |
| 150 OFStream os(stdout); | |
| 151 os << "--- Source from AST ---" << std::endl | |
| 152 << PrettyPrinter(info->isolate()).PrintProgram(info->literal()) | |
| 153 << std::endl | |
| 154 << std::flush; | |
| 155 } | |
| 156 | |
| 157 if (info->parse_info() && FLAG_print_ast) { | 149 if (info->parse_info() && FLAG_print_ast) { |
| 158 OFStream os(stdout); | 150 OFStream os(stdout); |
| 159 os << "--- AST ---" << std::endl | 151 os << "--- AST ---" << std::endl |
| 160 << AstPrinter(info->isolate()).PrintProgram(info->literal()) << std::endl | 152 << AstPrinter(info->isolate()).PrintProgram(info->literal()) << std::endl |
| 161 << std::flush; | 153 << std::flush; |
| 162 } | 154 } |
| 163 #endif // DEBUG | 155 #endif // DEBUG |
| 164 | 156 |
| 165 BytecodeGenerator generator(info); | 157 BytecodeGenerator generator(info); |
| 166 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(); | 158 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(); |
| (...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1848 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 1857 __ SmiTag(new_state)); | 1849 __ SmiTag(new_state)); |
| 1858 __ SetAccumulator(old_state); | 1850 __ SetAccumulator(old_state); |
| 1859 | 1851 |
| 1860 __ Dispatch(); | 1852 __ Dispatch(); |
| 1861 } | 1853 } |
| 1862 | 1854 |
| 1863 } // namespace interpreter | 1855 } // namespace interpreter |
| 1864 } // namespace internal | 1856 } // namespace internal |
| 1865 } // namespace v8 | 1857 } // namespace v8 |
| OLD | NEW |