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 | 8 |
| 9 #include "src/asmjs/asm-js.h" |
| 10 #include "src/asmjs/typing-asm.h" |
9 #include "src/ast/ast-numbering.h" | 11 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 12 #include "src/ast/prettyprinter.h" |
11 #include "src/ast/scopeinfo.h" | 13 #include "src/ast/scopeinfo.h" |
12 #include "src/ast/scopes.h" | 14 #include "src/ast/scopes.h" |
13 #include "src/bootstrapper.h" | 15 #include "src/bootstrapper.h" |
14 #include "src/codegen.h" | 16 #include "src/codegen.h" |
15 #include "src/compilation-cache.h" | 17 #include "src/compilation-cache.h" |
16 #include "src/compiler/pipeline.h" | 18 #include "src/compiler/pipeline.h" |
17 #include "src/crankshaft/hydrogen.h" | 19 #include "src/crankshaft/hydrogen.h" |
18 #include "src/debug/debug.h" | 20 #include "src/debug/debug.h" |
19 #include "src/debug/liveedit.h" | 21 #include "src/debug/liveedit.h" |
20 #include "src/deoptimizer.h" | 22 #include "src/deoptimizer.h" |
21 #include "src/frames-inl.h" | 23 #include "src/frames-inl.h" |
22 #include "src/full-codegen/full-codegen.h" | 24 #include "src/full-codegen/full-codegen.h" |
23 #include "src/globals.h" | 25 #include "src/globals.h" |
24 #include "src/interpreter/interpreter.h" | 26 #include "src/interpreter/interpreter.h" |
25 #include "src/isolate-inl.h" | 27 #include "src/isolate-inl.h" |
26 #include "src/log-inl.h" | 28 #include "src/log-inl.h" |
27 #include "src/messages.h" | 29 #include "src/messages.h" |
28 #include "src/parsing/parser.h" | 30 #include "src/parsing/parser.h" |
29 #include "src/parsing/rewriter.h" | 31 #include "src/parsing/rewriter.h" |
30 #include "src/parsing/scanner-character-streams.h" | 32 #include "src/parsing/scanner-character-streams.h" |
31 #include "src/runtime-profiler.h" | 33 #include "src/runtime-profiler.h" |
32 #include "src/snapshot/code-serializer.h" | 34 #include "src/snapshot/code-serializer.h" |
33 #include "src/typing-asm.h" | |
34 #include "src/vm-state-inl.h" | 35 #include "src/vm-state-inl.h" |
35 | 36 |
36 namespace v8 { | 37 namespace v8 { |
37 namespace internal { | 38 namespace internal { |
38 | 39 |
39 | 40 |
40 #define PARSE_INFO_GETTER(type, name) \ | 41 #define PARSE_INFO_GETTER(type, name) \ |
41 type CompilationInfo::name() const { \ | 42 type CompilationInfo::name() const { \ |
42 CHECK(parse_info()); \ | 43 CHECK(parse_info()); \ |
43 return parse_info()->name(); \ | 44 return parse_info()->name(); \ |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 if (info->has_bytecode_array()) { | 471 if (info->has_bytecode_array()) { |
471 return info->bytecode_array()->SizeIncludingMetadata(); | 472 return info->bytecode_array()->SizeIncludingMetadata(); |
472 } | 473 } |
473 return info->code()->SizeIncludingMetadata(); | 474 return info->code()->SizeIncludingMetadata(); |
474 } | 475 } |
475 | 476 |
476 bool GenerateUnoptimizedCode(CompilationInfo* info) { | 477 bool GenerateUnoptimizedCode(CompilationInfo* info) { |
477 bool success; | 478 bool success; |
478 EnsureFeedbackMetadata(info); | 479 EnsureFeedbackMetadata(info); |
479 if (FLAG_validate_asm && info->scope()->asm_module()) { | 480 if (FLAG_validate_asm && info->scope()->asm_module()) { |
480 AsmTyper typer(info->isolate(), info->zone(), *(info->script()), | 481 MaybeHandle<FixedArray> wasm_data; |
481 info->literal()); | 482 wasm_data = AsmJs::ConvertAsmToWasm(info->parse_info()); |
482 if (FLAG_enable_simd_asmjs) { | 483 if (!wasm_data.is_null()) { |
483 typer.set_allow_simd(true); | 484 info->shared_info()->set_asm_wasm_data(*wasm_data.ToHandleChecked()); |
484 } | 485 info->SetCode(info->isolate()->builtins()->InstantiateAsmJs()); |
485 if (!typer.Validate()) { | 486 return true; |
486 DCHECK(!info->isolate()->has_pending_exception()); | |
487 PrintF("Validation of asm.js module failed: %s", typer.error_message()); | |
488 } | 487 } |
489 } | 488 } |
490 if (FLAG_ignition && UseIgnition(info)) { | 489 if (FLAG_ignition && UseIgnition(info)) { |
491 success = interpreter::Interpreter::MakeBytecode(info); | 490 success = interpreter::Interpreter::MakeBytecode(info); |
492 } else { | 491 } else { |
493 success = FullCodeGenerator::MakeCode(info); | 492 success = FullCodeGenerator::MakeCode(info); |
494 } | 493 } |
495 if (success) { | 494 if (success) { |
496 Isolate* isolate = info->isolate(); | 495 Isolate* isolate = info->isolate(); |
497 Counters* counters = isolate->counters(); | 496 Counters* counters = isolate->counters(); |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 DCHECK(shared->is_compiled()); | 1825 DCHECK(shared->is_compiled()); |
1827 function->set_literals(cached.literals); | 1826 function->set_literals(cached.literals); |
1828 } else if (shared->is_compiled()) { | 1827 } else if (shared->is_compiled()) { |
1829 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1828 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1830 JSFunction::EnsureLiterals(function); | 1829 JSFunction::EnsureLiterals(function); |
1831 } | 1830 } |
1832 } | 1831 } |
1833 | 1832 |
1834 } // namespace internal | 1833 } // namespace internal |
1835 } // namespace v8 | 1834 } // namespace v8 |
OLD | NEW |