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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 info->shared_info()->set_feedback_metadata(*feedback_metadata); | 435 info->shared_info()->set_feedback_metadata(*feedback_metadata); |
436 } | 436 } |
437 | 437 |
438 // It's very important that recompiles do not alter the structure of the type | 438 // It's very important that recompiles do not alter the structure of the type |
439 // feedback vector. Verify that the structure fits the function literal. | 439 // feedback vector. Verify that the structure fits the function literal. |
440 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom( | 440 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom( |
441 info->literal()->feedback_vector_spec())); | 441 info->literal()->feedback_vector_spec())); |
442 } | 442 } |
443 | 443 |
444 bool ShouldUseIgnition(CompilationInfo* info) { | 444 bool ShouldUseIgnition(CompilationInfo* info) { |
| 445 if (!FLAG_ignition) return false; |
| 446 |
445 DCHECK(info->has_shared_info()); | 447 DCHECK(info->has_shared_info()); |
446 | 448 |
447 // When requesting debug code as a replacement for existing code, we provide | 449 // When requesting debug code as a replacement for existing code, we provide |
448 // the same kind as the existing code (to prevent implicit tier-change). | 450 // the same kind as the existing code (to prevent implicit tier-change). |
449 if (info->is_debug() && info->shared_info()->is_compiled()) { | 451 if (info->is_debug() && info->shared_info()->is_compiled()) { |
450 return info->shared_info()->HasBytecodeArray(); | 452 return info->shared_info()->HasBytecodeArray(); |
451 } | 453 } |
452 | 454 |
453 // Since we can't OSR from Ignition, skip Ignition for asm.js functions. | 455 // Since we can't OSR from Ignition, skip Ignition for asm.js functions. |
454 if (info->shared_info()->asm_function()) { | 456 if (info->shared_info()->asm_function()) { |
(...skipping 22 matching lines...) Expand all Loading... |
477 EnsureFeedbackMetadata(info); | 479 EnsureFeedbackMetadata(info); |
478 if (FLAG_validate_asm && info->scope()->asm_module()) { | 480 if (FLAG_validate_asm && info->scope()->asm_module()) { |
479 MaybeHandle<FixedArray> wasm_data; | 481 MaybeHandle<FixedArray> wasm_data; |
480 wasm_data = AsmJs::ConvertAsmToWasm(info->parse_info()); | 482 wasm_data = AsmJs::ConvertAsmToWasm(info->parse_info()); |
481 if (!wasm_data.is_null()) { | 483 if (!wasm_data.is_null()) { |
482 info->shared_info()->set_asm_wasm_data(*wasm_data.ToHandleChecked()); | 484 info->shared_info()->set_asm_wasm_data(*wasm_data.ToHandleChecked()); |
483 info->SetCode(info->isolate()->builtins()->InstantiateAsmJs()); | 485 info->SetCode(info->isolate()->builtins()->InstantiateAsmJs()); |
484 return true; | 486 return true; |
485 } | 487 } |
486 } | 488 } |
487 if (FLAG_ignition && ShouldUseIgnition(info)) { | 489 if (ShouldUseIgnition(info)) { |
488 success = interpreter::Interpreter::MakeBytecode(info); | 490 success = interpreter::Interpreter::MakeBytecode(info); |
489 } else { | 491 } else { |
490 success = FullCodeGenerator::MakeCode(info); | 492 success = FullCodeGenerator::MakeCode(info); |
491 } | 493 } |
492 if (success) { | 494 if (success) { |
493 Isolate* isolate = info->isolate(); | 495 Isolate* isolate = info->isolate(); |
494 Counters* counters = isolate->counters(); | 496 Counters* counters = isolate->counters(); |
495 // TODO(4280): Rename counters from "baseline" to "unoptimized" eventually. | 497 // TODO(4280): Rename counters from "baseline" to "unoptimized" eventually. |
496 counters->total_baseline_code_size()->Increment(CodeAndMetadataSize(info)); | 498 counters->total_baseline_code_size()->Increment(CodeAndMetadataSize(info)); |
497 counters->total_baseline_compile_count()->Increment(1); | 499 counters->total_baseline_compile_count()->Increment(1); |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 DCHECK(shared->is_compiled()); | 1913 DCHECK(shared->is_compiled()); |
1912 function->set_literals(cached.literals); | 1914 function->set_literals(cached.literals); |
1913 } else if (shared->is_compiled()) { | 1915 } else if (shared->is_compiled()) { |
1914 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1916 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1915 JSFunction::EnsureLiterals(function); | 1917 JSFunction::EnsureLiterals(function); |
1916 } | 1918 } |
1917 } | 1919 } |
1918 | 1920 |
1919 } // namespace internal | 1921 } // namespace internal |
1920 } // namespace v8 | 1922 } // namespace v8 |
OLD | NEW |