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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (ReturnCount() != other->ReturnCount()) return false; | 81 if (ReturnCount() != other->ReturnCount()) return false; |
82 for (size_t i = 0; i < ReturnCount(); ++i) { | 82 for (size_t i = 0; i < ReturnCount(); ++i) { |
83 if (GetReturnLocation(i) != other->GetReturnLocation(i)) return false; | 83 if (GetReturnLocation(i) != other->GetReturnLocation(i)) return false; |
84 } | 84 } |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 bool CallDescriptor::CanTailCall(const Node* node, | 89 bool CallDescriptor::CanTailCall(const Node* node, |
90 int* stack_param_delta) const { | 90 int* stack_param_delta) const { |
91 CallDescriptor const* other = OpParameter<CallDescriptor const*>(node); | 91 CallDescriptor const* other = CallDescriptorOf(node->op()); |
92 size_t current_input = 0; | 92 size_t current_input = 0; |
93 size_t other_input = 0; | 93 size_t other_input = 0; |
94 *stack_param_delta = 0; | 94 *stack_param_delta = 0; |
95 bool more_other = true; | 95 bool more_other = true; |
96 bool more_this = true; | 96 bool more_this = true; |
97 while (more_other || more_this) { | 97 while (more_other || more_this) { |
98 if (other_input < other->InputCount()) { | 98 if (other_input < other->InputCount()) { |
99 if (!other->GetInputLocation(other_input).IsRegister()) { | 99 if (!other->GetInputLocation(other_input).IsRegister()) { |
100 (*stack_param_delta)--; | 100 (*stack_param_delta)--; |
101 } | 101 } |
102 } else { | 102 } else { |
103 more_other = false; | 103 more_other = false; |
104 } | 104 } |
105 if (current_input < InputCount()) { | 105 if (current_input < InputCount()) { |
106 if (!GetInputLocation(current_input).IsRegister()) { | 106 if (!GetInputLocation(current_input).IsRegister()) { |
107 (*stack_param_delta)++; | 107 (*stack_param_delta)++; |
108 } | 108 } |
109 } else { | 109 } else { |
110 more_this = false; | 110 more_this = false; |
111 } | 111 } |
112 ++current_input; | 112 ++current_input; |
113 ++other_input; | 113 ++other_input; |
114 } | 114 } |
115 return HasSameReturnLocationsAs(OpParameter<CallDescriptor const*>(node)); | 115 return HasSameReturnLocationsAs(CallDescriptorOf(node->op())); |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) { | 119 CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) { |
120 DCHECK(!info->IsStub()); | 120 DCHECK(!info->IsStub()); |
121 if (!info->closure().is_null()) { | 121 if (!info->closure().is_null()) { |
122 // If we are compiling a JS function, use a JS call descriptor, | 122 // If we are compiling a JS function, use a JS call descriptor, |
123 // plus the receiver. | 123 // plus the receiver. |
124 SharedFunctionInfo* shared = info->closure()->shared(); | 124 SharedFunctionInfo* shared = info->closure()->shared(); |
125 return GetJSCallDescriptor(zone, info->is_osr(), | 125 return GetJSCallDescriptor(zone, info->is_osr(), |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } else { | 488 } else { |
489 DCHECK(loc == regloc(kContextRegister)); | 489 DCHECK(loc == regloc(kContextRegister)); |
490 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); | 490 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
494 | 494 |
495 } // namespace compiler | 495 } // namespace compiler |
496 } // namespace internal | 496 } // namespace internal |
497 } // namespace v8 | 497 } // namespace v8 |
OLD | NEW |