| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compilation-info.h" | 5 #include "src/compilation-info.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| 11 #include "src/parsing/parse-info.h" | 11 #include "src/parsing/parse-info.h" |
| 12 #include "src/source-position.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 #define PARSE_INFO_GETTER(type, name) \ | 17 #define PARSE_INFO_GETTER(type, name) \ |
| 17 type CompilationInfo::name() const { \ | 18 type CompilationInfo::name() const { \ |
| 18 CHECK(parse_info()); \ | 19 CHECK(parse_info()); \ |
| 19 return parse_info()->name(); \ | 20 return parse_info()->name(); \ |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return has_global_object() ? native_context()->global_object() : nullptr; | 208 return has_global_object() ? native_context()->global_object() : nullptr; |
| 208 } | 209 } |
| 209 | 210 |
| 210 void CompilationInfo::SetOptimizing() { | 211 void CompilationInfo::SetOptimizing() { |
| 211 DCHECK(has_shared_info()); | 212 DCHECK(has_shared_info()); |
| 212 SetMode(OPTIMIZE); | 213 SetMode(OPTIMIZE); |
| 213 optimization_id_ = isolate()->NextOptimizationId(); | 214 optimization_id_ = isolate()->NextOptimizationId(); |
| 214 code_flags_ = Code::KindField::update(code_flags_, Code::OPTIMIZED_FUNCTION); | 215 code_flags_ = Code::KindField::update(code_flags_, Code::OPTIMIZED_FUNCTION); |
| 215 } | 216 } |
| 216 | 217 |
| 217 void CompilationInfo::AddInlinedFunction( | 218 int CompilationInfo::AddInlinedFunction( |
| 218 Handle<SharedFunctionInfo> inlined_function) { | 219 Handle<SharedFunctionInfo> inlined_function, SourcePosition pos) { |
| 220 int id = static_cast<int>(inlined_functions_.size()); |
| 219 inlined_functions_.push_back(InlinedFunctionHolder( | 221 inlined_functions_.push_back(InlinedFunctionHolder( |
| 220 inlined_function, handle(inlined_function->code()))); | 222 inlined_function, handle(inlined_function->code()), pos)); |
| 223 return id; |
| 224 } |
| 225 |
| 226 Handle<PodArray<InliningPosition>> CompilationInfo::CreateInliningPositions() { |
| 227 if (inlined_functions_.size() == 0) |
| 228 return Handle<PodArray<InliningPosition>>::cast( |
| 229 isolate()->factory()->empty_byte_array()); |
| 230 Handle<PodArray<InliningPosition>> info = |
| 231 isolate()->factory()->NewPodArray<InliningPosition>( |
| 232 static_cast<int>(inlined_functions_.size()), TENURED); |
| 233 for (int i = 0; i < inlined_functions_.size(); ++i) { |
| 234 info->set(i, inlined_functions_[i].position); |
| 235 } |
| 236 return info; |
| 221 } | 237 } |
| 222 | 238 |
| 223 Code::Kind CompilationInfo::output_code_kind() const { | 239 Code::Kind CompilationInfo::output_code_kind() const { |
| 224 return Code::ExtractKindFromFlags(code_flags_); | 240 return Code::ExtractKindFromFlags(code_flags_); |
| 225 } | 241 } |
| 226 | 242 |
| 227 } // namespace internal | 243 } // namespace internal |
| 228 } // namespace v8 | 244 } // namespace v8 |
| OLD | NEW |