| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "src/compiler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 CompilationInfo::CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone) | 151 CompilationInfo::CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone) |
| 152 : CompilationInfo(nullptr, stub, CodeStub::MajorName(stub->MajorKey()), | 152 : CompilationInfo(nullptr, stub, CodeStub::MajorName(stub->MajorKey()), |
| 153 STUB, isolate, zone) {} | 153 STUB, isolate, zone) {} |
| 154 | 154 |
| 155 CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate, | 155 CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate, |
| 156 Zone* zone) | 156 Zone* zone) |
| 157 : CompilationInfo(nullptr, nullptr, debug_name, STUB, isolate, zone) {} | 157 : CompilationInfo(nullptr, nullptr, debug_name, STUB, isolate, zone) { |
| 158 set_output_code_kind(Code::STUB); |
| 159 } |
| 158 | 160 |
| 159 CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub, | 161 CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub, |
| 160 const char* debug_name, Mode mode, | 162 const char* debug_name, Mode mode, |
| 161 Isolate* isolate, Zone* zone) | 163 Isolate* isolate, Zone* zone) |
| 162 : parse_info_(parse_info), | 164 : parse_info_(parse_info), |
| 163 isolate_(isolate), | 165 isolate_(isolate), |
| 164 flags_(0), | 166 flags_(0), |
| 165 code_stub_(code_stub), | 167 code_stub_(code_stub), |
| 166 mode_(mode), | 168 mode_(mode), |
| 167 osr_ast_id_(BailoutId::None()), | 169 osr_ast_id_(BailoutId::None()), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 181 osr_expr_stack_height_(0), | 183 osr_expr_stack_height_(0), |
| 182 function_type_(nullptr), | 184 function_type_(nullptr), |
| 183 debug_name_(debug_name) { | 185 debug_name_(debug_name) { |
| 184 // Parameter count is number of stack parameters. | 186 // Parameter count is number of stack parameters. |
| 185 if (code_stub_ != NULL) { | 187 if (code_stub_ != NULL) { |
| 186 CodeStubDescriptor descriptor(code_stub_); | 188 CodeStubDescriptor descriptor(code_stub_); |
| 187 parameter_count_ = descriptor.GetStackParameterCount(); | 189 parameter_count_ = descriptor.GetStackParameterCount(); |
| 188 if (descriptor.function_mode() == NOT_JS_FUNCTION_STUB_MODE) { | 190 if (descriptor.function_mode() == NOT_JS_FUNCTION_STUB_MODE) { |
| 189 parameter_count_--; | 191 parameter_count_--; |
| 190 } | 192 } |
| 193 set_output_code_kind(code_stub->GetCodeKind()); |
| 194 } else { |
| 195 set_output_code_kind(Code::FUNCTION); |
| 191 } | 196 } |
| 192 } | 197 } |
| 193 | 198 |
| 194 | 199 |
| 195 CompilationInfo::~CompilationInfo() { | 200 CompilationInfo::~CompilationInfo() { |
| 196 DisableFutureOptimization(); | 201 DisableFutureOptimization(); |
| 197 delete deferred_handles_; | 202 delete deferred_handles_; |
| 198 delete no_frame_ranges_; | 203 delete no_frame_ranges_; |
| 199 #ifdef DEBUG | 204 #ifdef DEBUG |
| 200 // Check that no dependent maps have been added or added dependent maps have | 205 // Check that no dependent maps have been added or added dependent maps have |
| 201 // been rolled back or committed. | 206 // been rolled back or committed. |
| 202 DCHECK(dependencies()->IsEmpty()); | 207 DCHECK(dependencies()->IsEmpty()); |
| 203 #endif // DEBUG | 208 #endif // DEBUG |
| 204 } | 209 } |
| 205 | 210 |
| 206 | 211 |
| 207 void CompilationInfo::SetStub(CodeStub* code_stub) { | 212 void CompilationInfo::SetStub(CodeStub* code_stub) { |
| 208 SetMode(STUB); | 213 SetMode(STUB); |
| 209 code_stub_ = code_stub; | 214 code_stub_ = code_stub; |
| 210 debug_name_ = CodeStub::MajorName(code_stub->MajorKey()); | 215 debug_name_ = CodeStub::MajorName(code_stub->MajorKey()); |
| 216 set_output_code_kind(code_stub->GetCodeKind()); |
| 211 } | 217 } |
| 212 | 218 |
| 213 | 219 |
| 214 int CompilationInfo::num_parameters() const { | 220 int CompilationInfo::num_parameters() const { |
| 215 return has_scope() ? scope()->num_parameters() : parameter_count_; | 221 return has_scope() ? scope()->num_parameters() : parameter_count_; |
| 216 } | 222 } |
| 217 | 223 |
| 218 | 224 |
| 219 int CompilationInfo::num_parameters_including_this() const { | 225 int CompilationInfo::num_parameters_including_this() const { |
| 220 return num_parameters() + (is_this_defined() ? 1 : 0); | 226 return num_parameters() + (is_this_defined() ? 1 : 0); |
| (...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 } | 1761 } |
| 1756 | 1762 |
| 1757 #if DEBUG | 1763 #if DEBUG |
| 1758 void CompilationInfo::PrintAstForTesting() { | 1764 void CompilationInfo::PrintAstForTesting() { |
| 1759 PrintF("--- Source from AST ---\n%s\n", | 1765 PrintF("--- Source from AST ---\n%s\n", |
| 1760 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); | 1766 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); |
| 1761 } | 1767 } |
| 1762 #endif | 1768 #endif |
| 1763 } // namespace internal | 1769 } // namespace internal |
| 1764 } // namespace v8 | 1770 } // namespace v8 |
| OLD | NEW |