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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 if (shared->code()->kind() == Code::FUNCTION && | 1426 if (shared->code()->kind() == Code::FUNCTION && |
1426 shared->code()->has_reloc_info_for_serialization()) { | 1427 shared->code()->has_reloc_info_for_serialization()) { |
1427 unoptimized.PrepareForSerializing(); | 1428 unoptimized.PrepareForSerializing(); |
1428 } | 1429 } |
1429 EnsureFeedbackMetadata(&unoptimized); | 1430 EnsureFeedbackMetadata(&unoptimized); |
1430 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; | 1431 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; |
1431 | 1432 |
1432 // TODO(4280): For now we play it safe and remove the bytecode array when we | 1433 // TODO(4280): For now we play it safe and remove the bytecode array when we |
1433 // switch to baseline code. We might consider keeping around the bytecode so | 1434 // switch to baseline code. We might consider keeping around the bytecode so |
1434 // that it can be used as the "source of truth" eventually. | 1435 // that it can be used as the "source of truth" eventually. |
1435 if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray(); | 1436 if (shared->HasBytecodeArray()) { |
| 1437 if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray(); |
| 1438 } |
1436 | 1439 |
1437 // The scope info might not have been set if a lazily compiled | 1440 // The scope info might not have been set if a lazily compiled |
1438 // function is inlined before being called for the first time. | 1441 // function is inlined before being called for the first time. |
1439 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { | 1442 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { |
1440 InstallSharedScopeInfo(info, shared); | 1443 InstallSharedScopeInfo(info, shared); |
1441 } | 1444 } |
1442 | 1445 |
1443 // Install compilation result on the shared function info | 1446 // Install compilation result on the shared function info |
1444 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 1447 shared->EnableDeoptimizationSupport(*unoptimized.code()); |
1445 | 1448 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 DCHECK(shared->is_compiled()); | 1951 DCHECK(shared->is_compiled()); |
1949 function->set_literals(cached.literals); | 1952 function->set_literals(cached.literals); |
1950 } else if (shared->is_compiled()) { | 1953 } else if (shared->is_compiled()) { |
1951 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1954 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1952 JSFunction::EnsureLiterals(function); | 1955 JSFunction::EnsureLiterals(function); |
1953 } | 1956 } |
1954 } | 1957 } |
1955 | 1958 |
1956 } // namespace internal | 1959 } // namespace internal |
1957 } // namespace v8 | 1960 } // namespace v8 |
OLD | NEW |