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 |
(...skipping 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 } | 2949 } |
2950 | 2950 |
2951 // The return value is also passed via this buffer: | 2951 // The return value is also passed via this buffer: |
2952 DCHECK_GE(wasm::kV8MaxWasmFunctionReturns, sig->return_count()); | 2952 DCHECK_GE(wasm::kV8MaxWasmFunctionReturns, sig->return_count()); |
2953 // TODO(wasm): Handle multi-value returns. | 2953 // TODO(wasm): Handle multi-value returns. |
2954 DCHECK_EQ(1, wasm::kV8MaxWasmFunctionReturns); | 2954 DCHECK_EQ(1, wasm::kV8MaxWasmFunctionReturns); |
2955 int return_size_bytes = | 2955 int return_size_bytes = |
2956 sig->return_count() == 0 ? 0 : 1 << ElementSizeLog2Of(sig->GetReturn(0)); | 2956 sig->return_count() == 0 ? 0 : 1 << ElementSizeLog2Of(sig->GetReturn(0)); |
2957 | 2957 |
2958 // Get a stack slot for the arguments. | 2958 // Get a stack slot for the arguments. |
2959 Node* arg_buffer = graph()->NewNode(jsgraph()->machine()->StackSlot( | 2959 Node* arg_buffer = args_size_bytes == 0 && return_size_bytes == 0 |
2960 std::max(args_size_bytes, return_size_bytes))); | 2960 ? jsgraph()->IntPtrConstant(0) |
| 2961 : graph()->NewNode(jsgraph()->machine()->StackSlot( |
| 2962 std::max(args_size_bytes, return_size_bytes))); |
2961 | 2963 |
2962 // Now store all our arguments to the buffer. | 2964 // Now store all our arguments to the buffer. |
2963 int param_index = 0; | 2965 int param_index = 0; |
2964 int offset = 0; | 2966 int offset = 0; |
2965 for (int i = 0; i < wasm_count; i++) { | 2967 for (int i = 0; i < wasm_count; i++) { |
2966 Node* param = Param(param_index++); | 2968 Node* param = Param(param_index++); |
2967 bool is_i64_as_two_params = | 2969 bool is_i64_as_two_params = |
2968 jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kWasmI64; | 2970 jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kWasmI64; |
2969 MachineRepresentation param_rep = | 2971 MachineRepresentation param_rep = |
2970 is_i64_as_two_params ? wasm::kWasmI32 : sig->GetParam(i); | 2972 is_i64_as_two_params ? wasm::kWasmI32 : sig->GetParam(i); |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3876 Smi::FromInt(instruction.instr_offset)); | 3878 Smi::FromInt(instruction.instr_offset)); |
3877 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, | 3879 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, |
3878 Smi::FromInt(instruction.landing_offset)); | 3880 Smi::FromInt(instruction.landing_offset)); |
3879 } | 3881 } |
3880 return fn_protected; | 3882 return fn_protected; |
3881 } | 3883 } |
3882 | 3884 |
3883 } // namespace compiler | 3885 } // namespace compiler |
3884 } // namespace internal | 3886 } // namespace internal |
3885 } // namespace v8 | 3887 } // namespace v8 |
OLD | NEW |