| 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 #ifndef V8_COMPILER_LINKAGE_H_ | 5 #ifndef V8_COMPILER_LINKAGE_H_ |
| 6 #define V8_COMPILER_LINKAGE_H_ | 6 #define V8_COMPILER_LINKAGE_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
| 9 #include "src/compiler/frame.h" | 9 #include "src/compiler/frame.h" |
| 10 #include "src/compiler/machine-type.h" | 10 #include "src/compiler/machine-type.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 DCHECK(slot < 0); | 50 DCHECK(slot < 0); |
| 51 return LinkageLocation(STACK_SLOT, slot); | 51 return LinkageLocation(STACK_SLOT, slot); |
| 52 } | 52 } |
| 53 | 53 |
| 54 static LinkageLocation ForCalleeFrameSlot(int32_t slot) { | 54 static LinkageLocation ForCalleeFrameSlot(int32_t slot) { |
| 55 // TODO(titzer): bailout instead of crashing here. | 55 // TODO(titzer): bailout instead of crashing here. |
| 56 DCHECK(slot >= 0 && slot < LinkageLocation::MAX_STACK_SLOT); | 56 DCHECK(slot >= 0 && slot < LinkageLocation::MAX_STACK_SLOT); |
| 57 return LinkageLocation(STACK_SLOT, slot); | 57 return LinkageLocation(STACK_SLOT, slot); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static LinkageLocation ForSavedCallerReturnAddress() { |
| 61 return ForCalleeFrameSlot((StandardFrameConstants::kCallerPCOffset - |
| 62 StandardFrameConstants::kCallerPCOffset) / |
| 63 kPointerSize); |
| 64 } |
| 65 |
| 66 static LinkageLocation ForSavedCallerFramePtr() { |
| 67 return ForCalleeFrameSlot((StandardFrameConstants::kCallerPCOffset - |
| 68 StandardFrameConstants::kCallerFPOffset) / |
| 69 kPointerSize); |
| 70 } |
| 71 |
| 72 static LinkageLocation ForSavedCallerConstantPool() { |
| 73 DCHECK(V8_EMBEDDED_CONSTANT_POOL); |
| 74 return ForCalleeFrameSlot((StandardFrameConstants::kCallerPCOffset - |
| 75 StandardFrameConstants::kConstantPoolOffset) / |
| 76 kPointerSize); |
| 77 } |
| 78 |
| 60 static LinkageLocation ConvertToTailCallerLocation( | 79 static LinkageLocation ConvertToTailCallerLocation( |
| 61 LinkageLocation caller_location, int stack_param_delta) { | 80 LinkageLocation caller_location, int stack_param_delta) { |
| 62 if (!caller_location.IsRegister()) { | 81 if (!caller_location.IsRegister()) { |
| 63 return LinkageLocation(STACK_SLOT, | 82 return LinkageLocation(STACK_SLOT, |
| 64 caller_location.GetLocation() + stack_param_delta); | 83 caller_location.GetLocation() - stack_param_delta); |
| 65 } | 84 } |
| 66 return caller_location; | 85 return caller_location; |
| 67 } | 86 } |
| 68 | 87 |
| 69 private: | 88 private: |
| 70 friend class CallDescriptor; | 89 friend class CallDescriptor; |
| 71 friend class OperandGenerator; | 90 friend class OperandGenerator; |
| 72 | 91 |
| 73 enum LocationType { REGISTER, STACK_SLOT }; | 92 enum LocationType { REGISTER, STACK_SLOT }; |
| 74 | 93 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 CallDescriptor* const incoming_; | 378 CallDescriptor* const incoming_; |
| 360 | 379 |
| 361 DISALLOW_COPY_AND_ASSIGN(Linkage); | 380 DISALLOW_COPY_AND_ASSIGN(Linkage); |
| 362 }; | 381 }; |
| 363 | 382 |
| 364 } // namespace compiler | 383 } // namespace compiler |
| 365 } // namespace internal | 384 } // namespace internal |
| 366 } // namespace v8 | 385 } // namespace v8 |
| 367 | 386 |
| 368 #endif // V8_COMPILER_LINKAGE_H_ | 387 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |