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/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 2957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2968 : graph()->NewNode(jsgraph()->machine()->StackSlot( | 2968 : graph()->NewNode(jsgraph()->machine()->StackSlot( |
| 2969 std::max(args_size_bytes, return_size_bytes))); | 2969 std::max(args_size_bytes, return_size_bytes))); |
| 2970 | 2970 |
| 2971 // Now store all our arguments to the buffer. | 2971 // Now store all our arguments to the buffer. |
| 2972 int param_index = 0; | 2972 int param_index = 0; |
| 2973 int offset = 0; | 2973 int offset = 0; |
| 2974 for (int i = 0; i < wasm_count; i++) { | 2974 for (int i = 0; i < wasm_count; i++) { |
| 2975 Node* param = Param(param_index++); | 2975 Node* param = Param(param_index++); |
| 2976 bool is_i64_as_two_params = | 2976 bool is_i64_as_two_params = |
| 2977 jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kWasmI64; | 2977 jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kWasmI64; |
| 2978 MachineRepresentation param_rep = | |
| 2979 is_i64_as_two_params ? wasm::kWasmI32 : sig->GetParam(i); | |
| 2980 StoreRepresentation store_rep(param_rep, WriteBarrierKind::kNoWriteBarrier); | |
| 2981 *effect_ = | |
| 2982 graph()->NewNode(jsgraph()->machine()->Store(store_rep), arg_buffer, | |
| 2983 Int32Constant(offset), param, *effect_, *control_); | |
| 2984 | 2978 |
| 2985 if (is_i64_as_two_params) { | 2979 if (is_i64_as_two_params) { |
| 2986 offset += 1 << ElementSizeLog2Of(wasm::kWasmI32); | 2980 StoreRepresentation store_rep(wasm::kWasmI32, |
| 2981 WriteBarrierKind::kNoWriteBarrier); | |
| 2982 *effect_ = graph()->NewNode( | |
| 2983 jsgraph()->machine()->Store(store_rep), arg_buffer, | |
| 2984 Int32Constant(offset + kInt64LowerBitsMememoryOffset), param, | |
| 2985 *effect_, *control_); | |
| 2986 | |
| 2987 param = Param(param_index++); | |
| 2988 store_rep = StoreRepresentation(wasm::kWasmI32, | |
|
Clemens Hammacher
2017/03/01 08:51:13
This assignment is redundant.
ivica.bogosavljevic
2017/03/01 12:58:48
Acknowledged.
| |
| 2989 WriteBarrierKind::kNoWriteBarrier); | |
| 2990 *effect_ = | |
| 2991 graph()->NewNode(jsgraph()->machine()->Store(store_rep), arg_buffer, | |
| 2992 Int32Constant(offset + kInt64HigherBitsMemoryOffset), | |
| 2993 param, *effect_, *control_); | |
| 2994 offset += 8; | |
| 2995 | |
| 2987 } else { | 2996 } else { |
| 2988 offset += RoundUpToMultipleOfPowOf2(1 << ElementSizeLog2Of(param_rep), 8); | 2997 MachineRepresentation param_rep = sig->GetParam(i); |
| 2989 } | 2998 StoreRepresentation store_rep(param_rep, |
| 2990 | |
| 2991 // TODO(clemensh): Respect endianess here. Might need to swap upper and | |
| 2992 // lower word. | |
| 2993 if (is_i64_as_two_params) { | |
| 2994 // Also store the upper half. | |
| 2995 param = Param(param_index++); | |
| 2996 StoreRepresentation store_rep(wasm::kWasmI32, | |
| 2997 WriteBarrierKind::kNoWriteBarrier); | 2999 WriteBarrierKind::kNoWriteBarrier); |
| 2998 *effect_ = | 3000 *effect_ = |
| 2999 graph()->NewNode(jsgraph()->machine()->Store(store_rep), arg_buffer, | 3001 graph()->NewNode(jsgraph()->machine()->Store(store_rep), arg_buffer, |
| 3000 Int32Constant(offset), param, *effect_, *control_); | 3002 Int32Constant(offset), param, *effect_, *control_); |
| 3001 offset += 1 << ElementSizeLog2Of(wasm::kWasmI32); | 3003 offset += RoundUpToMultipleOfPowOf2(1 << ElementSizeLog2Of(param_rep), 8); |
| 3002 } | 3004 } |
| 3003 | 3005 |
| 3004 DCHECK(IsAligned(offset, 8)); | 3006 DCHECK(IsAligned(offset, 8)); |
| 3005 } | 3007 } |
| 3006 DCHECK_EQ(param_count, param_index); | 3008 DCHECK_EQ(param_count, param_index); |
| 3007 DCHECK_EQ(args_size_bytes, offset); | 3009 DCHECK_EQ(args_size_bytes, offset); |
| 3008 | 3010 |
| 3009 // We are passing the raw arg_buffer here. To the GC and other parts, it looks | 3011 // We are passing the raw arg_buffer here. To the GC and other parts, it looks |
| 3010 // like a Smi (lowest bit not set). In the runtime function however, don't | 3012 // like a Smi (lowest bit not set). In the runtime function however, don't |
| 3011 // call Smi::value on it, but just cast it to a byte pointer. | 3013 // call Smi::value on it, but just cast it to a byte pointer. |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4163 function_->code_end_offset - function_->code_start_offset, | 4165 function_->code_end_offset - function_->code_start_offset, |
| 4164 codegen_ms); | 4166 codegen_ms); |
| 4165 } | 4167 } |
| 4166 | 4168 |
| 4167 return code; | 4169 return code; |
| 4168 } | 4170 } |
| 4169 | 4171 |
| 4170 } // namespace compiler | 4172 } // namespace compiler |
| 4171 } // namespace internal | 4173 } // namespace internal |
| 4172 } // namespace v8 | 4174 } // namespace v8 |
| OLD | NEW |