OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_FRAMES_INL_H_ | 5 #ifndef V8_FRAMES_INL_H_ |
6 #define V8_FRAMES_INL_H_ | 6 #define V8_FRAMES_INL_H_ |
7 | 7 |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 inline void StandardFrame::SetExpression(int index, Object* value) { | 110 inline void StandardFrame::SetExpression(int index, Object* value) { |
111 Memory::Object_at(GetExpressionAddress(index)) = value; | 111 Memory::Object_at(GetExpressionAddress(index)) = value; |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 inline Object* StandardFrame::context() const { | 115 inline Object* StandardFrame::context() const { |
116 const int offset = StandardFrameConstants::kContextOffset; | 116 const int offset = StandardFrameConstants::kContextOffset; |
117 return Memory::Object_at(fp() + offset); | 117 Object* maybe_result = Memory::Object_at(fp() + offset); |
| 118 DCHECK(!maybe_result->IsSmi()); |
| 119 return maybe_result; |
118 } | 120 } |
119 | 121 |
120 | 122 |
121 inline Address StandardFrame::caller_fp() const { | 123 inline Address StandardFrame::caller_fp() const { |
122 return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset); | 124 return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset); |
123 } | 125 } |
124 | 126 |
125 | 127 |
126 inline Address StandardFrame::caller_pc() const { | 128 inline Address StandardFrame::caller_pc() const { |
127 return Memory::Address_at(ComputePCAddress(fp())); | 129 return Memory::Address_at(ComputePCAddress(fp())); |
128 } | 130 } |
129 | 131 |
130 | 132 |
131 inline Address StandardFrame::ComputePCAddress(Address fp) { | 133 inline Address StandardFrame::ComputePCAddress(Address fp) { |
132 return fp + StandardFrameConstants::kCallerPCOffset; | 134 return fp + StandardFrameConstants::kCallerPCOffset; |
133 } | 135 } |
134 | 136 |
135 | 137 |
136 inline Address StandardFrame::ComputeConstantPoolAddress(Address fp) { | 138 inline Address StandardFrame::ComputeConstantPoolAddress(Address fp) { |
137 return fp + StandardFrameConstants::kConstantPoolOffset; | 139 return fp + StandardFrameConstants::kConstantPoolOffset; |
138 } | 140 } |
139 | 141 |
140 | 142 |
141 inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) { | 143 inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) { |
142 Object* marker = | 144 Object* frame_type = |
143 Memory::Object_at(fp + StandardFrameConstants::kContextOffset); | 145 Memory::Object_at(fp + TypedFrameConstants::kFrameTypeOffset); |
144 return marker == Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR); | 146 return frame_type == Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR); |
145 } | 147 } |
146 | 148 |
147 | 149 |
148 inline bool StandardFrame::IsConstructFrame(Address fp) { | 150 inline bool StandardFrame::IsConstructFrame(Address fp) { |
149 Object* marker = | 151 Object* frame_type = |
150 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); | 152 Memory::Object_at(fp + TypedFrameConstants::kFrameTypeOffset); |
151 return marker == Smi::FromInt(StackFrame::CONSTRUCT); | 153 return frame_type == Smi::FromInt(StackFrame::CONSTRUCT); |
152 } | 154 } |
153 | 155 |
154 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) | 156 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) |
155 : StandardFrame(iterator) {} | 157 : StandardFrame(iterator) {} |
156 | 158 |
157 Address JavaScriptFrame::GetParameterSlot(int index) const { | 159 Address JavaScriptFrame::GetParameterSlot(int index) const { |
158 int param_count = ComputeParametersCount(); | 160 int param_count = ComputeParametersCount(); |
159 DCHECK(-1 <= index && index < param_count); | 161 DCHECK(-1 <= index && index < param_count); |
160 int parameter_offset = (param_count - index - 1) * kPointerSize; | 162 int parameter_offset = (param_count - index - 1) * kPointerSize; |
161 return caller_sp() + parameter_offset; | 163 return caller_sp() + parameter_offset; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 DCHECK(!done()); | 291 DCHECK(!done()); |
290 DCHECK(frame_->is_java_script() || frame_->is_exit()); | 292 DCHECK(frame_->is_java_script() || frame_->is_exit()); |
291 return frame_; | 293 return frame_; |
292 } | 294 } |
293 | 295 |
294 | 296 |
295 } // namespace internal | 297 } // namespace internal |
296 } // namespace v8 | 298 } // namespace v8 |
297 | 299 |
298 #endif // V8_FRAMES_INL_H_ | 300 #endif // V8_FRAMES_INL_H_ |
OLD | NEW |