| 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/assembler.h" | 5 #include "src/assembler.h" |
| 6 #include "src/macro-assembler.h" | 6 #include "src/macro-assembler.h" |
| 7 | 7 |
| 8 #include "src/wasm/wasm-module.h" | 8 #include "src/wasm/wasm-module.h" |
| 9 | 9 |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 static const int kFPParamRegistersCount = 0; | 251 static const int kFPParamRegistersCount = 0; |
| 252 #endif | 252 #endif |
| 253 | 253 |
| 254 Allocator params(kGPParamRegisters, kGPParamRegistersCount, kFPParamRegisters, | 254 Allocator params(kGPParamRegisters, kGPParamRegistersCount, kFPParamRegisters, |
| 255 kFPParamRegistersCount); | 255 kFPParamRegistersCount); |
| 256 | 256 |
| 257 return params; | 257 return params; |
| 258 } | 258 } |
| 259 | 259 |
| 260 // General code uses the above configuration data. | 260 // General code uses the above configuration data. |
| 261 CallDescriptor* ModuleEnv::GetWasmCallDescriptor(Zone* zone, | 261 CallDescriptor* ModuleEnv::GetWasmCallDescriptor(Zone* zone, FunctionSig* fsig, |
| 262 FunctionSig* fsig) { | 262 bool internal) { |
| 263 MachineSignature::Builder msig(zone, fsig->return_count(), | 263 MachineSignature::Builder msig(zone, fsig->return_count(), |
| 264 fsig->parameter_count()); | 264 fsig->parameter_count()); |
| 265 LocationSignature::Builder locations(zone, fsig->return_count(), | 265 LocationSignature::Builder locations(zone, fsig->return_count(), |
| 266 fsig->parameter_count()); | 266 fsig->parameter_count()); |
| 267 | 267 |
| 268 Allocator rets = GetReturnRegisters(); | 268 Allocator rets = GetReturnRegisters(); |
| 269 | 269 |
| 270 // Add return location(s). | 270 // Add return location(s). |
| 271 const int return_count = static_cast<int>(locations.return_count_); | 271 const int return_count = static_cast<int>(locations.return_count_); |
| 272 for (int i = 0; i < return_count; i++) { | 272 for (int i = 0; i < return_count; i++) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 285 locations.AddParam(params.Next(param)); | 285 locations.AddParam(params.Next(param)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 const RegList kCalleeSaveRegisters = 0; | 288 const RegList kCalleeSaveRegisters = 0; |
| 289 const RegList kCalleeSaveFPRegisters = 0; | 289 const RegList kCalleeSaveFPRegisters = 0; |
| 290 | 290 |
| 291 // The target for WASM calls is always a code object. | 291 // The target for WASM calls is always a code object. |
| 292 MachineType target_type = MachineType::AnyTagged(); | 292 MachineType target_type = MachineType::AnyTagged(); |
| 293 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 293 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
| 294 | 294 |
| 295 return new (zone) CallDescriptor( // -- | 295 return new (zone) CallDescriptor( // -- |
| 296 CallDescriptor::kCallCodeObject, // kind | 296 internal ? CallDescriptor::kCallWasmFunction |
| 297 target_type, // target MachineType | 297 : CallDescriptor::kCallCodeObject, // kind |
| 298 target_loc, // target location | 298 target_type, // target MachineType |
| 299 msig.Build(), // machine_sig | 299 target_loc, // target location |
| 300 locations.Build(), // location_sig | 300 msig.Build(), // machine_sig |
| 301 params.stack_offset, // stack_parameter_count | 301 locations.Build(), // location_sig |
| 302 compiler::Operator::kNoProperties, // properties | 302 params.stack_offset, // stack_parameter_count |
| 303 kCalleeSaveRegisters, // callee-saved registers | 303 compiler::Operator::kNoProperties, // properties |
| 304 kCalleeSaveFPRegisters, // callee-saved fp regs | 304 kCalleeSaveRegisters, // callee-saved registers |
| 305 CallDescriptor::kUseNativeStack, // flags | 305 kCalleeSaveFPRegisters, // callee-saved fp regs |
| 306 CallDescriptor::kUseNativeStack, // flags |
| 306 "wasm-call"); | 307 "wasm-call"); |
| 307 } | 308 } |
| 308 | 309 |
| 309 CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor( | 310 CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor( |
| 310 Zone* zone, CallDescriptor* descriptor) { | 311 Zone* zone, CallDescriptor* descriptor) { |
| 311 const MachineSignature* signature = descriptor->GetMachineSignature(); | 312 const MachineSignature* signature = descriptor->GetMachineSignature(); |
| 312 size_t parameter_count = signature->parameter_count(); | 313 size_t parameter_count = signature->parameter_count(); |
| 313 size_t return_count = signature->return_count(); | 314 size_t return_count = signature->return_count(); |
| 314 for (size_t i = 0; i < signature->parameter_count(); i++) { | 315 for (size_t i = 0; i < signature->parameter_count(); i++) { |
| 315 if (signature->GetParam(i) == MachineType::Int64()) { | 316 if (signature->GetParam(i) == MachineType::Int64()) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 descriptor->CalleeSavedFPRegisters(), // callee-saved fp regs | 376 descriptor->CalleeSavedFPRegisters(), // callee-saved fp regs |
| 376 descriptor->flags(), // flags | 377 descriptor->flags(), // flags |
| 377 descriptor->debug_name()); | 378 descriptor->debug_name()); |
| 378 | 379 |
| 379 return descriptor; | 380 return descriptor; |
| 380 } | 381 } |
| 381 | 382 |
| 382 } // namespace wasm | 383 } // namespace wasm |
| 383 } // namespace internal | 384 } // namespace internal |
| 384 } // namespace v8 | 385 } // namespace v8 |
| OLD | NEW |