Chromium Code Reviews| Index: src/compiler/wasm-linkage.cc |
| diff --git a/src/compiler/wasm-linkage.cc b/src/compiler/wasm-linkage.cc |
| index 8be1cbf4e97ea7aeadee56ba87e1d4efc458bd2b..fa6e41f79c2252cf4fc3287bbc4e0eec54a2bf90 100644 |
| --- a/src/compiler/wasm-linkage.cc |
| +++ b/src/compiler/wasm-linkage.cc |
| @@ -307,26 +307,23 @@ CallDescriptor* ModuleEnv::GetWasmCallDescriptor(Zone* zone, |
| "wasm-call"); |
| } |
| -CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor( |
| - Zone* zone, CallDescriptor* descriptor) { |
| +CallDescriptor* GetI32WasmCallDescriptorWithReplacement( |
|
titzer
2016/10/12 19:06:55
The name is a bit weird now, since it is no longer
aseemgarg
2016/10/17 19:01:44
Done.
|
| + Zone* zone, CallDescriptor* descriptor, size_t num_replacements, |
| + MachineType type) { |
| size_t parameter_count = descriptor->ParameterCount(); |
| size_t return_count = descriptor->ReturnCount(); |
| for (size_t i = 0; i < descriptor->ParameterCount(); i++) { |
| - if (descriptor->GetParameterType(i) == MachineType::Int64()) { |
| - // For each int64 input we get two int32 inputs. |
| - parameter_count++; |
| + if (descriptor->GetParameterType(i) == type) { |
| + parameter_count += num_replacements - 1; |
| } |
| } |
| for (size_t i = 0; i < descriptor->ReturnCount(); i++) { |
| - if (descriptor->GetReturnType(i) == MachineType::Int64()) { |
| - // For each int64 return we get two int32 returns. |
| - return_count++; |
| + if (descriptor->GetReturnType(i) == type) { |
| + return_count += num_replacements - 1; |
| } |
| } |
| if (parameter_count == descriptor->ParameterCount() && |
| return_count == descriptor->ReturnCount()) { |
| - // If there is no int64 parameter or return value, we can just return the |
| - // original descriptor. |
| return descriptor; |
| } |
| @@ -335,10 +332,10 @@ CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor( |
| Allocator rets = return_registers.Get(); |
| for (size_t i = 0; i < descriptor->ReturnCount(); i++) { |
| - if (descriptor->GetReturnType(i) == MachineType::Int64()) { |
| - // For each int64 return we get two int32 returns. |
| - locations.AddReturn(rets.Next(MachineRepresentation::kWord32)); |
| - locations.AddReturn(rets.Next(MachineRepresentation::kWord32)); |
| + if (descriptor->GetReturnType(i) == type) { |
| + for (size_t j = 0; j < num_replacements; j++) { |
| + locations.AddReturn(rets.Next(MachineRepresentation::kWord32)); |
| + } |
| } else { |
| locations.AddReturn( |
| rets.Next(descriptor->GetReturnType(i).representation())); |
| @@ -348,10 +345,10 @@ CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor( |
| Allocator params = parameter_registers.Get(); |
| for (size_t i = 0; i < descriptor->ParameterCount(); i++) { |
| - if (descriptor->GetParameterType(i) == MachineType::Int64()) { |
| - // For each int64 input we get two int32 inputs. |
| - locations.AddParam(params.Next(MachineRepresentation::kWord32)); |
| - locations.AddParam(params.Next(MachineRepresentation::kWord32)); |
| + if (descriptor->GetParameterType(i) == type) { |
| + for (size_t j = 0; j < num_replacements; j++) { |
| + locations.AddParam(params.Next(MachineRepresentation::kWord32)); |
|
titzer
2016/10/12 19:06:55
kWord32 should be a parameter to this method now.
aseemgarg
2016/10/17 19:01:44
Done.
|
| + } |
| } else { |
| locations.AddParam( |
| params.Next(descriptor->GetParameterType(i).representation())); |
| @@ -369,8 +366,18 @@ CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor( |
| descriptor->CalleeSavedFPRegisters(), // callee-saved fp regs |
| descriptor->flags(), // flags |
| descriptor->debug_name()); |
| +} |
| - return descriptor; |
| +CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor( |
| + Zone* zone, CallDescriptor* descriptor) { |
| + return GetI32WasmCallDescriptorWithReplacement(zone, descriptor, 2, |
| + MachineType::Int64()); |
| +} |
| + |
| +CallDescriptor* ModuleEnv::GetI32WasmCallDescriptorForSimd( |
| + Zone* zone, CallDescriptor* descriptor) { |
| + return GetI32WasmCallDescriptorWithReplacement(zone, descriptor, 4, |
| + MachineType::Simd128()); |
| } |
| } // namespace wasm |