diff --git a/src/frames-inl.h b/src/frames-inl.h index 2a02f9089b..4013601dac 100644 --- a/src/frames-inl.h +++ b/src/frames-inl.h @@ -234,6 +234,10 @@ inline OptimizedFrame::OptimizedFrame(StackFrameIteratorBase* iterator) } +inline InterpretedFrame::InterpretedFrame(StackFrameIteratorBase* iterator) + : JavaScriptFrame(iterator) {} + + inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame( StackFrameIteratorBase* iterator) : JavaScriptFrame(iterator) { } diff --git a/src/frames.cc b/src/frames.cc index 7b847974fd..c6ee65dec6 100644 --- a/src/frames.cc +++ b/src/frames.cc @@ -439,6 +439,19 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, return JAVA_SCRIPT; case Code::OPTIMIZED_FUNCTION: return OPTIMIZED; + case Code::BUILTIN: + if (!marker->IsSmi()) { + if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { + // An adapter frame has a special SMI constant for the context and + // is not distinguished through the marker. + return ARGUMENTS_ADAPTOR; + } else { + // The interpreter entry trampoline has a non-SMI marker. + DCHECK(code_obj->is_interpreter_entry_trampoline()); + return INTERPRETED; + } + } + break; // Marker encodes the frame type. case Code::HANDLER: if (!marker->IsSmi()) { // Only hydrogen code stub handlers can have a non-SMI marker. @@ -451,12 +464,6 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, } } - if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { - // An adapter frame has a special SMI constant for the context and - // is not distinguished through the marker. - return ARGUMENTS_ADAPTOR; - } - // Didn't find a code object, or the code kind wasn't specific enough. // The marker should encode the frame type. return static_cast(Smi::cast(marker)->value()); diff --git a/src/frames.h b/src/frames.h index 0bea37842f..864308c7dd 100644 --- a/src/frames.h +++ b/src/frames.h @@ -99,16 +99,17 @@ class StackHandler BASE_EMBEDDED { #define STACK_FRAME_TYPE_LIST(V) \ - V(ENTRY, EntryFrame) \ - V(ENTRY_CONSTRUCT, EntryConstructFrame) \ - V(EXIT, ExitFrame) \ - V(JAVA_SCRIPT, JavaScriptFrame) \ - V(OPTIMIZED, OptimizedFrame) \ - V(STUB, StubFrame) \ + V(ENTRY, EntryFrame) \ + V(ENTRY_CONSTRUCT, EntryConstructFrame) \ + V(EXIT, ExitFrame) \ + V(JAVA_SCRIPT, JavaScriptFrame) \ + V(OPTIMIZED, OptimizedFrame) \ + V(INTERPRETED, InterpretedFrame) \ + V(STUB, StubFrame) \ V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ - V(INTERNAL, InternalFrame) \ - V(CONSTRUCT, ConstructFrame) \ - V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) + V(INTERNAL, InternalFrame) \ + V(CONSTRUCT, ConstructFrame) \ + V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) class StandardFrameConstants : public AllStatic { @@ -702,6 +703,17 @@ class OptimizedFrame : public JavaScriptFrame { }; +class InterpretedFrame : public JavaScriptFrame { + virtual Type type() const { return INTERPRETED; } + + protected: + inline explicit InterpretedFrame(StackFrameIteratorBase* iterator); + + private: + friend class StackFrameIteratorBase; +}; + + // Arguments adaptor frames are automatically inserted below // JavaScript frames when the actual number of parameters does not // match the formal number of parameters. diff --git a/src/objects-inl.h b/src/objects-inl.h index 6124742649..52eed686a9 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -4978,12 +4978,8 @@ bool Code::IsCodeStubOrIC() { bool Code::IsJavaScriptCode() { - if (kind() == FUNCTION || kind() == OPTIMIZED_FUNCTION) { - return true; - } - Handle interpreter_entry = - GetIsolate()->builtins()->InterpreterEntryTrampoline(); - return interpreter_entry.location() != nullptr && *interpreter_entry == this; + return kind() == FUNCTION || kind() == OPTIMIZED_FUNCTION || + is_interpreter_entry_trampoline(); } @@ -5032,6 +5028,12 @@ inline bool Code::is_hydrogen_stub() { } +inline bool Code::is_interpreter_entry_trampoline() { + Handle interpreter_entry = + GetIsolate()->builtins()->InterpreterEntryTrampoline(); + return interpreter_entry.location() != nullptr && *interpreter_entry == this; +} + inline void Code::set_is_crankshafted(bool value) { int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); int updated = IsCrankshaftedField::update(previous, value); diff --git a/src/objects.h b/src/objects.h index 5bfa60423a..374cd8ea96 100644 --- a/src/objects.h +++ b/src/objects.h @@ -4899,6 +4899,7 @@ class Code: public HeapObject { inline bool is_to_boolean_ic_stub(); inline bool is_keyed_stub(); inline bool is_optimized_code(); + inline bool is_interpreter_entry_trampoline(); inline bool embeds_maps_weakly(); inline bool IsCodeStubOrIC();