OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/frame.h" | 9 #include "src/compiler/frame.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 types.AddParam(MachineType::Int32()); | 312 types.AddParam(MachineType::Int32()); |
313 | 313 |
314 // Add context. | 314 // Add context. |
315 locations.AddParam(regloc(kContextRegister)); | 315 locations.AddParam(regloc(kContextRegister)); |
316 types.AddParam(MachineType::AnyTagged()); | 316 types.AddParam(MachineType::AnyTagged()); |
317 | 317 |
318 // The target for JS function calls is the JSFunction object. | 318 // The target for JS function calls is the JSFunction object. |
319 MachineType target_type = MachineType::AnyTagged(); | 319 MachineType target_type = MachineType::AnyTagged(); |
320 // When entering into an OSR function from unoptimized code the JSFunction | 320 // When entering into an OSR function from unoptimized code the JSFunction |
321 // is not in a register, but it is on the stack in the marker spill slot. | 321 // is not in a register, but it is on the stack in the marker spill slot. |
322 LinkageLocation target_loc = is_osr ? LinkageLocation::ForSavedCallerMarker() | 322 LinkageLocation target_loc = is_osr |
323 : regloc(kJSFunctionRegister); | 323 ? LinkageLocation::ForSavedCallerFunction() |
324 return new (zone) CallDescriptor( // -- | 324 : regloc(kJSFunctionRegister); |
325 CallDescriptor::kCallJSFunction, // kind | 325 return new (zone) CallDescriptor( // -- |
326 target_type, // target MachineType | 326 CallDescriptor::kCallJSFunction, // kind |
327 target_loc, // target location | 327 target_type, // target MachineType |
328 types.Build(), // machine_sig | 328 target_loc, // target location |
329 locations.Build(), // location_sig | 329 types.Build(), // machine_sig |
330 js_parameter_count, // stack_parameter_count | 330 locations.Build(), // location_sig |
331 Operator::kNoProperties, // properties | 331 js_parameter_count, // stack_parameter_count |
332 kNoCalleeSaved, // callee-saved | 332 Operator::kNoProperties, // properties |
333 kNoCalleeSaved, // callee-saved fp | 333 kNoCalleeSaved, // callee-saved |
334 CallDescriptor::kCanUseRoots | // flags | 334 kNoCalleeSaved, // callee-saved fp |
335 flags, // flags | 335 CallDescriptor::kCanUseRoots | // flags |
336 CallDescriptor::kHasStandardFrameHeader | // flags | |
337 flags, // flags | |
336 "js-call"); | 338 "js-call"); |
337 } | 339 } |
338 | 340 |
339 // TODO(all): Add support for return representations/locations to | 341 // TODO(all): Add support for return representations/locations to |
340 // CallInterfaceDescriptor. | 342 // CallInterfaceDescriptor. |
341 // TODO(turbofan): cache call descriptors for code stub calls. | 343 // TODO(turbofan): cache call descriptors for code stub calls. |
342 CallDescriptor* Linkage::GetStubCallDescriptor( | 344 CallDescriptor* Linkage::GetStubCallDescriptor( |
343 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, | 345 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
344 int stack_parameter_count, CallDescriptor::Flags flags, | 346 int stack_parameter_count, CallDescriptor::Flags flags, |
345 Operator::Properties properties, MachineType return_type, | 347 Operator::Properties properties, MachineType return_type, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 return LinkageLocation::ForCalleeFrameSlot(spill_index); | 426 return LinkageLocation::ForCalleeFrameSlot(spill_index); |
425 } else { | 427 } else { |
426 // Parameter. Use the assigned location from the incoming call descriptor. | 428 // Parameter. Use the assigned location from the incoming call descriptor. |
427 int parameter_index = 1 + index; // skip index 0, which is the target. | 429 int parameter_index = 1 + index; // skip index 0, which is the target. |
428 return incoming_->GetInputLocation(parameter_index); | 430 return incoming_->GetInputLocation(parameter_index); |
429 } | 431 } |
430 } | 432 } |
431 | 433 |
432 | 434 |
433 bool Linkage::ParameterHasSecondaryLocation(int index) const { | 435 bool Linkage::ParameterHasSecondaryLocation(int index) const { |
436 if ((incoming_->flags() & CallDescriptor::kHasStandardFrameHeader) == 0) { | |
Benedikt Meurer
2016/02/22 18:16:38
Nit: For "flags" I'd prefer to not use explicit co
danno
2016/03/07 09:33:38
Done.
| |
437 return false; | |
438 } | |
434 if (incoming_->kind() != CallDescriptor::kCallJSFunction) return false; | 439 if (incoming_->kind() != CallDescriptor::kCallJSFunction) return false; |
435 LinkageLocation loc = GetParameterLocation(index); | 440 LinkageLocation loc = GetParameterLocation(index); |
436 return (loc == regloc(kJSFunctionRegister) || | 441 return (loc == regloc(kJSFunctionRegister) || |
437 loc == regloc(kContextRegister)); | 442 loc == regloc(kContextRegister)); |
438 } | 443 } |
439 | 444 |
440 LinkageLocation Linkage::GetParameterSecondaryLocation(int index) const { | 445 LinkageLocation Linkage::GetParameterSecondaryLocation(int index) const { |
441 DCHECK(ParameterHasSecondaryLocation(index)); | 446 DCHECK(ParameterHasSecondaryLocation(index)); |
442 LinkageLocation loc = GetParameterLocation(index); | 447 LinkageLocation loc = GetParameterLocation(index); |
443 | 448 |
444 if (loc == regloc(kJSFunctionRegister)) { | 449 if (loc == regloc(kJSFunctionRegister)) { |
445 return LinkageLocation::ForCalleeFrameSlot(Frame::kJSFunctionSlot); | 450 return LinkageLocation::ForCalleeFrameSlot(Frame::kJSFunctionSlot); |
446 } else { | 451 } else { |
447 DCHECK(loc == regloc(kContextRegister)); | 452 DCHECK(loc == regloc(kContextRegister)); |
448 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); | 453 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); |
449 } | 454 } |
450 } | 455 } |
451 | 456 |
452 | 457 |
453 } // namespace compiler | 458 } // namespace compiler |
454 } // namespace internal | 459 } // namespace internal |
455 } // namespace v8 | 460 } // namespace v8 |
OLD | NEW |