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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 int CodeAndMetadataSize(CompilationInfo* info) { | 469 int CodeAndMetadataSize(CompilationInfo* info) { |
470 if (info->has_bytecode_array()) { | 470 if (info->has_bytecode_array()) { |
471 return info->bytecode_array()->SizeIncludingMetadata(); | 471 return info->bytecode_array()->SizeIncludingMetadata(); |
472 } | 472 } |
473 return info->code()->SizeIncludingMetadata(); | 473 return info->code()->SizeIncludingMetadata(); |
474 } | 474 } |
475 | 475 |
476 bool GenerateUnoptimizedCode(CompilationInfo* info) { | 476 bool GenerateUnoptimizedCode(CompilationInfo* info) { |
477 bool success; | 477 bool success; |
478 EnsureFeedbackMetadata(info); | 478 EnsureFeedbackMetadata(info); |
479 if (FLAG_validate_asm && info->scope()->asm_module()) { | 479 if (FLAG_validate_asm && info->scope()->asm_module() && |
| 480 !info->shared_info()->is_asm_wasm_broken()) { |
480 MaybeHandle<FixedArray> wasm_data; | 481 MaybeHandle<FixedArray> wasm_data; |
481 wasm_data = AsmJs::ConvertAsmToWasm(info->parse_info()); | 482 wasm_data = AsmJs::ConvertAsmToWasm(info->parse_info()); |
482 if (!wasm_data.is_null()) { | 483 if (!wasm_data.is_null()) { |
483 info->shared_info()->set_asm_wasm_data(*wasm_data.ToHandleChecked()); | 484 info->shared_info()->set_asm_wasm_data(*wasm_data.ToHandleChecked()); |
484 info->SetCode(info->isolate()->builtins()->InstantiateAsmJs()); | 485 info->SetCode(info->isolate()->builtins()->InstantiateAsmJs()); |
485 return true; | 486 return true; |
486 } | 487 } |
487 } | 488 } |
488 if (ShouldUseIgnition(info)) { | 489 if (ShouldUseIgnition(info)) { |
489 success = interpreter::Interpreter::MakeBytecode(info); | 490 success = interpreter::Interpreter::MakeBytecode(info); |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 if (shared->code()->kind() == Code::FUNCTION && | 1430 if (shared->code()->kind() == Code::FUNCTION && |
1430 shared->code()->has_reloc_info_for_serialization()) { | 1431 shared->code()->has_reloc_info_for_serialization()) { |
1431 unoptimized.PrepareForSerializing(); | 1432 unoptimized.PrepareForSerializing(); |
1432 } | 1433 } |
1433 EnsureFeedbackMetadata(&unoptimized); | 1434 EnsureFeedbackMetadata(&unoptimized); |
1434 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; | 1435 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; |
1435 | 1436 |
1436 // TODO(4280): For now we play it safe and remove the bytecode array when we | 1437 // TODO(4280): For now we play it safe and remove the bytecode array when we |
1437 // switch to baseline code. We might consider keeping around the bytecode so | 1438 // switch to baseline code. We might consider keeping around the bytecode so |
1438 // that it can be used as the "source of truth" eventually. | 1439 // that it can be used as the "source of truth" eventually. |
1439 if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray(); | 1440 if (shared->HasBytecodeArray()) { |
| 1441 if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray(); |
| 1442 } |
1440 | 1443 |
1441 // The scope info might not have been set if a lazily compiled | 1444 // The scope info might not have been set if a lazily compiled |
1442 // function is inlined before being called for the first time. | 1445 // function is inlined before being called for the first time. |
1443 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { | 1446 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { |
1444 InstallSharedScopeInfo(info, shared); | 1447 InstallSharedScopeInfo(info, shared); |
1445 } | 1448 } |
1446 | 1449 |
1447 // Install compilation result on the shared function info | 1450 // Install compilation result on the shared function info |
1448 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 1451 shared->EnableDeoptimizationSupport(*unoptimized.code()); |
1449 | 1452 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 DCHECK(shared->is_compiled()); | 1962 DCHECK(shared->is_compiled()); |
1960 function->set_literals(cached.literals); | 1963 function->set_literals(cached.literals); |
1961 } else if (shared->is_compiled()) { | 1964 } else if (shared->is_compiled()) { |
1962 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1965 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1963 JSFunction::EnsureLiterals(function); | 1966 JSFunction::EnsureLiterals(function); |
1964 } | 1967 } |
1965 } | 1968 } |
1966 | 1969 |
1967 } // namespace internal | 1970 } // namespace internal |
1968 } // namespace v8 | 1971 } // namespace v8 |
OLD | NEW |