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

Side by Side Diff: src/frames.h

Issue 1902373002: [builtins] Introduce a proper BUILTIN frame type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 V(JAVA_SCRIPT, JavaScriptFrame) \ 104 V(JAVA_SCRIPT, JavaScriptFrame) \
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 116
116 // 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
117 // two slots. 118 // two slots.
118 // 119 //
119 // 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
120 // 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
121 // pointer. Some frames have additional information stored in the fixed header, 122 // pointer. Some frames have additional information stored in the fixed header,
122 // 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
123 // 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
124 // corresponding to the frame marker/JSFunction. 125 // corresponding to the frame marker/JSFunction.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize 274 static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize
274 275
275 class ArgumentsAdaptorFrameConstants : public TypedFrameConstants { 276 class ArgumentsAdaptorFrameConstants : public TypedFrameConstants {
276 public: 277 public:
277 // FP-relative. 278 // FP-relative.
278 static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); 279 static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
279 static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); 280 static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
280 DEFINE_TYPED_FRAME_SIZES(2); 281 DEFINE_TYPED_FRAME_SIZES(2);
281 }; 282 };
282 283
284 class BuiltinFrameConstants : public TypedFrameConstants {
285 public:
286 // FP-relative.
287 static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
288 static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
289 DEFINE_TYPED_FRAME_SIZES(2);
290 };
291
283 class InternalFrameConstants : public TypedFrameConstants { 292 class InternalFrameConstants : public TypedFrameConstants {
284 public: 293 public:
285 // FP-relative. 294 // FP-relative.
286 static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); 295 static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
287 DEFINE_TYPED_FRAME_SIZES(1); 296 DEFINE_TYPED_FRAME_SIZES(1);
288 }; 297 };
289 298
290 class FrameDropperFrameConstants : public InternalFrameConstants { 299 class FrameDropperFrameConstants : public InternalFrameConstants {
291 public: 300 public:
292 // FP-relative. 301 // FP-relative.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // Type testers. 411 // Type testers.
403 bool is_entry() const { return type() == ENTRY; } 412 bool is_entry() const { return type() == ENTRY; }
404 bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; } 413 bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; }
405 bool is_exit() const { return type() == EXIT; } 414 bool is_exit() const { return type() == EXIT; }
406 bool is_optimized() const { return type() == OPTIMIZED; } 415 bool is_optimized() const { return type() == OPTIMIZED; }
407 bool is_interpreted() const { return type() == INTERPRETED; } 416 bool is_interpreted() const { return type() == INTERPRETED; }
408 bool is_wasm() const { return type() == WASM; } 417 bool is_wasm() const { return type() == WASM; }
409 bool is_wasm_to_js() const { return type() == WASM_TO_JS; } 418 bool is_wasm_to_js() const { return type() == WASM_TO_JS; }
410 bool is_js_to_wasm() const { return type() == JS_TO_WASM; } 419 bool is_js_to_wasm() const { return type() == JS_TO_WASM; }
411 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; } 420 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; }
421 bool is_builtin() const { return type() == BUILTIN; }
412 bool is_internal() const { return type() == INTERNAL; } 422 bool is_internal() const { return type() == INTERNAL; }
413 bool is_stub_failure_trampoline() const { 423 bool is_stub_failure_trampoline() const {
414 return type() == STUB_FAILURE_TRAMPOLINE; 424 return type() == STUB_FAILURE_TRAMPOLINE;
415 } 425 }
416 bool is_construct() const { return type() == CONSTRUCT; } 426 bool is_construct() const { return type() == CONSTRUCT; }
417 virtual bool is_standard() const { return false; } 427 virtual bool is_standard() const { return false; }
418 428
419 bool is_java_script() const { 429 bool is_java_script() const {
420 Type type = this->type(); 430 Type type = this->type();
421 return (type == JAVA_SCRIPT) || (type == OPTIMIZED) || 431 return (type == JAVA_SCRIPT) || (type == OPTIMIZED) ||
422 (type == INTERPRETED); 432 (type == INTERPRETED) || (type == BUILTIN);
423 } 433 }
424 434
425 // Accessors. 435 // Accessors.
426 Address sp() const { return state_.sp; } 436 Address sp() const { return state_.sp; }
427 Address fp() const { return state_.fp; } 437 Address fp() const { return state_.fp; }
428 Address caller_sp() const { return GetCallerStackPointer(); } 438 Address caller_sp() const { return GetCallerStackPointer(); }
429 439
430 // If this frame is optimized and was dynamically aligned return its old 440 // If this frame is optimized and was dynamically aligned return its old
431 // unaligned frame pointer. When the frame is deoptimized its FP will shift 441 // unaligned frame pointer. When the frame is deoptimized its FP will shift
432 // up one word and become unaligned. 442 // up one word and become unaligned.
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 void Print(StringStream* accumulator, PrintMode mode, 943 void Print(StringStream* accumulator, PrintMode mode,
934 int index) const override; 944 int index) const override;
935 945
936 static int GetLength(Address fp); 946 static int GetLength(Address fp);
937 947
938 protected: 948 protected:
939 inline explicit ArgumentsAdaptorFrame(StackFrameIteratorBase* iterator); 949 inline explicit ArgumentsAdaptorFrame(StackFrameIteratorBase* iterator);
940 950
941 int GetNumberOfIncomingArguments() const override; 951 int GetNumberOfIncomingArguments() const override;
942 952
943 Address GetCallerStackPointer() const override; 953 private:
954 friend class StackFrameIteratorBase;
955 };
956
957 // Builtin frames are built for builtins with JavaScript linkage, like
Jarin 2016/04/20 11:47:57 Nit: like -> such as
958 // various standard library functions (i.e. Math.asin, Math.floor, etc.).
959 class BuiltinFrame final : public JavaScriptFrame {
960 public:
961 Type type() const final { return BUILTIN; }
962
963 static BuiltinFrame* cast(StackFrame* frame) {
964 DCHECK(frame->is_builtin());
965 return static_cast<BuiltinFrame*>(frame);
966 }
967
968 // Printing support.
969 void Print(StringStream* accumulator, PrintMode mode, int index) const final;
970
971 protected:
972 inline explicit BuiltinFrame(StackFrameIteratorBase* iterator);
973
974 int GetNumberOfIncomingArguments() const final;
944 975
945 private: 976 private:
946 friend class StackFrameIteratorBase; 977 friend class StackFrameIteratorBase;
947 }; 978 };
948 979
949 class WasmFrame : public StandardFrame { 980 class WasmFrame : public StandardFrame {
950 public: 981 public:
951 Type type() const override { return WASM; } 982 Type type() const override { return WASM; }
952 983
953 // GC support. 984 // GC support.
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 1242
1212 1243
1213 // Reads all frames on the current stack and copies them into the current 1244 // Reads all frames on the current stack and copies them into the current
1214 // zone memory. 1245 // zone memory.
1215 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); 1246 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
1216 1247
1217 } // namespace internal 1248 } // namespace internal
1218 } // namespace v8 1249 } // namespace v8
1219 1250
1220 #endif // V8_FRAMES_H_ 1251 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/frames.cc » ('j') | src/frames.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698