Commit 91f98a8f authored by ishell@chromium.org's avatar ishell@chromium.org Committed by V8 LUCI CQ

[ext-code-space] Remove more Code <-> CodeT roundtrips

... in various components.

Bug: v8:11880
Change-Id: I1e4411ec38a4b15e505bda35a92987972e89d9d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3777718
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarPatrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81863}
parent af39b321
...@@ -114,7 +114,7 @@ const char* Builtins::Lookup(Address pc) { ...@@ -114,7 +114,7 @@ const char* Builtins::Lookup(Address pc) {
if (!initialized_) return nullptr; if (!initialized_) return nullptr;
for (Builtin builtin_ix = Builtins::kFirst; builtin_ix <= Builtins::kLast; for (Builtin builtin_ix = Builtins::kFirst; builtin_ix <= Builtins::kLast;
++builtin_ix) { ++builtin_ix) {
if (FromCodeT(code(builtin_ix)).contains(isolate_, pc)) { if (code(builtin_ix).contains(isolate_, pc)) {
return name(builtin_ix); return name(builtin_ix);
} }
} }
...@@ -341,16 +341,16 @@ void Builtins::EmitCodeCreateEvents(Isolate* isolate) { ...@@ -341,16 +341,16 @@ void Builtins::EmitCodeCreateEvents(Isolate* isolate) {
int i = 0; int i = 0;
HandleScope scope(isolate); HandleScope scope(isolate);
for (; i < ToInt(Builtin::kFirstBytecodeHandler); i++) { for (; i < ToInt(Builtin::kFirstBytecodeHandler); i++) {
Code builtin_code = FromCodeT(CodeT::cast(Object(builtins[i]))); Handle<CodeT> builtin_code(&builtins[i]);
Handle<AbstractCode> code(AbstractCode::cast(builtin_code), isolate); Handle<AbstractCode> code = ToAbstractCode(builtin_code, isolate);
PROFILE(isolate, CodeCreateEvent(LogEventListener::CodeTag::kBuiltin, code, PROFILE(isolate, CodeCreateEvent(LogEventListener::CodeTag::kBuiltin, code,
Builtins::name(FromInt(i)))); Builtins::name(FromInt(i))));
} }
static_assert(kLastBytecodeHandlerPlusOne == kBuiltinCount); static_assert(kLastBytecodeHandlerPlusOne == kBuiltinCount);
for (; i < kBuiltinCount; i++) { for (; i < kBuiltinCount; i++) {
Code builtin_code = FromCodeT(CodeT::cast(Object(builtins[i]))); Handle<CodeT> builtin_code(&builtins[i]);
Handle<AbstractCode> code(AbstractCode::cast(builtin_code), isolate); Handle<AbstractCode> code = ToAbstractCode(builtin_code, isolate);
interpreter::Bytecode bytecode = interpreter::Bytecode bytecode =
builtin_metadata[i].data.bytecode_and_scale.bytecode; builtin_metadata[i].data.bytecode_and_scale.bytecode;
interpreter::OperandScale scale = interpreter::OperandScale scale =
......
...@@ -4097,7 +4097,7 @@ Handle<JSFunction> Factory::JSFunctionBuilder::Build() { ...@@ -4097,7 +4097,7 @@ Handle<JSFunction> Factory::JSFunctionBuilder::Build() {
PrepareMap(); PrepareMap();
PrepareFeedbackCell(); PrepareFeedbackCell();
Handle<Code> code = handle(FromCodeT(sfi_->GetCode()), isolate_); Handle<CodeT> code = handle(sfi_->GetCode(), isolate_);
Handle<JSFunction> result = BuildRaw(code); Handle<JSFunction> result = BuildRaw(code);
if (code->kind() == CodeKind::BASELINE) { if (code->kind() == CodeKind::BASELINE) {
...@@ -4109,7 +4109,7 @@ Handle<JSFunction> Factory::JSFunctionBuilder::Build() { ...@@ -4109,7 +4109,7 @@ Handle<JSFunction> Factory::JSFunctionBuilder::Build() {
return result; return result;
} }
Handle<JSFunction> Factory::JSFunctionBuilder::BuildRaw(Handle<Code> code) { Handle<JSFunction> Factory::JSFunctionBuilder::BuildRaw(Handle<CodeT> code) {
Isolate* isolate = isolate_; Isolate* isolate = isolate_;
Factory* factory = isolate_->factory(); Factory* factory = isolate_->factory();
......
...@@ -911,7 +911,7 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> { ...@@ -911,7 +911,7 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
void PrepareMap(); void PrepareMap();
void PrepareFeedbackCell(); void PrepareFeedbackCell();
V8_WARN_UNUSED_RESULT Handle<JSFunction> BuildRaw(Handle<Code> code); V8_WARN_UNUSED_RESULT Handle<JSFunction> BuildRaw(Handle<CodeT> code);
Isolate* const isolate_; Isolate* const isolate_;
Handle<SharedFunctionInfo> sfi_; Handle<SharedFunctionInfo> sfi_;
......
...@@ -421,6 +421,13 @@ inline Handle<Code> FromCodeT(Handle<CodeT> code, Isolate* isolate) { ...@@ -421,6 +421,13 @@ inline Handle<Code> FromCodeT(Handle<CodeT> code, Isolate* isolate) {
#endif #endif
} }
inline AbstractCode ToAbstractCode(CodeT code) {
if (V8_REMOVE_BUILTINS_CODE_OBJECTS) {
return AbstractCode::cast(code);
}
return AbstractCode::cast(FromCodeT(code));
}
inline Handle<AbstractCode> ToAbstractCode(Handle<CodeT> code, inline Handle<AbstractCode> ToAbstractCode(Handle<CodeT> code,
Isolate* isolate) { Isolate* isolate) {
if (V8_REMOVE_BUILTINS_CODE_OBJECTS) { if (V8_REMOVE_BUILTINS_CODE_OBJECTS) {
...@@ -437,23 +444,34 @@ inline CodeDataContainer CodeDataContainerFromCodeT(CodeT code) { ...@@ -437,23 +444,34 @@ inline CodeDataContainer CodeDataContainerFromCodeT(CodeT code) {
#endif #endif
} }
CodeKind CodeLookupResult::kind() const {
DCHECK(IsFound());
#ifdef V8_EXTERNAL_CODE_SPACE #ifdef V8_EXTERNAL_CODE_SPACE
return IsCode() ? code().kind() : code_data_container().kind(); #define CODE_LOOKUP_RESULT_FWD_ACCESSOR(name, Type) \
Type CodeLookupResult::name() const { \
DCHECK(IsFound()); \
return IsCode() ? code().name() : code_data_container().name(); \
}
#else #else
return code().kind(); #define CODE_LOOKUP_RESULT_FWD_ACCESSOR(name, Type) \
Type CodeLookupResult::name() const { \
DCHECK(IsFound()); \
return code().name(); \
}
#endif #endif
}
Builtin CodeLookupResult::builtin_id() const { CODE_LOOKUP_RESULT_FWD_ACCESSOR(kind, CodeKind)
DCHECK(IsFound()); CODE_LOOKUP_RESULT_FWD_ACCESSOR(builtin_id, Builtin)
#ifdef V8_EXTERNAL_CODE_SPACE CODE_LOOKUP_RESULT_FWD_ACCESSOR(has_tagged_outgoing_params, bool)
return IsCode() ? code().builtin_id() : code_data_container().builtin_id(); CODE_LOOKUP_RESULT_FWD_ACCESSOR(has_handler_table, bool)
#else CODE_LOOKUP_RESULT_FWD_ACCESSOR(is_baseline_trampoline_builtin, bool)
return code().builtin_id(); CODE_LOOKUP_RESULT_FWD_ACCESSOR(is_interpreter_trampoline_builtin, bool)
#endif CODE_LOOKUP_RESULT_FWD_ACCESSOR(is_baseline_leave_frame_builtin, bool)
} CODE_LOOKUP_RESULT_FWD_ACCESSOR(is_maglevved, bool)
CODE_LOOKUP_RESULT_FWD_ACCESSOR(is_turbofanned, bool)
CODE_LOOKUP_RESULT_FWD_ACCESSOR(stack_slots, int)
CODE_LOOKUP_RESULT_FWD_ACCESSOR(GetBuiltinCatchPrediction,
HandlerTable::CatchPrediction)
#undef CODE_LOOKUP_RESULT_FWD_ACCESSOR
Code CodeLookupResult::ToCode() const { Code CodeLookupResult::ToCode() const {
#ifdef V8_EXTERNAL_CODE_SPACE #ifdef V8_EXTERNAL_CODE_SPACE
...@@ -896,11 +914,25 @@ inline bool Code::checks_tiering_state() const { ...@@ -896,11 +914,25 @@ inline bool Code::checks_tiering_state() const {
(CodeKindCanDeoptimize(kind()) && marked_for_deoptimization()); (CodeKindCanDeoptimize(kind()) && marked_for_deoptimization());
} }
namespace {
inline constexpr bool CodeKindHasTaggedOutgoingParams(CodeKind kind) {
return kind != CodeKind::JS_TO_WASM_FUNCTION &&
kind != CodeKind::C_WASM_ENTRY && kind != CodeKind::WASM_FUNCTION;
}
} // namespace
inline bool Code::has_tagged_outgoing_params() const { inline bool Code::has_tagged_outgoing_params() const {
return kind() != CodeKind::JS_TO_WASM_FUNCTION && return CodeKindHasTaggedOutgoingParams(kind());
kind() != CodeKind::C_WASM_ENTRY && kind() != CodeKind::WASM_FUNCTION;
} }
#ifdef V8_EXTERNAL_CODE_SPACE
inline bool CodeDataContainer::has_tagged_outgoing_params() const {
return CodeKindHasTaggedOutgoingParams(kind());
}
#endif
inline bool Code::is_turbofanned() const { inline bool Code::is_turbofanned() const {
const uint32_t flags = RELAXED_READ_UINT32_FIELD(*this, kFlagsOffset); const uint32_t flags = RELAXED_READ_UINT32_FIELD(*this, kFlagsOffset);
return IsTurbofannedField::decode(flags); return IsTurbofannedField::decode(flags);
......
...@@ -191,12 +191,15 @@ class CodeDataContainer : public HeapObject { ...@@ -191,12 +191,15 @@ class CodeDataContainer : public HeapObject {
// For normal Code objects these functions just return the // For normal Code objects these functions just return the
// raw_instruction_start/end() values. // raw_instruction_start/end() values.
// TODO(11527): remove these versions once the full solution is ready. // TODO(11527): remove these versions once the full solution is ready.
Address OffHeapInstructionStart(Isolate* isolate, Address pc) const;
Address OffHeapInstructionEnd(Isolate* isolate, Address pc) const;
bool OffHeapBuiltinContains(Isolate* isolate, Address pc) const;
inline Address InstructionStart(Isolate* isolate, Address pc) const; inline Address InstructionStart(Isolate* isolate, Address pc) const;
V8_EXPORT_PRIVATE Address OffHeapInstructionStart(Isolate* isolate,
Address pc) const;
inline Address InstructionEnd(Isolate* isolate, Address pc) const; inline Address InstructionEnd(Isolate* isolate, Address pc) const;
V8_EXPORT_PRIVATE Address OffHeapInstructionEnd(Isolate* isolate,
Address pc) const;
V8_EXPORT_PRIVATE bool OffHeapBuiltinContains(Isolate* isolate,
Address pc) const;
inline Address InstructionEnd() const; inline Address InstructionEnd() const;
inline int InstructionSize() const; inline int InstructionSize() const;
...@@ -888,15 +891,20 @@ class CodeLookupResult { ...@@ -888,15 +891,20 @@ class CodeLookupResult {
#endif #endif
} }
// Helper method, in case of successful lookup returns the kind() of // Helper methods, in case of successful lookup return the result of
// the Code/CodeDataContainer object found. // respective accessor of the Code/CodeDataContainer object found.
// It's safe use from GC. // It's safe use them from GC.
inline CodeKind kind() const; inline CodeKind kind() const;
// Helper method, in case of successful lookup returns the builtin_id() of
// the Code/CodeDataContainer object found.
// It's safe use from GC.
inline Builtin builtin_id() const; inline Builtin builtin_id() const;
inline bool has_tagged_outgoing_params() const;
inline bool has_handler_table() const;
inline bool is_baseline_trampoline_builtin() const;
inline bool is_interpreter_trampoline_builtin() const;
inline bool is_baseline_leave_frame_builtin() const;
inline bool is_maglevved() const;
inline bool is_turbofanned() const;
inline int stack_slots() const;
inline HandlerTable::CatchPrediction GetBuiltinCatchPrediction() const;
// Helper method, coverts the successful lookup result to Code object. // Helper method, coverts the successful lookup result to Code object.
// It's not safe to be used from GC because conversion to Code might perform // It's not safe to be used from GC because conversion to Code might perform
...@@ -951,7 +959,10 @@ inline Code FromCodeT(CodeT code, AcquireLoadTag); ...@@ -951,7 +959,10 @@ inline Code FromCodeT(CodeT code, AcquireLoadTag);
inline Code FromCodeT(CodeT code, PtrComprCageBase); inline Code FromCodeT(CodeT code, PtrComprCageBase);
inline Code FromCodeT(CodeT code, PtrComprCageBase, RelaxedLoadTag); inline Code FromCodeT(CodeT code, PtrComprCageBase, RelaxedLoadTag);
inline Code FromCodeT(CodeT code, PtrComprCageBase, AcquireLoadTag); inline Code FromCodeT(CodeT code, PtrComprCageBase, AcquireLoadTag);
inline Handle<CodeT> FromCodeT(Handle<Code> code, Isolate* isolate); inline Handle<Code> FromCodeT(Handle<CodeT> code, Isolate* isolate);
inline AbstractCode ToAbstractCode(CodeT code);
inline Handle<AbstractCode> ToAbstractCode(Handle<CodeT> code,
Isolate* isolate);
inline CodeDataContainer CodeDataContainerFromCodeT(CodeT code); inline CodeDataContainer CodeDataContainerFromCodeT(CodeT code);
// AbsractCode is an helper wrapper around {Code | BytecodeArray} or // AbsractCode is an helper wrapper around {Code | BytecodeArray} or
......
...@@ -1234,7 +1234,7 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const { ...@@ -1234,7 +1234,7 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
for (const MapAndHandler& map_and_handler : maps_and_handlers) { for (const MapAndHandler& map_and_handler : maps_and_handlers) {
const MaybeObjectHandle maybe_code_handler = map_and_handler.second; const MaybeObjectHandle maybe_code_handler = map_and_handler.second;
// The first handler that isn't the slow handler will have the bits we need. // The first handler that isn't the slow handler will have the bits we need.
Handle<Code> handler; Builtin builtin_handler = Builtin::kNoBuiltinId;
if (maybe_code_handler.object()->IsStoreHandler()) { if (maybe_code_handler.object()->IsStoreHandler()) {
Handle<StoreHandler> data_handler = Handle<StoreHandler> data_handler =
Handle<StoreHandler>::cast(maybe_code_handler.object()); Handle<StoreHandler>::cast(maybe_code_handler.object());
...@@ -1246,8 +1246,8 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const { ...@@ -1246,8 +1246,8 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
if (mode != STANDARD_STORE) return mode; if (mode != STANDARD_STORE) return mode;
continue; continue;
} else { } else {
Code code = FromCodeT(CodeT::cast(data_handler->smi_handler())); CodeT code = CodeT::cast(data_handler->smi_handler());
handler = config()->NewHandle(code); builtin_handler = code.builtin_id();
} }
} else if (maybe_code_handler.object()->IsSmi()) { } else if (maybe_code_handler.object()->IsSmi()) {
...@@ -1265,19 +1265,14 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const { ...@@ -1265,19 +1265,14 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
continue; continue;
} else { } else {
// Element store without prototype chain check. // Element store without prototype chain check.
if (V8_EXTERNAL_CODE_SPACE_BOOL) { CodeT code = CodeT::cast(*maybe_code_handler.object());
Code code = FromCodeT(CodeT::cast(*maybe_code_handler.object())); builtin_handler = code.builtin_id();
handler = config()->NewHandle(code);
} else {
handler = Handle<Code>::cast(maybe_code_handler.object());
}
} }
if (handler->is_builtin()) { if (Builtins::IsBuiltinId(builtin_handler)) {
Builtin builtin = handler->builtin_id(); if (!BuiltinHasKeyedAccessStoreMode(builtin_handler)) continue;
if (!BuiltinHasKeyedAccessStoreMode(builtin)) continue;
mode = KeyedAccessStoreModeForBuiltin(builtin); mode = KeyedAccessStoreModeForBuiltin(builtin_handler);
break; break;
} }
} }
......
...@@ -63,7 +63,7 @@ AbstractCode JSFunction::abstract_code(IsolateT* isolate) { ...@@ -63,7 +63,7 @@ AbstractCode JSFunction::abstract_code(IsolateT* isolate) {
if (ActiveTierIsIgnition()) { if (ActiveTierIsIgnition()) {
return AbstractCode::cast(shared().GetBytecodeArray(isolate)); return AbstractCode::cast(shared().GetBytecodeArray(isolate));
} else { } else {
return AbstractCode::cast(FromCodeT(code(kAcquireLoad))); return ToAbstractCode(code(kAcquireLoad));
} }
} }
......
...@@ -351,7 +351,8 @@ bool HeapObject::IsAbstractCode() const { ...@@ -351,7 +351,8 @@ bool HeapObject::IsAbstractCode() const {
return HeapObject::IsAbstractCode(cage_base); return HeapObject::IsAbstractCode(cage_base);
} }
bool HeapObject::IsAbstractCode(PtrComprCageBase cage_base) const { bool HeapObject::IsAbstractCode(PtrComprCageBase cage_base) const {
return IsBytecodeArray(cage_base) || IsCode(cage_base); return IsBytecodeArray(cage_base) || IsCode(cage_base) ||
(V8_REMOVE_BUILTINS_CODE_OBJECTS && IsCodeDataContainer(cage_base));
} }
DEF_GETTER(HeapObject, IsStringWrapper, bool) { DEF_GETTER(HeapObject, IsStringWrapper, bool) {
......
...@@ -197,10 +197,10 @@ template <typename IsolateT> ...@@ -197,10 +197,10 @@ template <typename IsolateT>
AbstractCode SharedFunctionInfo::abstract_code(IsolateT* isolate) { AbstractCode SharedFunctionInfo::abstract_code(IsolateT* isolate) {
// TODO(v8:11429): Decide if this return bytecode or baseline code, when the // TODO(v8:11429): Decide if this return bytecode or baseline code, when the
// latter is present. // latter is present.
if (HasBytecodeArray()) { if (HasBytecodeArray(isolate)) {
return AbstractCode::cast(GetBytecodeArray(isolate)); return AbstractCode::cast(GetBytecodeArray(isolate));
} else { } else {
return AbstractCode::cast(FromCodeT(GetCode())); return ToAbstractCode(GetCode());
} }
} }
...@@ -876,13 +876,13 @@ bool SharedFunctionInfo::is_repl_mode() const { ...@@ -876,13 +876,13 @@ bool SharedFunctionInfo::is_repl_mode() const {
return script().IsScript() && Script::cast(script()).is_repl_mode(); return script().IsScript() && Script::cast(script()).is_repl_mode();
} }
bool SharedFunctionInfo::HasDebugInfo() const { DEF_GETTER(SharedFunctionInfo, HasDebugInfo, bool) {
return script_or_debug_info(kAcquireLoad).IsDebugInfo(); return script_or_debug_info(cage_base, kAcquireLoad).IsDebugInfo(cage_base);
} }
DebugInfo SharedFunctionInfo::GetDebugInfo() const { DEF_GETTER(SharedFunctionInfo, GetDebugInfo, DebugInfo) {
auto debug_info = script_or_debug_info(kAcquireLoad); auto debug_info = script_or_debug_info(cage_base, kAcquireLoad);
DCHECK(debug_info.IsDebugInfo()); DCHECK(debug_info.IsDebugInfo(cage_base));
return DebugInfo::cast(debug_info); return DebugInfo::cast(debug_info);
} }
......
...@@ -416,8 +416,8 @@ class SharedFunctionInfo ...@@ -416,8 +416,8 @@ class SharedFunctionInfo
inline bool is_repl_mode() const; inline bool is_repl_mode() const;
// The function is subject to debugging if a debug info is attached. // The function is subject to debugging if a debug info is attached.
inline bool HasDebugInfo() const; DECL_GETTER(HasDebugInfo, bool)
inline DebugInfo GetDebugInfo() const; DECL_GETTER(GetDebugInfo, DebugInfo)
inline void SetDebugInfo(DebugInfo debug_info); inline void SetDebugInfo(DebugInfo debug_info);
// The offset of the 'function' token in the script source relative to the // The offset of the 'function' token in the script source relative to the
......
...@@ -412,7 +412,7 @@ void ProfilerCodeObserver::LogBuiltins() { ...@@ -412,7 +412,7 @@ void ProfilerCodeObserver::LogBuiltins() {
++builtin) { ++builtin) {
CodeEventsContainer evt_rec(CodeEventRecord::Type::kReportBuiltin); CodeEventsContainer evt_rec(CodeEventRecord::Type::kReportBuiltin);
ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
Code code = FromCodeT(builtins->code(builtin)); CodeT code = builtins->code(builtin);
rec->instruction_start = code.InstructionStart(); rec->instruction_start = code.InstructionStart();
rec->instruction_size = code.InstructionSize(); rec->instruction_size = code.InstructionSize();
rec->builtin = builtin; rec->builtin = builtin;
......
...@@ -405,9 +405,9 @@ RUNTIME_FUNCTION(Runtime_CompileOptimizedOSR) { ...@@ -405,9 +405,9 @@ RUNTIME_FUNCTION(Runtime_CompileOptimizedOSR) {
UnoptimizedFrame* frame = UnoptimizedFrame::cast(it.frame()); UnoptimizedFrame* frame = UnoptimizedFrame::cast(it.frame());
DCHECK_IMPLIES(frame->is_interpreted(), DCHECK_IMPLIES(frame->is_interpreted(),
frame->LookupCode().is_interpreter_trampoline_builtin()); frame->LookupCodeT().is_interpreter_trampoline_builtin());
DCHECK_IMPLIES(frame->is_baseline(), DCHECK_IMPLIES(frame->is_baseline(),
frame->LookupCode().kind() == CodeKind::BASELINE); frame->LookupCodeT().kind() == CodeKind::BASELINE);
DCHECK(frame->function().shared().HasBytecodeArray()); DCHECK(frame->function().shared().HasBytecodeArray());
// Determine the entry point for which this OSR request has been fired. // Determine the entry point for which this OSR request has been fired.
......
...@@ -131,7 +131,7 @@ void Serializer::SerializeObject(Handle<HeapObject> obj) { ...@@ -131,7 +131,7 @@ void Serializer::SerializeObject(Handle<HeapObject> obj) {
if (obj->IsThinString(isolate())) { if (obj->IsThinString(isolate())) {
obj = handle(ThinString::cast(*obj).actual(isolate()), isolate()); obj = handle(ThinString::cast(*obj).actual(isolate()), isolate());
} else if (obj->IsCodeT(isolate())) { } else if (obj->IsCodeT(isolate())) {
Code code = FromCodeT(CodeT::cast(*obj)); CodeT code = CodeT::cast(*obj);
if (code.kind() == CodeKind::BASELINE) { if (code.kind() == CodeKind::BASELINE) {
// For now just serialize the BytecodeArray instead of baseline code. // For now just serialize the BytecodeArray instead of baseline code.
// TODO(v8:11429,pthier): Handle Baseline code in cases we want to // TODO(v8:11429,pthier): Handle Baseline code in cases we want to
......
...@@ -533,8 +533,7 @@ static void StackCheck(Local<String> name, ...@@ -533,8 +533,7 @@ static void StackCheck(Local<String> name,
for (int i = 0; !iter.done(); i++) { for (int i = 0; !iter.done(); i++) {
i::StackFrame* frame = iter.frame(); i::StackFrame* frame = iter.frame();
CHECK(i != 0 || (frame->type() == i::StackFrame::EXIT)); CHECK(i != 0 || (frame->type() == i::StackFrame::EXIT));
i::Code code = frame->LookupCode(); i::CodeT code = frame->LookupCodeT().ToCodeT();
CHECK(code.IsCode());
CHECK(code.contains(isolate, frame->pc())); CHECK(code.contains(isolate, frame->pc()));
iter.Advance(); iter.Advance();
} }
......
...@@ -4496,7 +4496,7 @@ TEST(BuiltinsExceptionPrediction) { ...@@ -4496,7 +4496,7 @@ TEST(BuiltinsExceptionPrediction) {
bool fail = false; bool fail = false;
for (i::Builtin builtin = i::Builtins::kFirst; builtin <= i::Builtins::kLast; for (i::Builtin builtin = i::Builtins::kFirst; builtin <= i::Builtins::kLast;
++builtin) { ++builtin) {
i::Code code = FromCodeT(builtins->code(builtin)); i::CodeT code = builtins->code(builtin);
if (code.kind() != i::CodeKind::BUILTIN) continue; if (code.kind() != i::CodeKind::BUILTIN) continue;
auto prediction = code.GetBuiltinCatchPrediction(); auto prediction = code.GetBuiltinCatchPrediction();
USE(prediction); USE(prediction);
......
...@@ -168,7 +168,7 @@ TEST(Unwind_BuiltinPCInMiddle_Success_CodePagesAPI) { ...@@ -168,7 +168,7 @@ TEST(Unwind_BuiltinPCInMiddle_Success_CodePagesAPI) {
register_state.fp = stack; register_state.fp = stack;
// Put the current PC inside of a valid builtin. // Put the current PC inside of a valid builtin.
Code builtin = FromCodeT(i_isolate->builtins()->code(Builtin::kStringEqual)); CodeT builtin = *BUILTIN_CODE(i_isolate, StringEqual);
const uintptr_t offset = 40; const uintptr_t offset = 40;
CHECK_LT(offset, builtin.InstructionSize()); CHECK_LT(offset, builtin.InstructionSize());
register_state.pc = register_state.pc =
...@@ -225,7 +225,7 @@ TEST(Unwind_BuiltinPCAtStart_Success_CodePagesAPI) { ...@@ -225,7 +225,7 @@ TEST(Unwind_BuiltinPCAtStart_Success_CodePagesAPI) {
// Put the current PC at the start of a valid builtin, so that we are setting // Put the current PC at the start of a valid builtin, so that we are setting
// up the frame. // up the frame.
Code builtin = FromCodeT(i_isolate->builtins()->code(Builtin::kStringEqual)); CodeT builtin = *BUILTIN_CODE(i_isolate, StringEqual);
register_state.pc = reinterpret_cast<void*>(builtin.InstructionStart()); register_state.pc = reinterpret_cast<void*>(builtin.InstructionStart());
bool unwound = v8::Unwinder::TryUnwindV8Frames( bool unwound = v8::Unwinder::TryUnwindV8Frames(
...@@ -457,7 +457,7 @@ TEST(Unwind_JSEntry_Fail_CodePagesAPI) { ...@@ -457,7 +457,7 @@ TEST(Unwind_JSEntry_Fail_CodePagesAPI) {
CHECK_LE(pages_length, arraysize(code_pages)); CHECK_LE(pages_length, arraysize(code_pages));
RegisterState register_state; RegisterState register_state;
Code js_entry = FromCodeT(i_isolate->builtins()->code(Builtin::kJSEntry)); CodeT js_entry = *BUILTIN_CODE(i_isolate, JSEntry);
byte* start = reinterpret_cast<byte*>(js_entry.InstructionStart()); byte* start = reinterpret_cast<byte*>(js_entry.InstructionStart());
register_state.pc = start + 10; register_state.pc = start + 10;
...@@ -639,7 +639,7 @@ TEST(PCIsInV8_InJSEntryRange_CodePagesAPI) { ...@@ -639,7 +639,7 @@ TEST(PCIsInV8_InJSEntryRange_CodePagesAPI) {
isolate->CopyCodePages(arraysize(code_pages), code_pages); isolate->CopyCodePages(arraysize(code_pages), code_pages);
CHECK_LE(pages_length, arraysize(code_pages)); CHECK_LE(pages_length, arraysize(code_pages));
Code js_entry = FromCodeT(i_isolate->builtins()->code(Builtin::kJSEntry)); CodeT js_entry = *BUILTIN_CODE(i_isolate, JSEntry);
byte* start = reinterpret_cast<byte*>(js_entry.InstructionStart()); byte* start = reinterpret_cast<byte*>(js_entry.InstructionStart());
size_t length = js_entry.InstructionSize(); size_t length = js_entry.InstructionSize();
......
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