| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 case Runtime::kReThrow: | 169 case Runtime::kReThrow: |
| 170 case Runtime::kStringCompare: | 170 case Runtime::kStringCompare: |
| 171 case Runtime::kStringEquals: | 171 case Runtime::kStringEquals: |
| 172 case Runtime::kToFastProperties: // TODO(jarin): Is it safe? | 172 case Runtime::kToFastProperties: // TODO(jarin): Is it safe? |
| 173 case Runtime::kTraceEnter: | 173 case Runtime::kTraceEnter: |
| 174 case Runtime::kTraceExit: | 174 case Runtime::kTraceExit: |
| 175 return 0; | 175 return 0; |
| 176 case Runtime::kInlineArguments: | 176 case Runtime::kInlineArguments: |
| 177 case Runtime::kInlineArgumentsLength: | 177 case Runtime::kInlineArgumentsLength: |
| 178 case Runtime::kInlineDefaultConstructorCallSuper: | 178 case Runtime::kInlineDefaultConstructorCallSuper: |
| 179 case Runtime::kInlineGetCallerJSFunction: | |
| 180 case Runtime::kInlineGetPrototype: | 179 case Runtime::kInlineGetPrototype: |
| 181 case Runtime::kInlineRegExpExec: | 180 case Runtime::kInlineRegExpExec: |
| 182 case Runtime::kInlineSubString: | 181 case Runtime::kInlineSubString: |
| 183 case Runtime::kInlineToInteger: | 182 case Runtime::kInlineToInteger: |
| 184 case Runtime::kInlineToLength: | 183 case Runtime::kInlineToLength: |
| 185 case Runtime::kInlineToName: | 184 case Runtime::kInlineToName: |
| 186 case Runtime::kInlineToNumber: | 185 case Runtime::kInlineToNumber: |
| 187 case Runtime::kInlineToObject: | 186 case Runtime::kInlineToObject: |
| 188 case Runtime::kInlineToPrimitive_Number: | 187 case Runtime::kInlineToPrimitive_Number: |
| 189 case Runtime::kInlineToPrimitive_String: | 188 case Runtime::kInlineToPrimitive_String: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 214 } | 213 } |
| 215 for (size_t i = 0; i < ReturnCount(); ++i) { | 214 for (size_t i = 0; i < ReturnCount(); ++i) { |
| 216 if (!GetReturnLocation(i).IsRegister()) return false; | 215 if (!GetReturnLocation(i).IsRegister()) return false; |
| 217 } | 216 } |
| 218 return true; | 217 return true; |
| 219 } | 218 } |
| 220 | 219 |
| 221 | 220 |
| 222 CallDescriptor* Linkage::GetRuntimeCallDescriptor( | 221 CallDescriptor* Linkage::GetRuntimeCallDescriptor( |
| 223 Zone* zone, Runtime::FunctionId function_id, int js_parameter_count, | 222 Zone* zone, Runtime::FunctionId function_id, int js_parameter_count, |
| 224 Operator::Properties properties, bool needs_frame_state) { | 223 Operator::Properties properties, CallDescriptor::Flags flags) { |
| 225 const size_t function_count = 1; | 224 const size_t function_count = 1; |
| 226 const size_t num_args_count = 1; | 225 const size_t num_args_count = 1; |
| 227 const size_t context_count = 1; | 226 const size_t context_count = 1; |
| 228 const size_t parameter_count = function_count + | 227 const size_t parameter_count = function_count + |
| 229 static_cast<size_t>(js_parameter_count) + | 228 static_cast<size_t>(js_parameter_count) + |
| 230 num_args_count + context_count; | 229 num_args_count + context_count; |
| 231 | 230 |
| 232 const Runtime::Function* function = Runtime::FunctionForId(function_id); | 231 const Runtime::Function* function = Runtime::FunctionForId(function_id); |
| 233 const size_t return_count = static_cast<size_t>(function->result_size); | 232 const size_t return_count = static_cast<size_t>(function->result_size); |
| 234 | 233 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 257 types.AddParam(kMachAnyTagged); | 256 types.AddParam(kMachAnyTagged); |
| 258 | 257 |
| 259 // Add runtime call argument count. | 258 // Add runtime call argument count. |
| 260 locations.AddParam(regloc(kRuntimeCallArgCountRegister)); | 259 locations.AddParam(regloc(kRuntimeCallArgCountRegister)); |
| 261 types.AddParam(kMachPtr); | 260 types.AddParam(kMachPtr); |
| 262 | 261 |
| 263 // Add context. | 262 // Add context. |
| 264 locations.AddParam(regloc(kContextRegister)); | 263 locations.AddParam(regloc(kContextRegister)); |
| 265 types.AddParam(kMachAnyTagged); | 264 types.AddParam(kMachAnyTagged); |
| 266 | 265 |
| 267 CallDescriptor::Flags flags = | 266 if (Linkage::FrameStateInputCount(function_id) == 0) { |
| 268 needs_frame_state && (Linkage::FrameStateInputCount(function_id) > 0) | 267 flags = static_cast<CallDescriptor::Flags>( |
| 269 ? CallDescriptor::kNeedsFrameState | 268 flags & ~CallDescriptor::kNeedsFrameState); |
| 270 : CallDescriptor::kNoFlags; | 269 } |
| 271 | 270 |
| 272 // The target for runtime calls is a code object. | 271 // The target for runtime calls is a code object. |
| 273 MachineType target_type = kMachAnyTagged; | 272 MachineType target_type = kMachAnyTagged; |
| 274 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 273 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
| 275 return new (zone) CallDescriptor( // -- | 274 return new (zone) CallDescriptor( // -- |
| 276 CallDescriptor::kCallCodeObject, // kind | 275 CallDescriptor::kCallCodeObject, // kind |
| 277 target_type, // target MachineType | 276 target_type, // target MachineType |
| 278 target_loc, // target location | 277 target_loc, // target location |
| 279 types.Build(), // machine_sig | 278 types.Build(), // machine_sig |
| 280 locations.Build(), // location_sig | 279 locations.Build(), // location_sig |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } else { | 522 } else { |
| 524 DCHECK(loc == regloc(kContextRegister)); | 523 DCHECK(loc == regloc(kContextRegister)); |
| 525 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); | 524 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); |
| 526 } | 525 } |
| 527 } | 526 } |
| 528 | 527 |
| 529 | 528 |
| 530 } // namespace compiler | 529 } // namespace compiler |
| 531 } // namespace internal | 530 } // namespace internal |
| 532 } // namespace v8 | 531 } // namespace v8 |
| OLD | NEW |