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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(), |
126 1 + shared->internal_formal_parameter_count(), | 126 1 + shared->internal_formal_parameter_count(), |
127 CallDescriptor::kNoFlags); | 127 CallDescriptor::kNoFlags); |
128 } | 128 } |
129 return nullptr; // TODO(titzer): ? | 129 return nullptr; // TODO(titzer): ? |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 // static | 133 // static |
134 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { | 134 bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) { |
135 // Most runtime functions need a FrameState. A few chosen ones that we know | 135 // Most runtime functions need a FrameState. A few chosen ones that we know |
136 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize | 136 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize |
137 // are blacklisted here and can be called without a FrameState. | 137 // are blacklisted here and can be called without a FrameState. |
138 switch (function) { | 138 switch (function) { |
139 case Runtime::kAbort: | 139 case Runtime::kAbort: |
140 case Runtime::kAllocateInTargetSpace: | 140 case Runtime::kAllocateInTargetSpace: |
141 case Runtime::kCreateIterResultObject: | 141 case Runtime::kCreateIterResultObject: |
142 case Runtime::kDefineDataPropertyInLiteral: | 142 case Runtime::kDefineDataPropertyInLiteral: |
143 case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe? | 143 case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe? |
144 case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe? | 144 case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe? |
(...skipping 11 matching lines...) Expand all Loading... |
156 case Runtime::kStringCompare: | 156 case Runtime::kStringCompare: |
157 case Runtime::kStringEqual: | 157 case Runtime::kStringEqual: |
158 case Runtime::kStringNotEqual: | 158 case Runtime::kStringNotEqual: |
159 case Runtime::kStringLessThan: | 159 case Runtime::kStringLessThan: |
160 case Runtime::kStringLessThanOrEqual: | 160 case Runtime::kStringLessThanOrEqual: |
161 case Runtime::kStringGreaterThan: | 161 case Runtime::kStringGreaterThan: |
162 case Runtime::kStringGreaterThanOrEqual: | 162 case Runtime::kStringGreaterThanOrEqual: |
163 case Runtime::kToFastProperties: // TODO(conradw): Is it safe? | 163 case Runtime::kToFastProperties: // TODO(conradw): Is it safe? |
164 case Runtime::kTraceEnter: | 164 case Runtime::kTraceEnter: |
165 case Runtime::kTraceExit: | 165 case Runtime::kTraceExit: |
166 return 0; | 166 return false; |
167 case Runtime::kInlineCall: | 167 case Runtime::kInlineCall: |
| 168 case Runtime::kInlineDeoptimizeNow: |
168 case Runtime::kInlineGetPrototype: | 169 case Runtime::kInlineGetPrototype: |
169 case Runtime::kInlineNewObject: | 170 case Runtime::kInlineNewObject: |
170 case Runtime::kInlineRegExpConstructResult: | 171 case Runtime::kInlineRegExpConstructResult: |
171 case Runtime::kInlineRegExpExec: | 172 case Runtime::kInlineRegExpExec: |
172 case Runtime::kInlineSubString: | 173 case Runtime::kInlineSubString: |
| 174 case Runtime::kInlineThrowNotDateError: |
173 case Runtime::kInlineToInteger: | 175 case Runtime::kInlineToInteger: |
174 case Runtime::kInlineToLength: | 176 case Runtime::kInlineToLength: |
175 case Runtime::kInlineToName: | 177 case Runtime::kInlineToName: |
176 case Runtime::kInlineToNumber: | 178 case Runtime::kInlineToNumber: |
177 case Runtime::kInlineToObject: | 179 case Runtime::kInlineToObject: |
178 case Runtime::kInlineToPrimitive: | 180 case Runtime::kInlineToPrimitive: |
179 case Runtime::kInlineToPrimitive_Number: | 181 case Runtime::kInlineToPrimitive_Number: |
180 case Runtime::kInlineToPrimitive_String: | 182 case Runtime::kInlineToPrimitive_String: |
181 case Runtime::kInlineToString: | 183 case Runtime::kInlineToString: |
182 return 1; | 184 return true; |
183 case Runtime::kInlineDeoptimizeNow: | |
184 case Runtime::kInlineThrowNotDateError: | |
185 return 2; | |
186 default: | 185 default: |
187 break; | 186 break; |
188 } | 187 } |
189 | 188 |
190 // Most inlined runtime functions (except the ones listed above) can be called | 189 // Most inlined runtime functions (except the ones listed above) can be called |
191 // without a FrameState or will be lowered by JSIntrinsicLowering internally. | 190 // without a FrameState or will be lowered by JSIntrinsicLowering internally. |
192 const Runtime::Function* const f = Runtime::FunctionForId(function); | 191 const Runtime::Function* const f = Runtime::FunctionForId(function); |
193 if (f->intrinsic_type == Runtime::IntrinsicType::INLINE) return 0; | 192 if (f->intrinsic_type == Runtime::IntrinsicType::INLINE) return false; |
194 | 193 |
195 return 1; | 194 return true; |
196 } | 195 } |
197 | 196 |
198 | 197 |
199 bool CallDescriptor::UsesOnlyRegisters() const { | 198 bool CallDescriptor::UsesOnlyRegisters() const { |
200 for (size_t i = 0; i < InputCount(); ++i) { | 199 for (size_t i = 0; i < InputCount(); ++i) { |
201 if (!GetInputLocation(i).IsRegister()) return false; | 200 if (!GetInputLocation(i).IsRegister()) return false; |
202 } | 201 } |
203 for (size_t i = 0; i < ReturnCount(); ++i) { | 202 for (size_t i = 0; i < ReturnCount(); ++i) { |
204 if (!GetReturnLocation(i).IsRegister()) return false; | 203 if (!GetReturnLocation(i).IsRegister()) return false; |
205 } | 204 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 types.AddParam(MachineType::AnyTagged()); | 247 types.AddParam(MachineType::AnyTagged()); |
249 | 248 |
250 // Add runtime call argument count. | 249 // Add runtime call argument count. |
251 locations.AddParam(regloc(kRuntimeCallArgCountRegister)); | 250 locations.AddParam(regloc(kRuntimeCallArgCountRegister)); |
252 types.AddParam(MachineType::Pointer()); | 251 types.AddParam(MachineType::Pointer()); |
253 | 252 |
254 // Add context. | 253 // Add context. |
255 locations.AddParam(regloc(kContextRegister)); | 254 locations.AddParam(regloc(kContextRegister)); |
256 types.AddParam(MachineType::AnyTagged()); | 255 types.AddParam(MachineType::AnyTagged()); |
257 | 256 |
258 if (Linkage::FrameStateInputCount(function_id) == 0) { | 257 if (!Linkage::NeedsFrameStateInput(function_id)) { |
259 flags = static_cast<CallDescriptor::Flags>( | 258 flags = static_cast<CallDescriptor::Flags>( |
260 flags & ~CallDescriptor::kNeedsFrameState); | 259 flags & ~CallDescriptor::kNeedsFrameState); |
261 } | 260 } |
262 | 261 |
263 // The target for runtime calls is a code object. | 262 // The target for runtime calls is a code object. |
264 MachineType target_type = MachineType::AnyTagged(); | 263 MachineType target_type = MachineType::AnyTagged(); |
265 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 264 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
266 return new (zone) CallDescriptor( // -- | 265 return new (zone) CallDescriptor( // -- |
267 CallDescriptor::kCallCodeObject, // kind | 266 CallDescriptor::kCallCodeObject, // kind |
268 target_type, // target MachineType | 267 target_type, // target MachineType |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } else { | 518 } else { |
520 DCHECK(loc == regloc(kContextRegister)); | 519 DCHECK(loc == regloc(kContextRegister)); |
521 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); | 520 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); |
522 } | 521 } |
523 } | 522 } |
524 | 523 |
525 | 524 |
526 } // namespace compiler | 525 } // namespace compiler |
527 } // namespace internal | 526 } // namespace internal |
528 } // namespace v8 | 527 } // namespace v8 |
OLD | NEW |