Commit 899bf304 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[ubsan] Port AbstractCode to the new design

Bug: v8:3770
Change-Id: Id515906744a738d5d40dbb6dee15e243623f020c
Reviewed-on: https://chromium-review.googlesource.com/c/1349111
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57809}
parent fd1bc2ba
...@@ -69,13 +69,13 @@ class CodeEventListener { ...@@ -69,13 +69,13 @@ class CodeEventListener {
virtual ~CodeEventListener() = default; virtual ~CodeEventListener() = default;
virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
const char* comment) = 0; const char* comment) = 0;
virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
Name* name) = 0; Name* name) = 0;
virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* source) = 0; SharedFunctionInfo* shared, Name* source) = 0;
virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* source, SharedFunctionInfo* shared, Name* source,
int line, int column) = 0; int line, int column) = 0;
virtual void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, virtual void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code,
...@@ -83,11 +83,11 @@ class CodeEventListener { ...@@ -83,11 +83,11 @@ class CodeEventListener {
virtual void CallbackEvent(Name* name, Address entry_point) = 0; virtual void CallbackEvent(Name* name, Address entry_point) = 0;
virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0;
virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0;
virtual void RegExpCodeCreateEvent(AbstractCode* code, String* source) = 0; virtual void RegExpCodeCreateEvent(AbstractCode code, String* source) = 0;
virtual void CodeMoveEvent(AbstractCode* from, AbstractCode* to) = 0; virtual void CodeMoveEvent(AbstractCode from, AbstractCode to) = 0;
virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0;
virtual void CodeMovingGCEvent() = 0; virtual void CodeMovingGCEvent() = 0;
virtual void CodeDisableOptEvent(AbstractCode* code, virtual void CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) = 0; SharedFunctionInfo* shared) = 0;
virtual void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc, virtual void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta) = 0; int fp_to_sp_delta) = 0;
...@@ -122,18 +122,18 @@ class CodeEventDispatcher { ...@@ -122,18 +122,18 @@ class CodeEventDispatcher {
base::MutexGuard guard(&mutex_); \ base::MutexGuard guard(&mutex_); \
for (auto it = listeners_.begin(); it != listeners_.end(); ++it) (*it)->code for (auto it = listeners_.begin(); it != listeners_.end(); ++it) (*it)->code
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
const char* comment) { const char* comment) {
CODE_EVENT_DISPATCH(CodeCreateEvent(tag, code, comment)); CODE_EVENT_DISPATCH(CodeCreateEvent(tag, code, comment));
} }
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, Name* name) { void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code, Name* name) {
CODE_EVENT_DISPATCH(CodeCreateEvent(tag, code, name)); CODE_EVENT_DISPATCH(CodeCreateEvent(tag, code, name));
} }
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* name) { SharedFunctionInfo* shared, Name* name) {
CODE_EVENT_DISPATCH(CodeCreateEvent(tag, code, shared, name)); CODE_EVENT_DISPATCH(CodeCreateEvent(tag, code, shared, name));
} }
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* source, int line, SharedFunctionInfo* shared, Name* source, int line,
int column) { int column) {
CODE_EVENT_DISPATCH( CODE_EVENT_DISPATCH(
...@@ -152,17 +152,17 @@ class CodeEventDispatcher { ...@@ -152,17 +152,17 @@ class CodeEventDispatcher {
void SetterCallbackEvent(Name* name, Address entry_point) { void SetterCallbackEvent(Name* name, Address entry_point) {
CODE_EVENT_DISPATCH(SetterCallbackEvent(name, entry_point)); CODE_EVENT_DISPATCH(SetterCallbackEvent(name, entry_point));
} }
void RegExpCodeCreateEvent(AbstractCode* code, String* source) { void RegExpCodeCreateEvent(AbstractCode code, String* source) {
CODE_EVENT_DISPATCH(RegExpCodeCreateEvent(code, source)); CODE_EVENT_DISPATCH(RegExpCodeCreateEvent(code, source));
} }
void CodeMoveEvent(AbstractCode* from, AbstractCode* to) { void CodeMoveEvent(AbstractCode from, AbstractCode to) {
CODE_EVENT_DISPATCH(CodeMoveEvent(from, to)); CODE_EVENT_DISPATCH(CodeMoveEvent(from, to));
} }
void SharedFunctionInfoMoveEvent(Address from, Address to) { void SharedFunctionInfoMoveEvent(Address from, Address to) {
CODE_EVENT_DISPATCH(SharedFunctionInfoMoveEvent(from, to)); CODE_EVENT_DISPATCH(SharedFunctionInfoMoveEvent(from, to));
} }
void CodeMovingGCEvent() { CODE_EVENT_DISPATCH(CodeMovingGCEvent()); } void CodeMovingGCEvent() { CODE_EVENT_DISPATCH(CodeMovingGCEvent()); }
void CodeDisableOptEvent(AbstractCode* code, SharedFunctionInfo* shared) { void CodeDisableOptEvent(AbstractCode code, SharedFunctionInfo* shared) {
CODE_EVENT_DISPATCH(CodeDisableOptEvent(code, shared)); CODE_EVENT_DISPATCH(CodeDisableOptEvent(code, shared));
} }
void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc, void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc,
......
...@@ -781,7 +781,7 @@ Object* StandardFrame::context() const { ...@@ -781,7 +781,7 @@ Object* StandardFrame::context() const {
} }
int StandardFrame::position() const { int StandardFrame::position() const {
AbstractCode* code = AbstractCode::cast(LookupCode()); AbstractCode code = AbstractCode::cast(LookupCode());
int code_offset = static_cast<int>(pc() - code->InstructionStart()); int code_offset = static_cast<int>(pc() - code->InstructionStart());
return code->SourcePosition(code_offset); return code->SourcePosition(code_offset);
} }
...@@ -1062,7 +1062,7 @@ void JavaScriptFrame::Summarize(std::vector<FrameSummary>* functions) const { ...@@ -1062,7 +1062,7 @@ void JavaScriptFrame::Summarize(std::vector<FrameSummary>* functions) const {
DCHECK(functions->empty()); DCHECK(functions->empty());
Code code = LookupCode(); Code code = LookupCode();
int offset = static_cast<int>(pc() - code->InstructionStart()); int offset = static_cast<int>(pc() - code->InstructionStart());
AbstractCode* abstract_code = AbstractCode::cast(code); AbstractCode abstract_code = AbstractCode::cast(code);
FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver(), FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver(),
function(), abstract_code, function(), abstract_code,
offset, IsConstructor()); offset, IsConstructor());
...@@ -1103,8 +1103,8 @@ int JavaScriptFrame::LookupExceptionHandlerInTable( ...@@ -1103,8 +1103,8 @@ int JavaScriptFrame::LookupExceptionHandlerInTable(
} }
void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function,
AbstractCode* code, AbstractCode code, int code_offset,
int code_offset, FILE* file, FILE* file,
bool print_line_number) { bool print_line_number) {
PrintF(file, "%s", function->IsOptimized() ? "*" : "~"); PrintF(file, "%s", function->IsOptimized() ? "*" : "~");
function->PrintName(file); function->PrintName(file);
...@@ -1171,7 +1171,7 @@ void JavaScriptFrame::PrintTop(Isolate* isolate, FILE* file, bool print_args, ...@@ -1171,7 +1171,7 @@ void JavaScriptFrame::PrintTop(Isolate* isolate, FILE* file, bool print_args,
} }
void JavaScriptFrame::CollectFunctionAndOffsetForICStats(JSFunction* function, void JavaScriptFrame::CollectFunctionAndOffsetForICStats(JSFunction* function,
AbstractCode* code, AbstractCode code,
int code_offset) { int code_offset) {
auto ic_stats = ICStats::instance(); auto ic_stats = ICStats::instance();
ICInfo& ic_info = ic_stats->Current(); ICInfo& ic_info = ic_stats->Current();
...@@ -1259,7 +1259,7 @@ void JavaScriptBuiltinContinuationWithCatchFrame::SetException( ...@@ -1259,7 +1259,7 @@ void JavaScriptBuiltinContinuationWithCatchFrame::SetException(
FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary( FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary(
Isolate* isolate, Object* receiver, JSFunction* function, Isolate* isolate, Object* receiver, JSFunction* function,
AbstractCode* abstract_code, int code_offset, bool is_constructor) AbstractCode abstract_code, int code_offset, bool is_constructor)
: FrameSummaryBase(isolate, FrameSummary::JAVA_SCRIPT), : FrameSummaryBase(isolate, FrameSummary::JAVA_SCRIPT),
receiver_(receiver, isolate), receiver_(receiver, isolate),
function_(function, isolate), function_(function, isolate),
...@@ -1648,7 +1648,7 @@ Object* OptimizedFrame::StackSlotAt(int index) const { ...@@ -1648,7 +1648,7 @@ Object* OptimizedFrame::StackSlotAt(int index) const {
} }
int InterpretedFrame::position() const { int InterpretedFrame::position() const {
AbstractCode* code = AbstractCode::cast(GetBytecodeArray()); AbstractCode code = AbstractCode::cast(GetBytecodeArray());
int code_offset = GetBytecodeOffset(); int code_offset = GetBytecodeOffset();
return code->SourcePosition(code_offset); return code->SourcePosition(code_offset);
} }
...@@ -1723,7 +1723,7 @@ void InterpretedFrame::WriteInterpreterRegister(int register_index, ...@@ -1723,7 +1723,7 @@ void InterpretedFrame::WriteInterpreterRegister(int register_index,
void InterpretedFrame::Summarize(std::vector<FrameSummary>* functions) const { void InterpretedFrame::Summarize(std::vector<FrameSummary>* functions) const {
DCHECK(functions->empty()); DCHECK(functions->empty());
AbstractCode* abstract_code = AbstractCode::cast(GetBytecodeArray()); AbstractCode abstract_code = AbstractCode::cast(GetBytecodeArray());
FrameSummary::JavaScriptFrameSummary summary( FrameSummary::JavaScriptFrameSummary summary(
isolate(), receiver(), function(), abstract_code, GetBytecodeOffset(), isolate(), receiver(), function(), abstract_code, GetBytecodeOffset(),
IsConstructor()); IsConstructor());
......
...@@ -475,7 +475,7 @@ class FrameSummary { ...@@ -475,7 +475,7 @@ class FrameSummary {
class JavaScriptFrameSummary : public FrameSummaryBase { class JavaScriptFrameSummary : public FrameSummaryBase {
public: public:
JavaScriptFrameSummary(Isolate* isolate, Object* receiver, JavaScriptFrameSummary(Isolate* isolate, Object* receiver,
JSFunction* function, AbstractCode* abstract_code, JSFunction* function, AbstractCode abstract_code,
int code_offset, bool is_constructor); int code_offset, bool is_constructor);
Handle<Object> receiver() const { return receiver_; } Handle<Object> receiver() const { return receiver_; }
...@@ -738,7 +738,7 @@ class JavaScriptFrame : public StandardFrame { ...@@ -738,7 +738,7 @@ class JavaScriptFrame : public StandardFrame {
return static_cast<JavaScriptFrame*>(frame); return static_cast<JavaScriptFrame*>(frame);
} }
static void PrintFunctionAndOffset(JSFunction* function, AbstractCode* code, static void PrintFunctionAndOffset(JSFunction* function, AbstractCode code,
int code_offset, FILE* file, int code_offset, FILE* file,
bool print_line_number); bool print_line_number);
...@@ -746,7 +746,7 @@ class JavaScriptFrame : public StandardFrame { ...@@ -746,7 +746,7 @@ class JavaScriptFrame : public StandardFrame {
bool print_line_number); bool print_line_number);
static void CollectFunctionAndOffsetForICStats(JSFunction* function, static void CollectFunctionAndOffsetForICStats(JSFunction* function,
AbstractCode* code, AbstractCode code,
int code_offset); int code_offset);
static void CollectTopFrameForICStats(Isolate* isolate); static void CollectTopFrameForICStats(Isolate* isolate);
......
...@@ -25,7 +25,7 @@ void CodeStatistics::RecordCodeAndMetadataStatistics(HeapObject* object, ...@@ -25,7 +25,7 @@ void CodeStatistics::RecordCodeAndMetadataStatistics(HeapObject* object,
} }
} else if (object->IsAbstractCode()) { } else if (object->IsAbstractCode()) {
// Record code+metadata statisitcs. // Record code+metadata statisitcs.
AbstractCode* abstract_code = AbstractCode::cast(object); AbstractCode abstract_code = AbstractCode::cast(object);
int size = abstract_code->SizeIncludingMetadata(); int size = abstract_code->SizeIncludingMetadata();
if (abstract_code->IsCode()) { if (abstract_code->IsCode()) {
size += isolate->code_and_metadata_size(); size += isolate->code_and_metadata_size();
......
...@@ -2029,7 +2029,7 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target, ...@@ -2029,7 +2029,7 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
Object* script = fun->shared()->script(); Object* script = fun->shared()->script();
if (script->IsScript() && if (script->IsScript() &&
!(Script::cast(script)->source()->IsUndefined(this))) { !(Script::cast(script)->source()->IsUndefined(this))) {
AbstractCode* abstract_code = elements->Code(i); AbstractCode abstract_code = elements->Code(i);
const int code_offset = elements->Offset(i)->value(); const int code_offset = elements->Offset(i)->value();
const int pos = abstract_code->SourcePosition(code_offset); const int pos = abstract_code->SourcePosition(code_offset);
......
This diff is collapsed.
...@@ -195,26 +195,26 @@ class Logger : public CodeEventListener { ...@@ -195,26 +195,26 @@ class Logger : public CodeEventListener {
void SetterCallbackEvent(Name* name, Address entry_point) override; void SetterCallbackEvent(Name* name, Address entry_point) override;
// Emits a code create event. // Emits a code create event.
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, const char* source) override; AbstractCode code, const char* source) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, Name* name) override; AbstractCode code, Name* name) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, SharedFunctionInfo* shared, AbstractCode code, SharedFunctionInfo* shared,
Name* name) override; Name* name) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, SharedFunctionInfo* shared, AbstractCode code, SharedFunctionInfo* shared,
Name* source, int line, int column) override; Name* source, int line, int column) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
const wasm::WasmCode* code, const wasm::WasmCode* code,
wasm::WasmName name) override; wasm::WasmName name) override;
// Emits a code deoptimization event. // Emits a code deoptimization event.
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) override; SharedFunctionInfo* shared) override;
void CodeMovingGCEvent() override; void CodeMovingGCEvent() override;
// Emits a code create event for a RegExp. // Emits a code create event for a RegExp.
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; void RegExpCodeCreateEvent(AbstractCode code, String* source) override;
// Emits a code move event. // Emits a code move event.
void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; void CodeMoveEvent(AbstractCode from, AbstractCode to) override;
// Emits a code line info record event. // Emits a code line info record event.
void CodeLinePosInfoRecordEvent(Address code_start, void CodeLinePosInfoRecordEvent(Address code_start,
ByteArray source_position_table); ByteArray source_position_table);
...@@ -404,19 +404,19 @@ class CodeEventLogger : public CodeEventListener { ...@@ -404,19 +404,19 @@ class CodeEventLogger : public CodeEventListener {
explicit CodeEventLogger(Isolate* isolate); explicit CodeEventLogger(Isolate* isolate);
~CodeEventLogger() override; ~CodeEventLogger() override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
const char* comment) override; const char* comment) override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
Name* name) override; Name* name) override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* name) override; SharedFunctionInfo* shared, Name* name) override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* source, int line, SharedFunctionInfo* shared, Name* source, int line,
int column) override; int column) override;
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code,
wasm::WasmName name) override; wasm::WasmName name) override;
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; void RegExpCodeCreateEvent(AbstractCode code, String* source) override;
void CallbackEvent(Name* name, Address entry_point) override {} void CallbackEvent(Name* name, Address entry_point) override {}
void GetterCallbackEvent(Name* name, Address entry_point) override {} void GetterCallbackEvent(Name* name, Address entry_point) override {}
void SetterCallbackEvent(Name* name, Address entry_point) override {} void SetterCallbackEvent(Name* name, Address entry_point) override {}
...@@ -431,7 +431,7 @@ class CodeEventLogger : public CodeEventListener { ...@@ -431,7 +431,7 @@ class CodeEventLogger : public CodeEventListener {
private: private:
class NameBuffer; class NameBuffer;
virtual void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, virtual void LogRecordedBuffer(AbstractCode code, SharedFunctionInfo* shared,
const char* name, int length) = 0; const char* name, int length) = 0;
virtual void LogRecordedBuffer(const wasm::WasmCode* code, const char* name, virtual void LogRecordedBuffer(const wasm::WasmCode* code, const char* name,
int length) = 0; int length) = 0;
...@@ -456,25 +456,25 @@ class ExternalCodeEventListener : public CodeEventListener { ...@@ -456,25 +456,25 @@ class ExternalCodeEventListener : public CodeEventListener {
explicit ExternalCodeEventListener(Isolate* isolate); explicit ExternalCodeEventListener(Isolate* isolate);
~ExternalCodeEventListener() override; ~ExternalCodeEventListener() override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
const char* comment) override; const char* comment) override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
Name* name) override; Name* name) override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* name) override; SharedFunctionInfo* shared, Name* name) override;
void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, void CodeCreateEvent(LogEventsAndTags tag, AbstractCode code,
SharedFunctionInfo* shared, Name* source, int line, SharedFunctionInfo* shared, Name* source, int line,
int column) override; int column) override;
void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code, void CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code,
wasm::WasmName name) override; wasm::WasmName name) override;
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; void RegExpCodeCreateEvent(AbstractCode code, String* source) override;
void CallbackEvent(Name* name, Address entry_point) override {} void CallbackEvent(Name* name, Address entry_point) override {}
void GetterCallbackEvent(Name* name, Address entry_point) override {} void GetterCallbackEvent(Name* name, Address entry_point) override {}
void SetterCallbackEvent(Name* name, Address entry_point) override {} void SetterCallbackEvent(Name* name, Address entry_point) override {}
void SharedFunctionInfoMoveEvent(Address from, Address to) override {} void SharedFunctionInfoMoveEvent(Address from, Address to) override {}
void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override {} void CodeMoveEvent(AbstractCode from, AbstractCode to) override {}
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) override {} SharedFunctionInfo* shared) override {}
void CodeMovingGCEvent() override {} void CodeMovingGCEvent() override {}
void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc, void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc,
......
...@@ -18815,7 +18815,7 @@ int JSGeneratorObject::source_position() const { ...@@ -18815,7 +18815,7 @@ int JSGeneratorObject::source_position() const {
// The stored bytecode offset is relative to a different base than what // The stored bytecode offset is relative to a different base than what
// is used in the source position table, hence the subtraction. // is used in the source position table, hence the subtraction.
code_offset -= BytecodeArray::kHeaderSize - kHeapObjectTag; code_offset -= BytecodeArray::kHeaderSize - kHeapObjectTag;
AbstractCode* code = AbstractCode code =
AbstractCode::cast(function()->shared()->GetBytecodeArray()); AbstractCode::cast(function()->shared()->GetBytecodeArray());
return code->SourcePosition(code_offset); return code->SourcePosition(code_offset);
} }
......
...@@ -1076,7 +1076,7 @@ STRUCT_LIST(STRUCT_IS_TYPE_FUNCTION_DECL) ...@@ -1076,7 +1076,7 @@ STRUCT_LIST(STRUCT_IS_TYPE_FUNCTION_DECL)
enum class ElementTypes { kAll, kStringAndSymbol }; enum class ElementTypes { kAll, kStringAndSymbol };
// TODO(3770): Get rid of this indirection when the migration is complete. // TODO(3770): Get rid of this indirection when the migration is complete.
typedef AbstractCode* AbstractCodeArgType; typedef AbstractCode AbstractCodeArgType;
typedef ByteArray ByteArrayArgType; typedef ByteArray ByteArrayArgType;
typedef FixedArray FixedArrayArgType; typedef FixedArray FixedArrayArgType;
typedef FixedDoubleArray FixedDoubleArrayArgType; typedef FixedDoubleArray FixedDoubleArrayArgType;
......
...@@ -23,8 +23,11 @@ namespace internal { ...@@ -23,8 +23,11 @@ namespace internal {
OBJECT_CONSTRUCTORS_IMPL(DeoptimizationData, FixedArray) OBJECT_CONSTRUCTORS_IMPL(DeoptimizationData, FixedArray)
OBJECT_CONSTRUCTORS_IMPL(BytecodeArray, FixedArrayBase) OBJECT_CONSTRUCTORS_IMPL(BytecodeArray, FixedArrayBase)
OBJECT_CONSTRUCTORS_IMPL(AbstractCode, HeapObjectPtr)
CAST_ACCESSOR(AbstractCode) NEVER_READ_ONLY_SPACE_IMPL(AbstractCode)
CAST_ACCESSOR2(AbstractCode)
CAST_ACCESSOR2(BytecodeArray) CAST_ACCESSOR2(BytecodeArray)
CAST_ACCESSOR2(Code) CAST_ACCESSOR2(Code)
CAST_ACCESSOR(CodeDataContainer) CAST_ACCESSOR(CodeDataContainer)
...@@ -136,10 +139,10 @@ AbstractCode::Kind AbstractCode::kind() { ...@@ -136,10 +139,10 @@ AbstractCode::Kind AbstractCode::kind() {
} }
} }
Code AbstractCode::GetCode() { return Code::cast(this); } Code AbstractCode::GetCode() { return Code::cast(*this); }
BytecodeArray AbstractCode::GetBytecodeArray() { BytecodeArray AbstractCode::GetBytecodeArray() {
return BytecodeArray::cast(this); return BytecodeArray::cast(*this);
} }
DependentCode* DependentCode::next_link() { DependentCode* DependentCode::next_link() {
......
...@@ -498,8 +498,9 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject { ...@@ -498,8 +498,9 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject {
DISALLOW_IMPLICIT_CONSTRUCTORS(CodeDataContainer); DISALLOW_IMPLICIT_CONSTRUCTORS(CodeDataContainer);
}; };
class AbstractCode : public HeapObject, public NeverReadOnlySpaceObject { class AbstractCode : public HeapObjectPtr {
public: public:
NEVER_READ_ONLY_SPACE
// All code kinds and INTERPRETED_FUNCTION. // All code kinds and INTERPRETED_FUNCTION.
enum Kind { enum Kind {
#define DEFINE_CODE_KIND_ENUM(name) name, #define DEFINE_CODE_KIND_ENUM(name) name,
...@@ -561,13 +562,15 @@ class AbstractCode : public HeapObject, public NeverReadOnlySpaceObject { ...@@ -561,13 +562,15 @@ class AbstractCode : public HeapObject, public NeverReadOnlySpaceObject {
// the layout of the code object into account. // the layout of the code object into account.
inline int ExecutableSize(); inline int ExecutableSize();
DECL_CAST(AbstractCode) DECL_CAST2(AbstractCode)
inline Code GetCode(); inline Code GetCode();
inline BytecodeArray GetBytecodeArray(); inline BytecodeArray GetBytecodeArray();
// Max loop nesting marker used to postpose OSR. We don't take loop // Max loop nesting marker used to postpose OSR. We don't take loop
// nesting that is deeper than 5 levels into account. // nesting that is deeper than 5 levels into account.
static const int kMaxLoopNestingMarker = 6; static const int kMaxLoopNestingMarker = 6;
OBJECT_CONSTRUCTORS(AbstractCode, HeapObjectPtr)
}; };
// Dependent code is a singly linked list of weak fixed arrays. Each array // Dependent code is a singly linked list of weak fixed arrays. Each array
......
...@@ -495,7 +495,7 @@ void JSFunction::CompleteInobjectSlackTrackingIfActive() { ...@@ -495,7 +495,7 @@ void JSFunction::CompleteInobjectSlackTrackingIfActive() {
} }
} }
AbstractCode* JSFunction::abstract_code() { AbstractCode JSFunction::abstract_code() {
if (IsInterpreted()) { if (IsInterpreted()) {
return AbstractCode::cast(shared()->GetBytecodeArray()); return AbstractCode::cast(shared()->GetBytecodeArray());
} else { } else {
......
...@@ -929,7 +929,7 @@ class JSFunction : public JSObject { ...@@ -929,7 +929,7 @@ class JSFunction : public JSObject {
// Get the abstract code associated with the function, which will either be // Get the abstract code associated with the function, which will either be
// a Code object or a BytecodeArray. // a Code object or a BytecodeArray.
inline AbstractCode* abstract_code(); inline AbstractCode abstract_code();
// Tells whether or not this function is interpreted. // Tells whether or not this function is interpreted.
// //
......
...@@ -131,7 +131,7 @@ void SharedFunctionInfo::SetName(String* name) { ...@@ -131,7 +131,7 @@ void SharedFunctionInfo::SetName(String* name) {
UpdateFunctionMapIndex(); UpdateFunctionMapIndex();
} }
AbstractCode* SharedFunctionInfo::abstract_code() { AbstractCode SharedFunctionInfo::abstract_code() {
if (HasBytecodeArray()) { if (HasBytecodeArray()) {
return AbstractCode::cast(GetBytecodeArray()); return AbstractCode::cast(GetBytecodeArray());
} else { } else {
......
...@@ -194,7 +194,7 @@ class SharedFunctionInfo : public HeapObject, public NeverReadOnlySpaceObject { ...@@ -194,7 +194,7 @@ class SharedFunctionInfo : public HeapObject, public NeverReadOnlySpaceObject {
// Get the abstract code associated with the function, which will either be // Get the abstract code associated with the function, which will either be
// a Code object or a BytecodeArray. // a Code object or a BytecodeArray.
inline AbstractCode* abstract_code(); inline AbstractCode abstract_code();
// Tells whether or not this shared function info is interpreted. // Tells whether or not this shared function info is interpreted.
// //
......
...@@ -195,7 +195,7 @@ uint64_t PerfJitLogger::GetTimestamp() { ...@@ -195,7 +195,7 @@ uint64_t PerfJitLogger::GetTimestamp() {
return (ts.tv_sec * kNsecPerSec) + ts.tv_nsec; return (ts.tv_sec * kNsecPerSec) + ts.tv_nsec;
} }
void PerfJitLogger::LogRecordedBuffer(AbstractCode* abstract_code, void PerfJitLogger::LogRecordedBuffer(AbstractCode abstract_code,
SharedFunctionInfo* shared, SharedFunctionInfo* shared,
const char* name, int length) { const char* name, int length) {
if (FLAG_perf_basic_prof_only_functions && if (FLAG_perf_basic_prof_only_functions &&
...@@ -420,7 +420,7 @@ void PerfJitLogger::LogWriteUnwindingInfo(Code code) { ...@@ -420,7 +420,7 @@ void PerfJitLogger::LogWriteUnwindingInfo(Code code) {
LogWriteBytes(padding_bytes, static_cast<int>(padding_size)); LogWriteBytes(padding_bytes, static_cast<int>(padding_size));
} }
void PerfJitLogger::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { void PerfJitLogger::CodeMoveEvent(AbstractCode from, AbstractCode to) {
// We may receive a CodeMove event if a BytecodeArray object moves. Otherwise // We may receive a CodeMove event if a BytecodeArray object moves. Otherwise
// code relocation is not supported. // code relocation is not supported.
CHECK(from->IsBytecodeArray()); CHECK(from->IsBytecodeArray());
......
...@@ -41,8 +41,8 @@ class PerfJitLogger : public CodeEventLogger { ...@@ -41,8 +41,8 @@ class PerfJitLogger : public CodeEventLogger {
explicit PerfJitLogger(Isolate* isolate); explicit PerfJitLogger(Isolate* isolate);
~PerfJitLogger() override; ~PerfJitLogger() override;
void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; void CodeMoveEvent(AbstractCode from, AbstractCode to) override;
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) override {} SharedFunctionInfo* shared) override {}
private: private:
...@@ -52,7 +52,7 @@ class PerfJitLogger : public CodeEventLogger { ...@@ -52,7 +52,7 @@ class PerfJitLogger : public CodeEventLogger {
void CloseMarkerFile(void* marker_address); void CloseMarkerFile(void* marker_address);
uint64_t GetTimestamp(); uint64_t GetTimestamp();
void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, void LogRecordedBuffer(AbstractCode code, SharedFunctionInfo* shared,
const char* name, int length) override; const char* name, int length) override;
void LogRecordedBuffer(const wasm::WasmCode* code, const char* name, void LogRecordedBuffer(const wasm::WasmCode* code, const char* name,
int length) override; int length) override;
...@@ -120,16 +120,16 @@ class PerfJitLogger : public CodeEventLogger { ...@@ -120,16 +120,16 @@ class PerfJitLogger : public CodeEventLogger {
public: public:
explicit PerfJitLogger(Isolate* isolate) : CodeEventLogger(isolate) {} explicit PerfJitLogger(Isolate* isolate) : CodeEventLogger(isolate) {}
void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override { void CodeMoveEvent(AbstractCode from, AbstractCode to) override {
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) override { SharedFunctionInfo* shared) override {
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, void LogRecordedBuffer(AbstractCode code, SharedFunctionInfo* shared,
const char* name, int length) override { const char* name, int length) override {
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
......
...@@ -31,7 +31,7 @@ void ProfilerListener::CallbackEvent(Name* name, Address entry_point) { ...@@ -31,7 +31,7 @@ void ProfilerListener::CallbackEvent(Name* name, Address entry_point) {
} }
void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, const char* name) { AbstractCode code, const char* name) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->instruction_start = code->InstructionStart(); rec->instruction_start = code->InstructionStart();
...@@ -45,7 +45,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, ...@@ -45,7 +45,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
} }
void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, Name* name) { AbstractCode code, Name* name) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->instruction_start = code->InstructionStart(); rec->instruction_start = code->InstructionStart();
...@@ -59,7 +59,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, ...@@ -59,7 +59,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
} }
void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, AbstractCode code,
SharedFunctionInfo* shared, SharedFunctionInfo* shared,
Name* script_name) { Name* script_name) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
...@@ -77,7 +77,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, ...@@ -77,7 +77,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
} }
void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* abstract_code, AbstractCode abstract_code,
SharedFunctionInfo* shared, SharedFunctionInfo* shared,
Name* script_name, int line, Name* script_name, int line,
int column) { int column) {
...@@ -123,7 +123,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, ...@@ -123,7 +123,7 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
} }
void ProfilerListener::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { void ProfilerListener::CodeMoveEvent(AbstractCode from, AbstractCode to) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_MOVE); CodeEventsContainer evt_rec(CodeEventRecord::CODE_MOVE);
CodeMoveEventRecord* rec = &evt_rec.CodeMoveEventRecord_; CodeMoveEventRecord* rec = &evt_rec.CodeMoveEventRecord_;
rec->from_instruction_start = from->InstructionStart(); rec->from_instruction_start = from->InstructionStart();
...@@ -131,7 +131,7 @@ void ProfilerListener::CodeMoveEvent(AbstractCode* from, AbstractCode* to) { ...@@ -131,7 +131,7 @@ void ProfilerListener::CodeMoveEvent(AbstractCode* from, AbstractCode* to) {
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
} }
void ProfilerListener::CodeDisableOptEvent(AbstractCode* code, void ProfilerListener::CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) { SharedFunctionInfo* shared) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT); CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT);
CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_; CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_;
...@@ -167,7 +167,7 @@ void ProfilerListener::GetterCallbackEvent(Name* name, Address entry_point) { ...@@ -167,7 +167,7 @@ void ProfilerListener::GetterCallbackEvent(Name* name, Address entry_point) {
DispatchCodeEvent(evt_rec); DispatchCodeEvent(evt_rec);
} }
void ProfilerListener::RegExpCodeCreateEvent(AbstractCode* code, void ProfilerListener::RegExpCodeCreateEvent(AbstractCode code,
String* source) { String* source) {
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
...@@ -198,7 +198,7 @@ Name* ProfilerListener::InferScriptName(Name* name, SharedFunctionInfo* info) { ...@@ -198,7 +198,7 @@ Name* ProfilerListener::InferScriptName(Name* name, SharedFunctionInfo* info) {
} }
void ProfilerListener::RecordInliningInfo(CodeEntry* entry, void ProfilerListener::RecordInliningInfo(CodeEntry* entry,
AbstractCode* abstract_code) { AbstractCode abstract_code) {
if (!abstract_code->IsCode()) return; if (!abstract_code->IsCode()) return;
Code code = abstract_code->GetCode(); Code code = abstract_code->GetCode();
if (code->kind() != Code::OPTIMIZED_FUNCTION) return; if (code->kind() != Code::OPTIMIZED_FUNCTION) return;
......
...@@ -30,27 +30,27 @@ class ProfilerListener : public CodeEventListener { ...@@ -30,27 +30,27 @@ class ProfilerListener : public CodeEventListener {
void CallbackEvent(Name* name, Address entry_point) override; void CallbackEvent(Name* name, Address entry_point) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, const char* comment) override; AbstractCode code, const char* comment) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, Name* name) override; AbstractCode code, Name* name) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, SharedFunctionInfo* shared, AbstractCode code, SharedFunctionInfo* shared,
Name* script_name) override; Name* script_name) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, SharedFunctionInfo* shared, AbstractCode code, SharedFunctionInfo* shared,
Name* script_name, int line, int column) override; Name* script_name, int line, int column) override;
void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, void CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
const wasm::WasmCode* code, const wasm::WasmCode* code,
wasm::WasmName name) override; wasm::WasmName name) override;
void CodeMovingGCEvent() override {} void CodeMovingGCEvent() override {}
void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override; void CodeMoveEvent(AbstractCode from, AbstractCode to) override;
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) override; SharedFunctionInfo* shared) override;
void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc, void CodeDeoptEvent(Code code, DeoptimizeKind kind, Address pc,
int fp_to_sp_delta) override; int fp_to_sp_delta) override;
void GetterCallbackEvent(Name* name, Address entry_point) override; void GetterCallbackEvent(Name* name, Address entry_point) override;
void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; void RegExpCodeCreateEvent(AbstractCode code, String* source) override;
void SetterCallbackEvent(Name* name, Address entry_point) override; void SetterCallbackEvent(Name* name, Address entry_point) override;
void SharedFunctionInfoMoveEvent(Address from, Address to) override {} void SharedFunctionInfoMoveEvent(Address from, Address to) override {}
...@@ -76,7 +76,7 @@ class ProfilerListener : public CodeEventListener { ...@@ -76,7 +76,7 @@ class ProfilerListener : public CodeEventListener {
} }
private: private:
void RecordInliningInfo(CodeEntry* entry, AbstractCode* abstract_code); void RecordInliningInfo(CodeEntry* entry, AbstractCode abstract_code);
void AttachDeoptInlinedFrames(Code code, CodeDeoptEventRecord* rec); void AttachDeoptInlinedFrames(Code code, CodeDeoptEventRecord* rec);
Name* InferScriptName(Name* name, SharedFunctionInfo* info); Name* InferScriptName(Name* name, SharedFunctionInfo* info);
V8_INLINE void DispatchCodeEvent(const CodeEventsContainer& evt_rec) { V8_INLINE void DispatchCodeEvent(const CodeEventsContainer& evt_rec) {
......
...@@ -28,11 +28,11 @@ class CodeAddressMap : public CodeEventLogger { ...@@ -28,11 +28,11 @@ class CodeAddressMap : public CodeEventLogger {
isolate_->logger()->RemoveCodeEventListener(this); isolate_->logger()->RemoveCodeEventListener(this);
} }
void CodeMoveEvent(AbstractCode* from, AbstractCode* to) override { void CodeMoveEvent(AbstractCode from, AbstractCode to) override {
address_to_name_map_.Move(from->address(), to->address()); address_to_name_map_.Move(from->address(), to->address());
} }
void CodeDisableOptEvent(AbstractCode* code, void CodeDisableOptEvent(AbstractCode code,
SharedFunctionInfo* shared) override {} SharedFunctionInfo* shared) override {}
const char* Lookup(Address address) { const char* Lookup(Address address) {
...@@ -114,7 +114,7 @@ class CodeAddressMap : public CodeEventLogger { ...@@ -114,7 +114,7 @@ class CodeAddressMap : public CodeEventLogger {
DISALLOW_COPY_AND_ASSIGN(NameMap); DISALLOW_COPY_AND_ASSIGN(NameMap);
}; };
void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*, void LogRecordedBuffer(AbstractCode code, SharedFunctionInfo*,
const char* name, int length) override { const char* name, int length) override {
address_to_name_map_.Insert(code->address(), name, length); address_to_name_map_.Insert(code->address(), name, length);
} }
......
...@@ -124,7 +124,7 @@ class TestSetup { ...@@ -124,7 +124,7 @@ class TestSetup {
} // namespace } // namespace
i::AbstractCode* CreateCode(LocalContext* env) { i::AbstractCode CreateCode(LocalContext* env) {
static int counter = 0; static int counter = 0;
i::EmbeddedVector<char, 256> script; i::EmbeddedVector<char, 256> script;
i::EmbeddedVector<char, 32> name; i::EmbeddedVector<char, 32> name;
...@@ -154,10 +154,10 @@ TEST(CodeEvents) { ...@@ -154,10 +154,10 @@ TEST(CodeEvents) {
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
i::AbstractCode* aaa_code = CreateCode(&env); i::AbstractCode aaa_code = CreateCode(&env);
i::AbstractCode* comment_code = CreateCode(&env); i::AbstractCode comment_code = CreateCode(&env);
i::AbstractCode* comment2_code = CreateCode(&env); i::AbstractCode comment2_code = CreateCode(&env);
i::AbstractCode* moved_code = CreateCode(&env); i::AbstractCode moved_code = CreateCode(&env);
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
ProfileGenerator* generator = new ProfileGenerator(profiles); ProfileGenerator* generator = new ProfileGenerator(profiles);
...@@ -214,9 +214,9 @@ TEST(TickEvents) { ...@@ -214,9 +214,9 @@ TEST(TickEvents) {
i::Isolate* isolate = CcTest::i_isolate(); i::Isolate* isolate = CcTest::i_isolate();
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
i::AbstractCode* frame1_code = CreateCode(&env); i::AbstractCode frame1_code = CreateCode(&env);
i::AbstractCode* frame2_code = CreateCode(&env); i::AbstractCode frame2_code = CreateCode(&env);
i::AbstractCode* frame3_code = CreateCode(&env); i::AbstractCode frame3_code = CreateCode(&env);
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
ProfileGenerator* generator = new ProfileGenerator(profiles); ProfileGenerator* generator = new ProfileGenerator(profiles);
...@@ -285,7 +285,7 @@ TEST(Issue1398) { ...@@ -285,7 +285,7 @@ TEST(Issue1398) {
i::Isolate* isolate = CcTest::i_isolate(); i::Isolate* isolate = CcTest::i_isolate();
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
i::AbstractCode* code = CreateCode(&env); i::AbstractCode code = CreateCode(&env);
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
ProfileGenerator* generator = new ProfileGenerator(profiles); ProfileGenerator* generator = new ProfileGenerator(profiles);
...@@ -1137,13 +1137,13 @@ static void TickLines(bool optimize) { ...@@ -1137,13 +1137,13 @@ static void TickLines(bool optimize) {
i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(
v8::Utils::OpenHandle(*GetFunction(env.local(), func_name))); v8::Utils::OpenHandle(*GetFunction(env.local(), func_name)));
CHECK(func->shared()); CHECK(func->shared());
CHECK(func->shared()->abstract_code()); CHECK(!func->shared()->abstract_code().is_null());
CHECK(!optimize || func->IsOptimized() || CHECK(!optimize || func->IsOptimized() ||
!CcTest::i_isolate()->use_optimizer()); !CcTest::i_isolate()->use_optimizer());
i::AbstractCode* code = func->abstract_code(); i::AbstractCode code = func->abstract_code();
CHECK(code); CHECK(!code.is_null());
i::Address code_address = code->raw_instruction_start(); i::Address code_address = code->raw_instruction_start();
CHECK(code_address); CHECK_NE(code_address, kNullAddress);
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
ProfileGenerator* generator = new ProfileGenerator(profiles); ProfileGenerator* generator = new ProfileGenerator(profiles);
......
...@@ -45,7 +45,7 @@ namespace v8 { ...@@ -45,7 +45,7 @@ namespace v8 {
namespace internal { namespace internal {
static bool IsAddressWithinFuncCode(JSFunction* function, void* addr) { static bool IsAddressWithinFuncCode(JSFunction* function, void* addr) {
i::AbstractCode* code = function->abstract_code(); i::AbstractCode code = function->abstract_code();
return code->contains(reinterpret_cast<Address>(addr)); return code->contains(reinterpret_cast<Address>(addr));
} }
......
...@@ -506,12 +506,12 @@ TEST(Issue539892) { ...@@ -506,12 +506,12 @@ TEST(Issue539892) {
explicit FakeCodeEventLogger(i::Isolate* isolate) explicit FakeCodeEventLogger(i::Isolate* isolate)
: CodeEventLogger(isolate) {} : CodeEventLogger(isolate) {}
void CodeMoveEvent(i::AbstractCode* from, i::AbstractCode* to) override {} void CodeMoveEvent(i::AbstractCode from, i::AbstractCode to) override {}
void CodeDisableOptEvent(i::AbstractCode* code, void CodeDisableOptEvent(i::AbstractCode code,
i::SharedFunctionInfo* shared) override {} i::SharedFunctionInfo* shared) override {}
private: private:
void LogRecordedBuffer(i::AbstractCode* code, i::SharedFunctionInfo* shared, void LogRecordedBuffer(i::AbstractCode code, i::SharedFunctionInfo* shared,
const char* name, int length) override {} const char* name, int length) override {}
void LogRecordedBuffer(const i::wasm::WasmCode* code, const char* name, void LogRecordedBuffer(const i::wasm::WasmCode* code, const char* name,
int length) override {} int length) override {}
......
...@@ -150,7 +150,7 @@ TEST(Unwind_CodeObjectPCInMiddle_Success) { ...@@ -150,7 +150,7 @@ TEST(Unwind_CodeObjectPCInMiddle_Success) {
Handle<JSFunction>::cast(v8::Utils::OpenHandle(*local_foo)); Handle<JSFunction>::cast(v8::Utils::OpenHandle(*local_foo));
// Put the current PC inside of the created code object. // Put the current PC inside of the created code object.
AbstractCode* abstract_code = foo->abstract_code(); AbstractCode abstract_code = foo->abstract_code();
// We don't produce optimized code when run with --no-opt. // We don't produce optimized code when run with --no-opt.
if (!abstract_code->IsCode() && FLAG_opt == false) return; if (!abstract_code->IsCode() && FLAG_opt == false) return;
CHECK(abstract_code->IsCode()); CHECK(abstract_code->IsCode());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment