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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 Node* WasmGraphBuilder::BuildLoadHeapNumberValue(Node* value, Node* control) { | 2733 Node* WasmGraphBuilder::BuildLoadHeapNumberValue(Node* value, Node* control) { |
2734 return graph()->NewNode(jsgraph()->machine()->Load(MachineType::Float64()), | 2734 return graph()->NewNode(jsgraph()->machine()->Load(MachineType::Float64()), |
2735 value, BuildHeapNumberValueIndexConstant(), | 2735 value, BuildHeapNumberValueIndexConstant(), |
2736 graph()->start(), control); | 2736 graph()->start(), control); |
2737 } | 2737 } |
2738 | 2738 |
2739 Node* WasmGraphBuilder::BuildHeapNumberValueIndexConstant() { | 2739 Node* WasmGraphBuilder::BuildHeapNumberValueIndexConstant() { |
2740 return jsgraph()->IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag); | 2740 return jsgraph()->IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag); |
2741 } | 2741 } |
2742 | 2742 |
| 2743 namespace { |
2743 bool IsJSCompatible(wasm::ValueType type) { | 2744 bool IsJSCompatible(wasm::ValueType type) { |
2744 return (type != wasm::kWasmI64) && (type != wasm::kWasmS128); | 2745 return type != wasm::kWasmI64 && type != wasm::kWasmS128; |
2745 } | 2746 } |
2746 | 2747 |
2747 bool HasJSCompatibleSignature(wasm::FunctionSig* sig) { | 2748 bool HasJSCompatibleSignature(wasm::FunctionSig* sig) { |
2748 for (size_t i = 0; i < sig->parameter_count(); i++) { | 2749 for (size_t i = 0; i < sig->parameter_count(); i++) { |
2749 if (!IsJSCompatible(sig->GetParam(i))) { | 2750 if (!IsJSCompatible(sig->GetParam(i))) return false; |
2750 return false; | |
2751 } | |
2752 } | 2751 } |
2753 for (size_t i = 0; i < sig->return_count(); i++) { | 2752 for (size_t i = 0; i < sig->return_count(); i++) { |
2754 if (!IsJSCompatible(sig->GetReturn(i))) { | 2753 if (!IsJSCompatible(sig->GetReturn(i))) return false; |
2755 return false; | |
2756 } | |
2757 } | 2754 } |
2758 return true; | 2755 return true; |
2759 } | 2756 } |
| 2757 } // namespace |
2760 | 2758 |
2761 void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, | 2759 void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, |
2762 wasm::FunctionSig* sig) { | 2760 wasm::FunctionSig* sig) { |
2763 int wasm_count = static_cast<int>(sig->parameter_count()); | 2761 int wasm_count = static_cast<int>(sig->parameter_count()); |
2764 int count = wasm_count + 3; | 2762 int count = wasm_count + 3; |
2765 Node** args = Buffer(count); | 2763 Node** args = Buffer(count); |
2766 | 2764 |
2767 // Build the start and the JS parameter nodes. | 2765 // Build the start and the JS parameter nodes. |
2768 Node* start = Start(wasm_count + 5); | 2766 Node* start = Start(wasm_count + 5); |
2769 *control_ = start; | 2767 *control_ = start; |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4237 wasm::ErrorThrower* thrower, Isolate* isolate, | 4235 wasm::ErrorThrower* thrower, Isolate* isolate, |
4238 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { | 4236 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { |
4239 WasmCompilationUnit unit(isolate, module_env, function); | 4237 WasmCompilationUnit unit(isolate, module_env, function); |
4240 unit.ExecuteCompilation(); | 4238 unit.ExecuteCompilation(); |
4241 return unit.FinishCompilation(thrower); | 4239 return unit.FinishCompilation(thrower); |
4242 } | 4240 } |
4243 | 4241 |
4244 } // namespace compiler | 4242 } // namespace compiler |
4245 } // namespace internal | 4243 } // namespace internal |
4246 } // namespace v8 | 4244 } // namespace v8 |
OLD | NEW |