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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/asmjs/asm-js.h" | 10 #include "src/asmjs/asm-js.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 // when the function is not compiled (i.e. no code was serialized). | 314 // when the function is not compiled (i.e. no code was serialized). |
315 | 315 |
316 // TODO(mvstanton): reintroduce is_empty() predicate to feedback_metadata(). | 316 // TODO(mvstanton): reintroduce is_empty() predicate to feedback_metadata(). |
317 if (info->shared_info()->feedback_metadata()->length() == 0 || | 317 if (info->shared_info()->feedback_metadata()->length() == 0 || |
318 !info->shared_info()->is_compiled()) { | 318 !info->shared_info()->is_compiled()) { |
319 Handle<FeedbackMetadata> feedback_metadata = FeedbackMetadata::New( | 319 Handle<FeedbackMetadata> feedback_metadata = FeedbackMetadata::New( |
320 info->isolate(), info->literal()->feedback_vector_spec()); | 320 info->isolate(), info->literal()->feedback_vector_spec()); |
321 info->shared_info()->set_feedback_metadata(*feedback_metadata); | 321 info->shared_info()->set_feedback_metadata(*feedback_metadata); |
322 } | 322 } |
323 | 323 |
324 // CollectTypeProfile uses its own feedback slot. The decision | |
325 // whether we collect type profile or not must match the | |
326 // feedback metadata. | |
327 // If we have not decided whether we collect type feedback, we | |
328 // make a decision based on the FLAG. Otherwise we cannot change it. | |
329 if (!info->shared_info()->computed_collects_type_profile()) { | |
Yang
2017/03/09 10:28:27
Michael, here's where I'd like you to take a close
mvstanton
2017/03/10 12:12:24
Yep, it makes sense to avoid these flags and just
Franzi
2017/03/10 14:33:49
I deleted the constants and instead check the Feed
| |
330 info->shared_info()->set_collects_type_profile(FLAG_type_profile); | |
331 info->shared_info()->set_computed_collects_type_profile(true); | |
332 } | |
333 | |
324 // It's very important that recompiles do not alter the structure of the type | 334 // It's very important that recompiles do not alter the structure of the type |
325 // feedback vector. Verify that the structure fits the function literal. | 335 // feedback vector. Verify that the structure fits the function literal. |
326 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom( | 336 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom( |
327 info->literal()->feedback_vector_spec())); | 337 info->literal()->feedback_vector_spec())); |
328 } | 338 } |
329 | 339 |
330 bool UseTurboFan(Handle<SharedFunctionInfo> shared) { | 340 bool UseTurboFan(Handle<SharedFunctionInfo> shared) { |
331 bool must_use_ignition_turbo = shared->must_use_ignition_turbo(); | 341 bool must_use_ignition_turbo = shared->must_use_ignition_turbo(); |
332 | 342 |
333 // Check the enabling conditions for Turbofan. | 343 // Check the enabling conditions for Turbofan. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 } | 481 } |
472 if (literal->flags() & AstProperties::kMustUseIgnitionTurbo) { | 482 if (literal->flags() & AstProperties::kMustUseIgnitionTurbo) { |
473 shared_info->set_must_use_ignition_turbo(true); | 483 shared_info->set_must_use_ignition_turbo(true); |
474 } | 484 } |
475 } | 485 } |
476 | 486 |
477 bool Renumber(ParseInfo* parse_info, | 487 bool Renumber(ParseInfo* parse_info, |
478 Compiler::EagerInnerFunctionLiterals* eager_literals) { | 488 Compiler::EagerInnerFunctionLiterals* eager_literals) { |
479 RuntimeCallTimerScope runtimeTimer(parse_info->isolate(), | 489 RuntimeCallTimerScope runtimeTimer(parse_info->isolate(), |
480 &RuntimeCallStats::CompileRenumber); | 490 &RuntimeCallStats::CompileRenumber); |
491 | |
492 // CollectTypeProfile uses its own feedback slot. The decision | |
493 // whether we collect type profile or not must match the | |
494 // feedback metadata. | |
495 // If we parse for the first time or if we have not decided whether we collect | |
496 // type feedback, we make a decision based on the FLAG. Otherwise we stick | |
497 // with the previous decision. | |
498 bool collect_type_profile = | |
499 (FLAG_type_profile && | |
500 (parse_info->shared_info().is_null() || | |
501 !parse_info->shared_info()->computed_collects_type_profile())) || | |
502 (!parse_info->shared_info().is_null() && | |
503 parse_info->shared_info()->computed_collects_type_profile() && | |
504 parse_info->shared_info()->collects_type_profile()); | |
Yang
2017/03/09 10:28:27
This expression seems correct. But can we make thi
Franzi
2017/03/10 12:14:28
Thanks for the suggestions. Done.
| |
505 | |
481 if (!AstNumbering::Renumber( | 506 if (!AstNumbering::Renumber( |
482 parse_info->isolate()->stack_guard()->real_climit(), | 507 parse_info->isolate()->stack_guard()->real_climit(), |
483 parse_info->zone(), parse_info->literal(), eager_literals)) { | 508 parse_info->zone(), parse_info->literal(), eager_literals, |
509 collect_type_profile)) { | |
484 return false; | 510 return false; |
485 } | 511 } |
486 if (!parse_info->shared_info().is_null()) { | 512 if (!parse_info->shared_info().is_null()) { |
487 SetSharedFunctionFlagsFromLiteral(parse_info->literal(), | 513 SetSharedFunctionFlagsFromLiteral(parse_info->literal(), |
488 parse_info->shared_info()); | 514 parse_info->shared_info()); |
489 } | 515 } |
490 return true; | 516 return true; |
491 } | 517 } |
492 | 518 |
493 bool GenerateUnoptimizedCode(CompilationInfo* info) { | 519 bool GenerateUnoptimizedCode(CompilationInfo* info) { |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1938 } | 1964 } |
1939 | 1965 |
1940 if (shared->is_compiled()) { | 1966 if (shared->is_compiled()) { |
1941 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1967 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1942 JSFunction::EnsureLiterals(function); | 1968 JSFunction::EnsureLiterals(function); |
1943 } | 1969 } |
1944 } | 1970 } |
1945 | 1971 |
1946 } // namespace internal | 1972 } // namespace internal |
1947 } // namespace v8 | 1973 } // namespace v8 |
OLD | NEW |