Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: src/frames-inl.h

Issue 1861283002: Prepare StackFrame hierarchy & iterators for WASM (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Ben's comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/frames.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Base points to low address of first operand and stack grows down, so add 192 // Base points to low address of first operand and stack grows down, so add
193 // kPointerSize to get the actual stack size. 193 // kPointerSize to get the actual stack size.
194 intptr_t stack_size_in_bytes = (base + kPointerSize) - sp(); 194 intptr_t stack_size_in_bytes = (base + kPointerSize) - sp();
195 DCHECK(IsAligned(stack_size_in_bytes, kPointerSize)); 195 DCHECK(IsAligned(stack_size_in_bytes, kPointerSize));
196 DCHECK(type() == JAVA_SCRIPT); 196 DCHECK(type() == JAVA_SCRIPT);
197 DCHECK(stack_size_in_bytes >= 0); 197 DCHECK(stack_size_in_bytes >= 0);
198 return static_cast<int>(stack_size_in_bytes >> kPointerSizeLog2); 198 return static_cast<int>(stack_size_in_bytes >> kPointerSizeLog2);
199 } 199 }
200 200
201 201
202 inline Object* JavaScriptFrame::receiver() const {
203 return GetParameter(-1);
204 }
205
206
207 inline void JavaScriptFrame::set_receiver(Object* value) { 202 inline void JavaScriptFrame::set_receiver(Object* value) {
208 Memory::Object_at(GetParameterSlot(-1)) = value; 203 Memory::Object_at(GetParameterSlot(-1)) = value;
209 } 204 }
210 205
211 206
212 inline bool JavaScriptFrame::has_adapted_arguments() const { 207 inline bool JavaScriptFrame::has_adapted_arguments() const {
213 return IsArgumentsAdaptorFrame(caller_fp()); 208 return IsArgumentsAdaptorFrame(caller_fp());
214 } 209 }
215 210
216 211
217 inline JSFunction* JavaScriptFrame::function() const {
218 return JSFunction::cast(function_slot_object());
219 }
220
221
222 inline Object* JavaScriptFrame::function_slot_object() const { 212 inline Object* JavaScriptFrame::function_slot_object() const {
223 const int offset = JavaScriptFrameConstants::kFunctionOffset; 213 const int offset = JavaScriptFrameConstants::kFunctionOffset;
224 return Memory::Object_at(fp() + offset); 214 return Memory::Object_at(fp() + offset);
225 } 215 }
226 216
227 217
228 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) 218 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator)
229 : StandardFrame(iterator) { 219 : StandardFrame(iterator) {
230 } 220 }
231 221
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { 271 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const {
282 // TODO(1233797): The frame hierarchy needs to change. It's 272 // TODO(1233797): The frame hierarchy needs to change. It's
283 // problematic that we can't use the safe-cast operator to cast to 273 // problematic that we can't use the safe-cast operator to cast to
284 // the JavaScript frame type, because we may encounter arguments 274 // the JavaScript frame type, because we may encounter arguments
285 // adaptor frames. 275 // adaptor frames.
286 StackFrame* frame = iterator_.frame(); 276 StackFrame* frame = iterator_.frame();
287 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor()); 277 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor());
288 return static_cast<JavaScriptFrame*>(frame); 278 return static_cast<JavaScriptFrame*>(frame);
289 } 279 }
290 280
281 inline StandardFrame* StackTraceFrameIterator::frame() const {
282 StackFrame* frame = iterator_.frame();
283 DCHECK(frame->is_java_script() || frame->is_arguments_adaptor() ||
284 frame->is_wasm());
285 return static_cast<StandardFrame*>(frame);
286 }
287
288 bool StackTraceFrameIterator::is_javascript() const {
289 return frame()->is_java_script();
290 }
291
292 bool StackTraceFrameIterator::is_wasm() const { return frame()->is_wasm(); }
293
294 JavaScriptFrame* StackTraceFrameIterator::javascript_frame() const {
295 DCHECK(is_javascript());
296 return static_cast<JavaScriptFrame*>(frame());
297 }
298
299 WasmFrame* StackTraceFrameIterator::wasm_frame() const {
300 DCHECK(is_wasm());
301 return static_cast<WasmFrame*>(frame());
302 }
291 303
292 inline StackFrame* SafeStackFrameIterator::frame() const { 304 inline StackFrame* SafeStackFrameIterator::frame() const {
293 DCHECK(!done()); 305 DCHECK(!done());
294 DCHECK(frame_->is_java_script() || frame_->is_exit()); 306 DCHECK(frame_->is_java_script() || frame_->is_exit());
295 return frame_; 307 return frame_;
296 } 308 }
297 309
298 310
299 } // namespace internal 311 } // namespace internal
300 } // namespace v8 312 } // namespace v8
301 313
302 #endif // V8_FRAMES_INL_H_ 314 #endif // V8_FRAMES_INL_H_
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698