Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/wasm-compiler.h" | 5 #include "src/compiler/wasm-compiler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 | 10 |
| 11 #include "src/base/platform/elapsed-timer.h" | 11 #include "src/base/platform/elapsed-timer.h" |
| 12 #include "src/base/platform/platform.h" | 12 #include "src/base/platform/platform.h" |
| 13 | 13 |
| 14 #include "src/compiler/access-builder.h" | 14 #include "src/compiler/access-builder.h" |
| 15 #include "src/compiler/common-operator.h" | 15 #include "src/compiler/common-operator.h" |
| 16 #include "src/compiler/diamond.h" | 16 #include "src/compiler/diamond.h" |
| 17 #include "src/compiler/graph-visualizer.h" | 17 #include "src/compiler/graph-visualizer.h" |
| 18 #include "src/compiler/graph.h" | 18 #include "src/compiler/graph.h" |
| 19 #include "src/compiler/instruction-selector.h" | 19 #include "src/compiler/instruction-selector.h" |
| 20 #include "src/compiler/int64-lowering.h" | 20 #include "src/compiler/int64-lowering.h" |
| 21 #include "src/compiler/js-graph.h" | 21 #include "src/compiler/js-graph.h" |
| 22 #include "src/compiler/js-operator.h" | 22 #include "src/compiler/js-operator.h" |
| 23 #include "src/compiler/linkage.h" | 23 #include "src/compiler/linkage.h" |
| 24 #include "src/compiler/machine-operator.h" | 24 #include "src/compiler/machine-operator.h" |
| 25 #include "src/compiler/node-matchers.h" | 25 #include "src/compiler/node-matchers.h" |
| 26 #include "src/compiler/pipeline.h" | 26 #include "src/compiler/pipeline.h" |
| 27 #include "src/compiler/simd-scalar-lowering.h" | |
| 27 #include "src/compiler/source-position.h" | 28 #include "src/compiler/source-position.h" |
| 28 #include "src/compiler/zone-pool.h" | 29 #include "src/compiler/zone-pool.h" |
| 29 | 30 |
| 30 #include "src/code-factory.h" | 31 #include "src/code-factory.h" |
| 31 #include "src/code-stubs.h" | 32 #include "src/code-stubs.h" |
| 32 #include "src/factory.h" | 33 #include "src/factory.h" |
| 33 #include "src/log-inl.h" | 34 #include "src/log-inl.h" |
| 34 | 35 |
| 35 #include "src/wasm/ast-decoder.h" | 36 #include "src/wasm/ast-decoder.h" |
| 36 #include "src/wasm/wasm-module.h" | 37 #include "src/wasm/wasm-module.h" |
| (...skipping 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2876 | 2877 |
| 2877 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, | 2878 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
| 2878 const NodeVector& inputs) { | 2879 const NodeVector& inputs) { |
| 2879 switch (opcode) { | 2880 switch (opcode) { |
| 2880 case wasm::kExprI32x4ExtractLane: | 2881 case wasm::kExprI32x4ExtractLane: |
| 2881 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), | 2882 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), |
| 2882 inputs[0], inputs[1]); | 2883 inputs[0], inputs[1]); |
| 2883 case wasm::kExprI32x4Splat: | 2884 case wasm::kExprI32x4Splat: |
| 2884 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], | 2885 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], |
| 2885 inputs[0], inputs[0], inputs[0]); | 2886 inputs[0], inputs[0], inputs[0]); |
| 2887 case wasm::kExprI32x4Add: | |
| 2888 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], | |
| 2889 inputs[1]); | |
| 2890 case wasm::kExprF32x4ExtractLane: | |
| 2891 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), | |
| 2892 inputs[0], inputs[1]); | |
| 2893 case wasm::kExprF32x4Splat: | |
| 2894 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), | |
| 2895 inputs[0], inputs[0], inputs[0], inputs[0]); | |
| 2896 case wasm::kExprF32x4Add: | |
| 2897 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], | |
| 2898 inputs[1]); | |
| 2886 default: | 2899 default: |
| 2887 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 2900 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
| 2888 } | 2901 } |
| 2889 } | 2902 } |
| 2890 | 2903 |
| 2891 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 2904 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
| 2892 Isolate* isolate, Handle<Code> code, | 2905 Isolate* isolate, Handle<Code> code, |
| 2893 const char* message, uint32_t index, | 2906 const char* message, uint32_t index, |
| 2894 const wasm::WasmName& module_name, | 2907 const wasm::WasmName& module_name, |
| 2895 const wasm::WasmName& func_name) { | 2908 const wasm::WasmName& func_name) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3091 os << "Compilation failed: " << graph_construction_result_ << std::endl; | 3104 os << "Compilation failed: " << graph_construction_result_ << std::endl; |
| 3092 } | 3105 } |
| 3093 return nullptr; | 3106 return nullptr; |
| 3094 } | 3107 } |
| 3095 | 3108 |
| 3096 if (machine->Is32()) { | 3109 if (machine->Is32()) { |
| 3097 Int64Lowering r(graph, machine, common, jsgraph_->zone(), function_->sig); | 3110 Int64Lowering r(graph, machine, common, jsgraph_->zone(), function_->sig); |
| 3098 r.LowerGraph(); | 3111 r.LowerGraph(); |
| 3099 } | 3112 } |
| 3100 | 3113 |
| 3114 SimdScalarLowering r(graph, machine, common, jsgraph_->zone(), | |
|
bradnelson
2016/08/31 22:42:08
->
SimdScalarLowering(graph, machine, common, jsgr
aseemgarg
2016/10/10 17:35:17
Done.
| |
| 3115 function_->sig); | |
| 3116 r.LowerGraph(); | |
| 3117 | |
| 3101 int index = static_cast<int>(function_->func_index); | 3118 int index = static_cast<int>(function_->func_index); |
| 3102 | 3119 |
| 3103 if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) { | 3120 if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) { |
| 3104 OFStream os(stdout); | 3121 OFStream os(stdout); |
| 3105 PrintAst(isolate_->allocator(), body, os, nullptr); | 3122 PrintAst(isolate_->allocator(), body, os, nullptr); |
| 3106 } | 3123 } |
| 3107 if (FLAG_trace_wasm_decode_time) { | 3124 if (FLAG_trace_wasm_decode_time) { |
| 3108 *decode_ms = decode_timer.Elapsed().InMillisecondsF(); | 3125 *decode_ms = decode_timer.Elapsed().InMillisecondsF(); |
| 3109 } | 3126 } |
| 3110 return source_position_table; | 3127 return source_position_table; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3236 function_->code_start_offset), | 3253 function_->code_start_offset), |
| 3237 compile_ms); | 3254 compile_ms); |
| 3238 } | 3255 } |
| 3239 | 3256 |
| 3240 return code; | 3257 return code; |
| 3241 } | 3258 } |
| 3242 | 3259 |
| 3243 } // namespace compiler | 3260 } // namespace compiler |
| 3244 } // namespace internal | 3261 } // namespace internal |
| 3245 } // namespace v8 | 3262 } // namespace v8 |
| OLD | NEW |