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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler.h" | 6 #include "src/compiler.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() | 35 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() |
36 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" | 36 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" |
37 << d.FrameStateCount(); | 37 << d.FrameStateCount(); |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) { | 41 CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) { |
42 if (info->function() != NULL) { | 42 if (info->function() != NULL) { |
43 // If we already have the function literal, use the number of parameters | 43 // If we already have the function literal, use the number of parameters |
44 // plus the receiver. | 44 // plus the receiver. |
45 return GetJSCallDescriptor(1 + info->function()->parameter_count(), zone, | 45 return GetJSCallDescriptor(zone, 1 + info->function()->parameter_count(), |
46 CallDescriptor::kNoFlags); | 46 CallDescriptor::kNoFlags); |
47 } | 47 } |
48 if (!info->closure().is_null()) { | 48 if (!info->closure().is_null()) { |
49 // If we are compiling a JS function, use a JS call descriptor, | 49 // If we are compiling a JS function, use a JS call descriptor, |
50 // plus the receiver. | 50 // plus the receiver. |
51 SharedFunctionInfo* shared = info->closure()->shared(); | 51 SharedFunctionInfo* shared = info->closure()->shared(); |
52 return GetJSCallDescriptor(1 + shared->formal_parameter_count(), zone, | 52 return GetJSCallDescriptor(zone, 1 + shared->formal_parameter_count(), |
53 CallDescriptor::kNoFlags); | 53 CallDescriptor::kNoFlags); |
54 } | 54 } |
55 if (info->code_stub() != NULL) { | 55 if (info->code_stub() != NULL) { |
56 // Use the code stub interface descriptor. | 56 // Use the code stub interface descriptor. |
57 CallInterfaceDescriptor descriptor = | 57 CallInterfaceDescriptor descriptor = |
58 info->code_stub()->GetCallInterfaceDescriptor(); | 58 info->code_stub()->GetCallInterfaceDescriptor(); |
59 return GetStubCallDescriptor(descriptor, 0, CallDescriptor::kNoFlags, | 59 return GetStubCallDescriptor(info->isolate(), zone, descriptor, 0, |
60 Operator::kNoProperties, zone); | 60 CallDescriptor::kNoFlags, |
| 61 Operator::kNoProperties); |
61 } | 62 } |
62 return NULL; // TODO(titzer): ? | 63 return NULL; // TODO(titzer): ? |
63 } | 64 } |
64 | 65 |
65 | 66 |
66 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, | 67 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, |
67 int extra) const { | 68 int extra) const { |
68 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || | 69 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || |
69 incoming_->kind() == CallDescriptor::kCallAddress) { | 70 incoming_->kind() == CallDescriptor::kCallAddress) { |
70 int offset; | 71 int offset; |
(...skipping 15 matching lines...) Expand all Loading... |
86 int register_save_area_size = frame->GetRegisterSaveAreaSize(); | 87 int register_save_area_size = frame->GetRegisterSaveAreaSize(); |
87 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + | 88 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + |
88 kPCOnStackSize + extra; | 89 kPCOnStackSize + extra; |
89 return FrameOffset::FromStackPointer(offset); | 90 return FrameOffset::FromStackPointer(offset); |
90 } | 91 } |
91 } | 92 } |
92 | 93 |
93 | 94 |
94 CallDescriptor* Linkage::GetJSCallDescriptor( | 95 CallDescriptor* Linkage::GetJSCallDescriptor( |
95 int parameter_count, CallDescriptor::Flags flags) const { | 96 int parameter_count, CallDescriptor::Flags flags) const { |
96 return GetJSCallDescriptor(parameter_count, zone_, flags); | 97 return GetJSCallDescriptor(zone_, parameter_count, flags); |
97 } | 98 } |
98 | 99 |
99 | 100 |
100 CallDescriptor* Linkage::GetRuntimeCallDescriptor( | 101 CallDescriptor* Linkage::GetRuntimeCallDescriptor( |
101 Runtime::FunctionId function, int parameter_count, | 102 Runtime::FunctionId function, int parameter_count, |
102 Operator::Properties properties) const { | 103 Operator::Properties properties) const { |
103 return GetRuntimeCallDescriptor(function, parameter_count, properties, zone_); | 104 return GetRuntimeCallDescriptor(zone_, function, parameter_count, properties); |
104 } | 105 } |
105 | 106 |
106 | 107 |
107 CallDescriptor* Linkage::GetStubCallDescriptor( | 108 CallDescriptor* Linkage::GetStubCallDescriptor( |
108 const CallInterfaceDescriptor& descriptor, int stack_parameter_count, | 109 const CallInterfaceDescriptor& descriptor, int stack_parameter_count, |
109 CallDescriptor::Flags flags, Operator::Properties properties) const { | 110 CallDescriptor::Flags flags, Operator::Properties properties) const { |
110 return GetStubCallDescriptor(descriptor, stack_parameter_count, flags, | 111 return GetStubCallDescriptor(isolate_, zone_, descriptor, |
111 properties, zone_); | 112 stack_parameter_count, flags, properties); |
112 } | 113 } |
113 | 114 |
114 | 115 |
115 // static | 116 // static |
116 bool Linkage::NeedsFrameState(Runtime::FunctionId function) { | 117 bool Linkage::NeedsFrameState(Runtime::FunctionId function) { |
117 if (!FLAG_turbo_deoptimization) { | 118 if (!FLAG_turbo_deoptimization) { |
118 return false; | 119 return false; |
119 } | 120 } |
120 // TODO(jarin) At the moment, we only add frame state for | 121 // TODO(jarin) At the moment, we only add frame state for |
121 // few chosen runtime functions. | 122 // few chosen runtime functions. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 default: | 224 default: |
224 return false; | 225 return false; |
225 } | 226 } |
226 } | 227 } |
227 | 228 |
228 | 229 |
229 //============================================================================== | 230 //============================================================================== |
230 // Provide unimplemented methods on unsupported architectures, to at least link. | 231 // Provide unimplemented methods on unsupported architectures, to at least link. |
231 //============================================================================== | 232 //============================================================================== |
232 #if !V8_TURBOFAN_BACKEND | 233 #if !V8_TURBOFAN_BACKEND |
233 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone, | 234 CallDescriptor* Linkage::GetJSCallDescriptor(Isolate* isolate, Zone* zone, |
| 235 int parameter_count, |
234 CallDescriptor::Flags flags) { | 236 CallDescriptor::Flags flags) { |
235 UNIMPLEMENTED(); | 237 UNIMPLEMENTED(); |
236 return NULL; | 238 return NULL; |
237 } | 239 } |
238 | 240 |
239 | 241 |
240 LinkageLocation Linkage::GetOsrValueLocation(int index) const { | 242 LinkageLocation Linkage::GetOsrValueLocation(int index) const { |
241 UNIMPLEMENTED(); | 243 UNIMPLEMENTED(); |
242 return LinkageLocation(-1); // Dummy value | 244 return LinkageLocation(-1); // Dummy value |
243 } | 245 } |
(...skipping 18 matching lines...) Expand all Loading... |
262 | 264 |
263 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone, | 265 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone, |
264 MachineSignature* sig) { | 266 MachineSignature* sig) { |
265 UNIMPLEMENTED(); | 267 UNIMPLEMENTED(); |
266 return NULL; | 268 return NULL; |
267 } | 269 } |
268 #endif // !V8_TURBOFAN_BACKEND | 270 #endif // !V8_TURBOFAN_BACKEND |
269 } | 271 } |
270 } | 272 } |
271 } // namespace v8::internal::compiler | 273 } // namespace v8::internal::compiler |
OLD | NEW |