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

Side by Side Diff: src/frames.h

Issue 2106113002: Revert of [builtins] New frame type for exits to C++ builtins (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/external-reference-table.cc ('k') | src/frames.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_H_ 5 #ifndef V8_FRAMES_H_
6 #define V8_FRAMES_H_ 6 #define V8_FRAMES_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/safepoint-table.h" 10 #include "src/safepoint-table.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 V(OPTIMIZED, OptimizedFrame) \ 105 V(OPTIMIZED, OptimizedFrame) \
106 V(WASM, WasmFrame) \ 106 V(WASM, WasmFrame) \
107 V(WASM_TO_JS, WasmToJsFrame) \ 107 V(WASM_TO_JS, WasmToJsFrame) \
108 V(JS_TO_WASM, JsToWasmFrame) \ 108 V(JS_TO_WASM, JsToWasmFrame) \
109 V(INTERPRETED, InterpretedFrame) \ 109 V(INTERPRETED, InterpretedFrame) \
110 V(STUB, StubFrame) \ 110 V(STUB, StubFrame) \
111 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ 111 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \
112 V(INTERNAL, InternalFrame) \ 112 V(INTERNAL, InternalFrame) \
113 V(CONSTRUCT, ConstructFrame) \ 113 V(CONSTRUCT, ConstructFrame) \
114 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) \ 114 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) \
115 V(BUILTIN, BuiltinFrame) \ 115 V(BUILTIN, BuiltinFrame)
116 V(BUILTIN_EXIT, BuiltinExitFrame)
117 116
118 // Every pointer in a frame has a slot id. On 32-bit platforms, doubles consume 117 // Every pointer in a frame has a slot id. On 32-bit platforms, doubles consume
119 // two slots. 118 // two slots.
120 // 119 //
121 // Stack slot indices >= 0 access the callee stack with slot 0 corresponding to 120 // Stack slot indices >= 0 access the callee stack with slot 0 corresponding to
122 // the callee's saved return address and 1 corresponding to the saved frame 121 // the callee's saved return address and 1 corresponding to the saved frame
123 // pointer. Some frames have additional information stored in the fixed header, 122 // pointer. Some frames have additional information stored in the fixed header,
124 // for example JSFunctions store the function context and marker in the fixed 123 // for example JSFunctions store the function context and marker in the fixed
125 // header, with slot index 2 corresponding to the current function context and 3 124 // header, with slot index 2 corresponding to the current function context and 3
126 // corresponding to the frame marker/JSFunction. 125 // corresponding to the frame marker/JSFunction.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 class StubFailureTrampolineFrameConstants : public InternalFrameConstants { 316 class StubFailureTrampolineFrameConstants : public InternalFrameConstants {
318 public: 317 public:
319 static const int kArgumentsArgumentsOffset = 318 static const int kArgumentsArgumentsOffset =
320 TYPED_FRAME_PUSHED_VALUE_OFFSET(0); 319 TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
321 static const int kArgumentsLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); 320 static const int kArgumentsLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
322 static const int kArgumentsPointerOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2); 321 static const int kArgumentsPointerOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
323 static const int kFixedHeaderBottomOffset = kArgumentsPointerOffset; 322 static const int kFixedHeaderBottomOffset = kArgumentsPointerOffset;
324 DEFINE_TYPED_FRAME_SIZES(3); 323 DEFINE_TYPED_FRAME_SIZES(3);
325 }; 324 };
326 325
327 // Behaves like an exit frame but with target and new target args.
328 class BuiltinExitFrameConstants : public CommonFrameConstants {
329 public:
330 static const int kNewTargetOffset = kCallerPCOffset + 1 * kPointerSize;
331 static const int kTargetOffset = kNewTargetOffset + 1 * kPointerSize;
332 };
333 326
334 class InterpreterFrameConstants : public AllStatic { 327 class InterpreterFrameConstants : public AllStatic {
335 public: 328 public:
336 // Fixed frame includes new.target and bytecode offset. 329 // Fixed frame includes new.target and bytecode offset.
337 static const int kFixedFrameSize = 330 static const int kFixedFrameSize =
338 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; 331 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
339 static const int kFixedFrameSizeFromFp = 332 static const int kFixedFrameSizeFromFp =
340 StandardFrameConstants::kFixedFrameSizeFromFp + 3 * kPointerSize; 333 StandardFrameConstants::kFixedFrameSizeFromFp + 3 * kPointerSize;
341 334
342 // FP-relative. 335 // FP-relative.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 bool is_wasm() const { return type() == WASM; } 419 bool is_wasm() const { return type() == WASM; }
427 bool is_wasm_to_js() const { return type() == WASM_TO_JS; } 420 bool is_wasm_to_js() const { return type() == WASM_TO_JS; }
428 bool is_js_to_wasm() const { return type() == JS_TO_WASM; } 421 bool is_js_to_wasm() const { return type() == JS_TO_WASM; }
429 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; } 422 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; }
430 bool is_builtin() const { return type() == BUILTIN; } 423 bool is_builtin() const { return type() == BUILTIN; }
431 bool is_internal() const { return type() == INTERNAL; } 424 bool is_internal() const { return type() == INTERNAL; }
432 bool is_stub_failure_trampoline() const { 425 bool is_stub_failure_trampoline() const {
433 return type() == STUB_FAILURE_TRAMPOLINE; 426 return type() == STUB_FAILURE_TRAMPOLINE;
434 } 427 }
435 bool is_construct() const { return type() == CONSTRUCT; } 428 bool is_construct() const { return type() == CONSTRUCT; }
436 bool is_builtin_exit() const { return type() == BUILTIN_EXIT; }
437 virtual bool is_standard() const { return false; } 429 virtual bool is_standard() const { return false; }
438 430
439 bool is_java_script() const { 431 bool is_java_script() const {
440 Type type = this->type(); 432 Type type = this->type();
441 return (type == JAVA_SCRIPT) || (type == OPTIMIZED) || 433 return (type == JAVA_SCRIPT) || (type == OPTIMIZED) ||
442 (type == INTERPRETED) || (type == BUILTIN); 434 (type == INTERPRETED) || (type == BUILTIN);
443 } 435 }
444 436
445 // Accessors. 437 // Accessors.
446 Address sp() const { return state_.sp; } 438 Address sp() const { return state_.sp; }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 static ExitFrame* cast(StackFrame* frame) { 623 static ExitFrame* cast(StackFrame* frame) {
632 DCHECK(frame->is_exit()); 624 DCHECK(frame->is_exit());
633 return static_cast<ExitFrame*>(frame); 625 return static_cast<ExitFrame*>(frame);
634 } 626 }
635 627
636 // Compute the state and type of an exit frame given a frame 628 // Compute the state and type of an exit frame given a frame
637 // pointer. Used when constructing the first stack frame seen by an 629 // pointer. Used when constructing the first stack frame seen by an
638 // iterator and the frames following entry frames. 630 // iterator and the frames following entry frames.
639 static Type GetStateForFramePointer(Address fp, State* state); 631 static Type GetStateForFramePointer(Address fp, State* state);
640 static Address ComputeStackPointer(Address fp); 632 static Address ComputeStackPointer(Address fp);
641 static StackFrame::Type ComputeFrameType(Address fp);
642 static void FillState(Address fp, Address sp, State* state); 633 static void FillState(Address fp, Address sp, State* state);
643 634
644 protected: 635 protected:
645 inline explicit ExitFrame(StackFrameIteratorBase* iterator); 636 inline explicit ExitFrame(StackFrameIteratorBase* iterator);
646 637
647 Address GetCallerStackPointer() const override; 638 Address GetCallerStackPointer() const override;
648 639
649 private: 640 private:
650 void ComputeCallerState(State* state) const override; 641 void ComputeCallerState(State* state) const override;
651 642
652 friend class StackFrameIteratorBase; 643 friend class StackFrameIteratorBase;
653 }; 644 };
654
655 // Builtin exit frames are a special case of exit frames, which are used
656 // whenever C++ builtins (e.g., Math.acos) are called. Their main purpose is
657 // to allow such builtins to appear in stack traces.
658 class BuiltinExitFrame : public ExitFrame {
659 public:
660 Type type() const override { return BUILTIN_EXIT; }
661
662 static BuiltinExitFrame* cast(StackFrame* frame) {
663 DCHECK(frame->is_builtin_exit());
664 return static_cast<BuiltinExitFrame*>(frame);
665 }
666
667 virtual JSFunction* function() const;
668
669 protected:
670 inline explicit BuiltinExitFrame(StackFrameIteratorBase* iterator);
671
672 private:
673 inline Object* function_slot_object() const;
674
675 friend class StackFrameIteratorBase;
676 };
677 645
678 class JavaScriptFrame; 646 class JavaScriptFrame;
679 647
680 class FrameSummary BASE_EMBEDDED { 648 class FrameSummary BASE_EMBEDDED {
681 public: 649 public:
682 // Mode for JavaScriptFrame::Summarize. Exact summary is required to produce 650 // Mode for JavaScriptFrame::Summarize. Exact summary is required to produce
683 // an exact stack trace. It will trigger an assertion failure if that is not 651 // an exact stack trace. It will trigger an assertion failure if that is not
684 // possible, e.g., because of missing deoptimization information. The 652 // possible, e.g., because of missing deoptimization information. The
685 // approximate mode should produce a summary even without deoptimization 653 // approximate mode should produce a summary even without deoptimization
686 // information, but it might miss frames. 654 // information, but it might miss frames.
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1251
1284 1252
1285 // Reads all frames on the current stack and copies them into the current 1253 // Reads all frames on the current stack and copies them into the current
1286 // zone memory. 1254 // zone memory.
1287 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); 1255 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
1288 1256
1289 } // namespace internal 1257 } // namespace internal
1290 } // namespace v8 1258 } // namespace v8
1291 1259
1292 #endif // V8_FRAMES_H_ 1260 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/external-reference-table.cc ('k') | src/frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698