| 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/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/frame.h" | 8 #include "src/compiler/frame.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // plus the receiver. | 140 // plus the receiver. |
| 141 SharedFunctionInfo* shared = info->closure()->shared(); | 141 SharedFunctionInfo* shared = info->closure()->shared(); |
| 142 return GetJSCallDescriptor(zone, info->is_osr(), | 142 return GetJSCallDescriptor(zone, info->is_osr(), |
| 143 1 + shared->internal_formal_parameter_count(), | 143 1 + shared->internal_formal_parameter_count(), |
| 144 CallDescriptor::kNoFlags); | 144 CallDescriptor::kNoFlags); |
| 145 } | 145 } |
| 146 return NULL; // TODO(titzer): ? | 146 return NULL; // TODO(titzer): ? |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame) const { | |
| 151 bool has_frame = frame->GetSpillSlotCount() > 0 || | |
| 152 incoming_->IsJSFunctionCall() || | |
| 153 incoming_->kind() == CallDescriptor::kCallAddress; | |
| 154 const int offset = | |
| 155 (StandardFrameConstants::kFixedSlotCountAboveFp - spill_slot - 1) * | |
| 156 kPointerSize; | |
| 157 if (has_frame) { | |
| 158 return FrameOffset::FromFramePointer(offset); | |
| 159 } else { | |
| 160 // No frame. Retrieve all parameters relative to stack pointer. | |
| 161 DCHECK(spill_slot < 0); // Must be a parameter. | |
| 162 int sp_offset = offset + (frame->GetSpToFpSlotCount() * kPointerSize); | |
| 163 return FrameOffset::FromStackPointer(sp_offset); | |
| 164 } | |
| 165 } | |
| 166 | |
| 167 | |
| 168 // static | 150 // static |
| 169 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { | 151 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { |
| 170 // Most runtime functions need a FrameState. A few chosen ones that we know | 152 // Most runtime functions need a FrameState. A few chosen ones that we know |
| 171 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize | 153 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize |
| 172 // are blacklisted here and can be called without a FrameState. | 154 // are blacklisted here and can be called without a FrameState. |
| 173 switch (function) { | 155 switch (function) { |
| 174 case Runtime::kAllocateInTargetSpace: | 156 case Runtime::kAllocateInTargetSpace: |
| 175 case Runtime::kDateField: | 157 case Runtime::kDateField: |
| 176 case Runtime::kDefineClassMethod: // TODO(jarin): Is it safe? | 158 case Runtime::kDefineClassMethod: // TODO(jarin): Is it safe? |
| 177 case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe? | 159 case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe? |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } else { | 524 } else { |
| 543 DCHECK(loc == regloc(kContextRegister)); | 525 DCHECK(loc == regloc(kContextRegister)); |
| 544 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); | 526 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); |
| 545 } | 527 } |
| 546 } | 528 } |
| 547 | 529 |
| 548 | 530 |
| 549 } // namespace compiler | 531 } // namespace compiler |
| 550 } // namespace internal | 532 } // namespace internal |
| 551 } // namespace v8 | 533 } // namespace v8 |
| OLD | NEW |