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