| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return Code::ComputeFlags(code_stub()->GetCodeKind(), | 252 return Code::ComputeFlags(code_stub()->GetCodeKind(), |
| 253 code_stub()->GetICState(), | 253 code_stub()->GetICState(), |
| 254 code_stub()->GetExtraICState(), | 254 code_stub()->GetExtraICState(), |
| 255 code_stub()->GetStubType()); | 255 code_stub()->GetStubType()); |
| 256 } else { | 256 } else { |
| 257 return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); | 257 return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 // Disable optimization for the rest of the compilation pipeline. | |
| 263 void CompilationInfo::DisableOptimization() { | |
| 264 bool is_optimizable_closure = | |
| 265 FLAG_optimize_closures && | |
| 266 closure_.is_null() && | |
| 267 !scope_->HasTrivialOuterContext() && | |
| 268 !scope_->outer_scope_calls_sloppy_eval() && | |
| 269 !scope_->inside_with(); | |
| 270 SetMode(is_optimizable_closure ? BASE : NONOPT); | |
| 271 } | |
| 272 | |
| 273 | |
| 274 // Primitive functions are unlikely to be picked up by the stack-walking | 262 // Primitive functions are unlikely to be picked up by the stack-walking |
| 275 // profiler, so they trigger their own optimization when they're called | 263 // profiler, so they trigger their own optimization when they're called |
| 276 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | 264 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. |
| 277 bool CompilationInfo::ShouldSelfOptimize() { | 265 bool CompilationInfo::ShouldSelfOptimize() { |
| 278 return FLAG_crankshaft && | 266 return FLAG_crankshaft && |
| 279 !function()->flags()->Contains(kDontSelfOptimize) && | 267 !function()->flags()->Contains(kDontSelfOptimize) && |
| 280 !function()->dont_optimize() && | 268 !function()->dont_optimize() && |
| 281 function()->scope()->AllowsLazyCompilation() && | 269 function()->scope()->AllowsLazyCompilation() && |
| 282 (shared_info().is_null() || !shared_info()->optimization_disabled()); | 270 (shared_info().is_null() || !shared_info()->optimization_disabled()); |
| 283 } | 271 } |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 AllowHandleDereference allow_deref; | 1425 AllowHandleDereference allow_deref; |
| 1438 bool tracing_on = info()->IsStub() | 1426 bool tracing_on = info()->IsStub() |
| 1439 ? FLAG_trace_hydrogen_stubs | 1427 ? FLAG_trace_hydrogen_stubs |
| 1440 : (FLAG_trace_hydrogen && | 1428 : (FLAG_trace_hydrogen && |
| 1441 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1429 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1442 return (tracing_on && | 1430 return (tracing_on && |
| 1443 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1431 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1444 } | 1432 } |
| 1445 | 1433 |
| 1446 } } // namespace v8::internal | 1434 } } // namespace v8::internal |
| OLD | NEW |