| 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/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 flags_(0), | 128 flags_(0), |
| 129 code_flags_(code_flags), | 129 code_flags_(code_flags), |
| 130 mode_(mode), | 130 mode_(mode), |
| 131 osr_ast_id_(BailoutId::None()), | 131 osr_ast_id_(BailoutId::None()), |
| 132 zone_(zone), | 132 zone_(zone), |
| 133 deferred_handles_(nullptr), | 133 deferred_handles_(nullptr), |
| 134 dependencies_(isolate, zone), | 134 dependencies_(isolate, zone), |
| 135 bailout_reason_(kNoReason), | 135 bailout_reason_(kNoReason), |
| 136 prologue_offset_(Code::kPrologueOffsetNotSet), | 136 prologue_offset_(Code::kPrologueOffsetNotSet), |
| 137 track_positions_(FLAG_hydrogen_track_positions || | 137 track_positions_(FLAG_hydrogen_track_positions || |
| 138 isolate->cpu_profiler()->is_profiling()), | 138 isolate->is_profiling()), |
| 139 parameter_count_(0), | 139 parameter_count_(0), |
| 140 optimization_id_(-1), | 140 optimization_id_(-1), |
| 141 osr_expr_stack_height_(0), | 141 osr_expr_stack_height_(0), |
| 142 debug_name_(debug_name) {} | 142 debug_name_(debug_name) {} |
| 143 | 143 |
| 144 CompilationInfo::~CompilationInfo() { | 144 CompilationInfo::~CompilationInfo() { |
| 145 DisableFutureOptimization(); | 145 DisableFutureOptimization(); |
| 146 dependencies()->Rollback(); | 146 dependencies()->Rollback(); |
| 147 delete deferred_handles_; | 147 delete deferred_handles_; |
| 148 } | 148 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 Script::cast(shared->script())->compilation_type() == | 379 Script::cast(shared->script())->compilation_type() == |
| 380 Script::COMPILATION_TYPE_EVAL; | 380 Script::COMPILATION_TYPE_EVAL; |
| 381 } | 381 } |
| 382 | 382 |
| 383 void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 383 void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 384 CompilationInfo* info) { | 384 CompilationInfo* info) { |
| 385 // Log the code generation. If source information is available include | 385 // Log the code generation. If source information is available include |
| 386 // script name and line number. Check explicitly whether logging is | 386 // script name and line number. Check explicitly whether logging is |
| 387 // enabled as finding the line number is not free. | 387 // enabled as finding the line number is not free. |
| 388 if (info->isolate()->logger()->is_logging_code_events() || | 388 if (info->isolate()->logger()->is_logging_code_events() || |
| 389 info->isolate()->cpu_profiler()->is_profiling()) { | 389 info->isolate()->is_profiling()) { |
| 390 Handle<SharedFunctionInfo> shared = info->shared_info(); | 390 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 391 Handle<Script> script = info->parse_info()->script(); | 391 Handle<Script> script = info->parse_info()->script(); |
| 392 Handle<AbstractCode> abstract_code = | 392 Handle<AbstractCode> abstract_code = |
| 393 info->has_bytecode_array() | 393 info->has_bytecode_array() |
| 394 ? Handle<AbstractCode>::cast(info->bytecode_array()) | 394 ? Handle<AbstractCode>::cast(info->bytecode_array()) |
| 395 : Handle<AbstractCode>::cast(info->code()); | 395 : Handle<AbstractCode>::cast(info->code()); |
| 396 if (abstract_code.is_identical_to( | 396 if (abstract_code.is_identical_to( |
| 397 info->isolate()->builtins()->CompileLazy())) { | 397 info->isolate()->builtins()->CompileLazy())) { |
| 398 return; | 398 return; |
| 399 } | 399 } |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1791 DCHECK(shared->is_compiled()); | 1791 DCHECK(shared->is_compiled()); |
| 1792 function->set_literals(cached.literals); | 1792 function->set_literals(cached.literals); |
| 1793 } else if (shared->is_compiled()) { | 1793 } else if (shared->is_compiled()) { |
| 1794 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1794 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1795 JSFunction::EnsureLiterals(function); | 1795 JSFunction::EnsureLiterals(function); |
| 1796 } | 1796 } |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 } // namespace internal | 1799 } // namespace internal |
| 1800 } // namespace v8 | 1800 } // namespace v8 |
| OLD | NEW |