Chromium Code Reviews| 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/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 DependentCode* dependent_code = | 214 DependentCode* dependent_code = |
| 215 DependentCode::ForObject(group_objects->at(j), group); | 215 DependentCode::ForObject(group_objects->at(j), group); |
| 216 dependent_code->RemoveCompilationInfo(group, info); | 216 dependent_code->RemoveCompilationInfo(group, info); |
| 217 } | 217 } |
| 218 dependencies_[i] = NULL; // Zone-allocated, no need to delete. | 218 dependencies_[i] = NULL; // Zone-allocated, no need to delete. |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 int CompilationInfo::num_parameters() const { | 223 int CompilationInfo::num_parameters() const { |
| 224 if (IsStub()) { | 224 return scope() == nullptr ? parameter_count_ : scope()->num_parameters(); |
|
titzer
2015/03/18 09:25:53
Maybe we should have a has_scope() predicate?
Sven Panne
2015/03/18 10:40:08
Done.
| |
| 225 DCHECK(parameter_count_ > 0); | |
| 226 return parameter_count_; | |
| 227 } else { | |
| 228 return scope()->num_parameters(); | |
| 229 } | |
| 230 } | 225 } |
| 231 | 226 |
| 232 | 227 |
| 233 int CompilationInfo::num_heap_slots() const { | 228 int CompilationInfo::num_heap_slots() const { |
| 234 if (IsStub()) { | 229 return scope() == nullptr ? 0 : scope()->num_heap_slots(); |
| 235 return 0; | |
| 236 } else { | |
| 237 return scope()->num_heap_slots(); | |
| 238 } | |
| 239 } | 230 } |
| 240 | 231 |
| 241 | 232 |
| 242 Code::Flags CompilationInfo::flags() const { | 233 Code::Flags CompilationInfo::flags() const { |
| 243 if (IsStub()) { | 234 return code_stub() != nullptr |
| 244 return Code::ComputeFlags(code_stub()->GetCodeKind(), | 235 ? Code::ComputeFlags( |
| 245 code_stub()->GetICState(), | 236 code_stub()->GetCodeKind(), code_stub()->GetICState(), |
| 246 code_stub()->GetExtraICState(), | 237 code_stub()->GetExtraICState(), code_stub()->GetStubType()) |
| 247 code_stub()->GetStubType()); | 238 : Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); |
| 248 } else { | |
| 249 return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); | |
| 250 } | |
| 251 } | 239 } |
| 252 | 240 |
| 253 | 241 |
| 254 // Primitive functions are unlikely to be picked up by the stack-walking | 242 // Primitive functions are unlikely to be picked up by the stack-walking |
| 255 // profiler, so they trigger their own optimization when they're called | 243 // profiler, so they trigger their own optimization when they're called |
| 256 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | 244 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. |
| 257 bool CompilationInfo::ShouldSelfOptimize() { | 245 bool CompilationInfo::ShouldSelfOptimize() { |
| 258 return FLAG_crankshaft && !function()->flags()->Contains(kDontSelfOptimize) && | 246 return FLAG_crankshaft && !function()->flags()->Contains(kDontSelfOptimize) && |
| 259 !function()->dont_optimize() && | 247 !function()->dont_optimize() && |
| 260 function()->scope()->AllowsLazyCompilation() && | 248 function()->scope()->AllowsLazyCompilation() && |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1597 parse_info_ = nullptr; | 1585 parse_info_ = nullptr; |
| 1598 } | 1586 } |
| 1599 | 1587 |
| 1600 #if DEBUG | 1588 #if DEBUG |
| 1601 void CompilationInfo::PrintAstForTesting() { | 1589 void CompilationInfo::PrintAstForTesting() { |
| 1602 PrintF("--- Source from AST ---\n%s\n", | 1590 PrintF("--- Source from AST ---\n%s\n", |
| 1603 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1591 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1604 } | 1592 } |
| 1605 #endif | 1593 #endif |
| 1606 } } // namespace v8::internal | 1594 } } // namespace v8::internal |
| OLD | NEW |