Split some SharedFunctionInfo's compiler hints off into debugger hints.
We are planning to add a few more debugger related bits, and are running out of compiler hints bits. The new bit field is going to be part of the debug info struct. If the debug info is not available, we store the bit field in its place on the shared function info. Review-Url: https://codereview.chromium.org/2649873002 Cr-Commit-Position: refs/heads/master@{#42594}
This commit is contained in:
parent
53a887e4c6
commit
3a9152ece7
@ -1002,7 +1002,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
|||||||
Register debug_info = kInterpreterBytecodeArrayRegister;
|
Register debug_info = kInterpreterBytecodeArrayRegister;
|
||||||
DCHECK(!debug_info.is(r0));
|
DCHECK(!debug_info.is(r0));
|
||||||
__ ldr(debug_info, FieldMemOperand(r0, SharedFunctionInfo::kDebugInfoOffset));
|
__ ldr(debug_info, FieldMemOperand(r0, SharedFunctionInfo::kDebugInfoOffset));
|
||||||
__ cmp(debug_info, Operand(DebugInfo::uninitialized()));
|
__ SmiTst(debug_info);
|
||||||
// Load original bytecode array or the debug copy.
|
// Load original bytecode array or the debug copy.
|
||||||
__ ldr(kInterpreterBytecodeArrayRegister,
|
__ ldr(kInterpreterBytecodeArrayRegister,
|
||||||
FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset), eq);
|
FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset), eq);
|
||||||
|
@ -1007,8 +1007,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
|||||||
Label load_debug_bytecode_array, bytecode_array_loaded;
|
Label load_debug_bytecode_array, bytecode_array_loaded;
|
||||||
DCHECK(!debug_info.is(x0));
|
DCHECK(!debug_info.is(x0));
|
||||||
__ Ldr(debug_info, FieldMemOperand(x0, SharedFunctionInfo::kDebugInfoOffset));
|
__ Ldr(debug_info, FieldMemOperand(x0, SharedFunctionInfo::kDebugInfoOffset));
|
||||||
__ Cmp(debug_info, Operand(DebugInfo::uninitialized()));
|
__ JumpIfNotSmi(debug_info, &load_debug_bytecode_array);
|
||||||
__ B(ne, &load_debug_bytecode_array);
|
|
||||||
__ Ldr(kInterpreterBytecodeArrayRegister,
|
__ Ldr(kInterpreterBytecodeArrayRegister,
|
||||||
FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset));
|
FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset));
|
||||||
__ Bind(&bytecode_array_loaded);
|
__ Bind(&bytecode_array_loaded);
|
||||||
|
@ -534,9 +534,8 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
|||||||
// it is present) and load it into kInterpreterBytecodeArrayRegister.
|
// it is present) and load it into kInterpreterBytecodeArrayRegister.
|
||||||
__ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
|
__ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
|
||||||
Label load_debug_bytecode_array, bytecode_array_loaded;
|
Label load_debug_bytecode_array, bytecode_array_loaded;
|
||||||
__ cmp(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset),
|
__ JumpIfNotSmi(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset),
|
||||||
Immediate(DebugInfo::uninitialized()));
|
&load_debug_bytecode_array);
|
||||||
__ j(not_equal, &load_debug_bytecode_array);
|
|
||||||
__ mov(kInterpreterBytecodeArrayRegister,
|
__ mov(kInterpreterBytecodeArrayRegister,
|
||||||
FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset));
|
FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset));
|
||||||
__ bind(&bytecode_array_loaded);
|
__ bind(&bytecode_array_loaded);
|
||||||
|
@ -1005,8 +1005,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
|||||||
Register debug_info = kInterpreterBytecodeArrayRegister;
|
Register debug_info = kInterpreterBytecodeArrayRegister;
|
||||||
DCHECK(!debug_info.is(a0));
|
DCHECK(!debug_info.is(a0));
|
||||||
__ lw(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset));
|
__ lw(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset));
|
||||||
__ Branch(&load_debug_bytecode_array, ne, debug_info,
|
__ JumpIfNotSmi(debug_info, &load_debug_bytecode_array);
|
||||||
Operand(DebugInfo::uninitialized()));
|
|
||||||
__ lw(kInterpreterBytecodeArrayRegister,
|
__ lw(kInterpreterBytecodeArrayRegister,
|
||||||
FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
|
FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
|
||||||
__ bind(&bytecode_array_loaded);
|
__ bind(&bytecode_array_loaded);
|
||||||
|
@ -996,8 +996,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
|||||||
Register debug_info = kInterpreterBytecodeArrayRegister;
|
Register debug_info = kInterpreterBytecodeArrayRegister;
|
||||||
DCHECK(!debug_info.is(a0));
|
DCHECK(!debug_info.is(a0));
|
||||||
__ ld(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset));
|
__ ld(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset));
|
||||||
__ Branch(&load_debug_bytecode_array, ne, debug_info,
|
__ JumpIfNotSmi(debug_info, &load_debug_bytecode_array);
|
||||||
Operand(DebugInfo::uninitialized()));
|
|
||||||
__ ld(kInterpreterBytecodeArrayRegister,
|
__ ld(kInterpreterBytecodeArrayRegister,
|
||||||
FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
|
FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
|
||||||
__ bind(&bytecode_array_loaded);
|
__ bind(&bytecode_array_loaded);
|
||||||
|
@ -610,10 +610,8 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
|||||||
// it is present) and load it into kInterpreterBytecodeArrayRegister.
|
// it is present) and load it into kInterpreterBytecodeArrayRegister.
|
||||||
__ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
|
__ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
|
||||||
Label load_debug_bytecode_array, bytecode_array_loaded;
|
Label load_debug_bytecode_array, bytecode_array_loaded;
|
||||||
DCHECK_EQ(Smi::kZero, DebugInfo::uninitialized());
|
__ JumpIfNotSmi(FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset),
|
||||||
__ cmpp(FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset),
|
&load_debug_bytecode_array);
|
||||||
Immediate(0));
|
|
||||||
__ j(not_equal, &load_debug_bytecode_array);
|
|
||||||
__ movp(kInterpreterBytecodeArrayRegister,
|
__ movp(kInterpreterBytecodeArrayRegister,
|
||||||
FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset));
|
FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset));
|
||||||
__ bind(&bytecode_array_loaded);
|
__ bind(&bytecode_array_loaded);
|
||||||
|
@ -1560,8 +1560,8 @@ void Debug::RemoveDebugInfoAndClearFromShared(Handle<DebugInfo> debug_info) {
|
|||||||
} else {
|
} else {
|
||||||
prev->set_next(current->next());
|
prev->set_next(current->next());
|
||||||
}
|
}
|
||||||
|
shared->set_debug_info(Smi::FromInt(debug_info->debugger_hints()));
|
||||||
delete current;
|
delete current;
|
||||||
shared->set_debug_info(DebugInfo::uninitialized());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Move to next in list.
|
// Move to next in list.
|
||||||
|
@ -2405,7 +2405,7 @@ Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
|
|||||||
share->SetConstructStub(*construct_stub);
|
share->SetConstructStub(*construct_stub);
|
||||||
share->set_instance_class_name(*Object_string());
|
share->set_instance_class_name(*Object_string());
|
||||||
share->set_script(*undefined_value(), SKIP_WRITE_BARRIER);
|
share->set_script(*undefined_value(), SKIP_WRITE_BARRIER);
|
||||||
share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER);
|
share->set_debug_info(Smi::kZero, SKIP_WRITE_BARRIER);
|
||||||
share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER);
|
share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER);
|
||||||
StaticFeedbackVectorSpec empty_spec;
|
StaticFeedbackVectorSpec empty_spec;
|
||||||
Handle<TypeFeedbackMetadata> feedback_metadata =
|
Handle<TypeFeedbackMetadata> feedback_metadata =
|
||||||
@ -2509,6 +2509,7 @@ Handle<String> Factory::NumberToString(Handle<Object> number,
|
|||||||
|
|
||||||
|
|
||||||
Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
|
Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
|
||||||
|
DCHECK(!shared->HasDebugInfo());
|
||||||
// Allocate initial fixed array for active break points before allocating the
|
// Allocate initial fixed array for active break points before allocating the
|
||||||
// debug info object to avoid allocation while setting up the debug info
|
// debug info object to avoid allocation while setting up the debug info
|
||||||
// object.
|
// object.
|
||||||
@ -2528,6 +2529,7 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
|
|||||||
Handle<DebugInfo> debug_info =
|
Handle<DebugInfo> debug_info =
|
||||||
Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE));
|
Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE));
|
||||||
debug_info->set_shared(*shared);
|
debug_info->set_shared(*shared);
|
||||||
|
debug_info->set_debugger_hints(shared->debugger_hints());
|
||||||
debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array);
|
debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array);
|
||||||
debug_info->set_break_points(*break_points);
|
debug_info->set_break_points(*break_points);
|
||||||
|
|
||||||
|
@ -476,7 +476,12 @@ class MacroAssembler: public Assembler {
|
|||||||
test(value, Immediate(kSmiTagMask));
|
test(value, Immediate(kSmiTagMask));
|
||||||
j(not_zero, not_smi_label, distance);
|
j(not_zero, not_smi_label, distance);
|
||||||
}
|
}
|
||||||
|
// Jump if the operand is not a smi.
|
||||||
|
inline void JumpIfNotSmi(Operand value, Label* smi_label,
|
||||||
|
Label::Distance distance = Label::kFar) {
|
||||||
|
test(value, Immediate(kSmiTagMask));
|
||||||
|
j(not_zero, smi_label, distance);
|
||||||
|
}
|
||||||
// Jump if the value cannot be represented by a smi.
|
// Jump if the value cannot be represented by a smi.
|
||||||
inline void JumpIfNotValidSmiValue(Register value, Register scratch,
|
inline void JumpIfNotValidSmiValue(Register value, Register scratch,
|
||||||
Label* on_invalid,
|
Label* on_invalid,
|
||||||
|
@ -5974,6 +5974,7 @@ void Script::set_origin_options(ScriptOriginOptions origin_options) {
|
|||||||
|
|
||||||
|
|
||||||
ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex)
|
ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex)
|
||||||
|
SMI_ACCESSORS(DebugInfo, debugger_hints, kDebuggerHintsIndex)
|
||||||
ACCESSORS(DebugInfo, debug_bytecode_array, Object, kDebugBytecodeArrayIndex)
|
ACCESSORS(DebugInfo, debug_bytecode_array, Object, kDebugBytecodeArrayIndex)
|
||||||
ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex)
|
ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex)
|
||||||
|
|
||||||
@ -6043,23 +6044,6 @@ BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_named_expression,
|
|||||||
BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel,
|
BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel,
|
||||||
kIsTopLevelBit)
|
kIsTopLevelBit)
|
||||||
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, allows_lazy_compilation,
|
|
||||||
kAllowLazyCompilation)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo,
|
|
||||||
compiler_hints,
|
|
||||||
uses_arguments,
|
|
||||||
kUsesArguments)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo,
|
|
||||||
compiler_hints,
|
|
||||||
has_duplicate_parameters,
|
|
||||||
kHasDuplicateParameters)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, asm_function, kIsAsmFunction)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, deserialized, kDeserialized)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_declaration,
|
|
||||||
kIsDeclaration)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, marked_for_tier_up,
|
|
||||||
kMarkedForTierUp)
|
|
||||||
|
|
||||||
#if V8_HOST_ARCH_32_BIT
|
#if V8_HOST_ARCH_32_BIT
|
||||||
SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset)
|
SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset)
|
||||||
SMI_ACCESSORS(SharedFunctionInfo, internal_formal_parameter_count,
|
SMI_ACCESSORS(SharedFunctionInfo, internal_formal_parameter_count,
|
||||||
@ -6144,12 +6128,6 @@ PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
BOOL_GETTER(SharedFunctionInfo,
|
|
||||||
compiler_hints,
|
|
||||||
optimization_disabled,
|
|
||||||
kOptimizationDisabled)
|
|
||||||
|
|
||||||
AbstractCode* SharedFunctionInfo::abstract_code() {
|
AbstractCode* SharedFunctionInfo::abstract_code() {
|
||||||
if (HasBytecodeArray()) {
|
if (HasBytecodeArray()) {
|
||||||
return AbstractCode::cast(bytecode_array());
|
return AbstractCode::cast(bytecode_array());
|
||||||
@ -6158,20 +6136,43 @@ AbstractCode* SharedFunctionInfo::abstract_code() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, allows_lazy_compilation,
|
||||||
|
kAllowLazyCompilation)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, uses_arguments,
|
||||||
|
kUsesArguments)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, has_duplicate_parameters,
|
||||||
|
kHasDuplicateParameters)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, asm_function, kIsAsmFunction)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_declaration,
|
||||||
|
kIsDeclaration)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, marked_for_tier_up,
|
||||||
|
kMarkedForTierUp)
|
||||||
|
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object,
|
||||||
|
kNeedsHomeObject)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, must_use_ignition_turbo,
|
||||||
|
kMustUseIgnitionTurbo)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush)
|
||||||
|
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_asm_wasm_broken,
|
||||||
|
kIsAsmWasmBroken)
|
||||||
|
|
||||||
|
BOOL_GETTER(SharedFunctionInfo, compiler_hints, optimization_disabled,
|
||||||
|
kOptimizationDisabled)
|
||||||
|
|
||||||
void SharedFunctionInfo::set_optimization_disabled(bool disable) {
|
void SharedFunctionInfo::set_optimization_disabled(bool disable) {
|
||||||
set_compiler_hints(BooleanBit::set(compiler_hints(),
|
set_compiler_hints(BooleanBit::set(compiler_hints(),
|
||||||
kOptimizationDisabled,
|
kOptimizationDisabled,
|
||||||
disable));
|
disable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LanguageMode SharedFunctionInfo::language_mode() {
|
LanguageMode SharedFunctionInfo::language_mode() {
|
||||||
STATIC_ASSERT(LANGUAGE_END == 2);
|
STATIC_ASSERT(LANGUAGE_END == 2);
|
||||||
return construct_language_mode(
|
return construct_language_mode(
|
||||||
BooleanBit::get(compiler_hints(), kStrictModeFunction));
|
BooleanBit::get(compiler_hints(), kStrictModeFunction));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
|
void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
|
||||||
STATIC_ASSERT(LANGUAGE_END == 2);
|
STATIC_ASSERT(LANGUAGE_END == 2);
|
||||||
// We only allow language mode transitions that set the same language mode
|
// We only allow language mode transitions that set the same language mode
|
||||||
@ -6186,7 +6187,6 @@ FunctionKind SharedFunctionInfo::kind() const {
|
|||||||
return FunctionKindBits::decode(compiler_hints());
|
return FunctionKindBits::decode(compiler_hints());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SharedFunctionInfo::set_kind(FunctionKind kind) {
|
void SharedFunctionInfo::set_kind(FunctionKind kind) {
|
||||||
DCHECK(IsValidFunctionKind(kind));
|
DCHECK(IsValidFunctionKind(kind));
|
||||||
int hints = compiler_hints();
|
int hints = compiler_hints();
|
||||||
@ -6194,23 +6194,14 @@ void SharedFunctionInfo::set_kind(FunctionKind kind) {
|
|||||||
set_compiler_hints(hints);
|
set_compiler_hints(hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object,
|
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints,
|
||||||
kNeedsHomeObject)
|
name_should_print_as_anonymous, kNameShouldPrintAsAnonymous)
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
|
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, is_anonymous_expression,
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
|
|
||||||
name_should_print_as_anonymous,
|
|
||||||
kNameShouldPrintAsAnonymous)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous_expression,
|
|
||||||
kIsAnonymousExpression)
|
kIsAnonymousExpression)
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, must_use_ignition_turbo,
|
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, deserialized, kDeserialized)
|
||||||
kMustUseIgnitionTurbo)
|
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, has_no_side_effect,
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_asm_wasm_broken,
|
|
||||||
kIsAsmWasmBroken)
|
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, has_no_side_effect,
|
|
||||||
kHasNoSideEffect)
|
kHasNoSideEffect)
|
||||||
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, computed_has_no_side_effect,
|
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, computed_has_no_side_effect,
|
||||||
kComputedHasNoSideEffect)
|
kComputedHasNoSideEffect)
|
||||||
|
|
||||||
bool Script::HasValidSource() {
|
bool Script::HasValidSource() {
|
||||||
@ -6315,25 +6306,35 @@ bool SharedFunctionInfo::has_simple_parameters() {
|
|||||||
return scope_info()->HasSimpleParameters();
|
return scope_info()->HasSimpleParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SharedFunctionInfo::HasDebugInfo() const {
|
||||||
bool SharedFunctionInfo::HasDebugInfo() {
|
bool has_debug_info = !debug_info()->IsSmi();
|
||||||
bool has_debug_info = debug_info()->IsStruct();
|
DCHECK_EQ(debug_info()->IsStruct(), has_debug_info);
|
||||||
DCHECK(!has_debug_info || HasDebugCode());
|
DCHECK(!has_debug_info || HasDebugCode());
|
||||||
return has_debug_info;
|
return has_debug_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugInfo* SharedFunctionInfo::GetDebugInfo() const {
|
||||||
DebugInfo* SharedFunctionInfo::GetDebugInfo() {
|
|
||||||
DCHECK(HasDebugInfo());
|
DCHECK(HasDebugInfo());
|
||||||
return DebugInfo::cast(debug_info());
|
return DebugInfo::cast(debug_info());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SharedFunctionInfo::HasDebugCode() const {
|
||||||
bool SharedFunctionInfo::HasDebugCode() {
|
|
||||||
if (HasBaselineCode()) return code()->has_debug_break_slots();
|
if (HasBaselineCode()) return code()->has_debug_break_slots();
|
||||||
return HasBytecodeArray();
|
return HasBytecodeArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SharedFunctionInfo::debugger_hints() const {
|
||||||
|
if (HasDebugInfo()) return GetDebugInfo()->debugger_hints();
|
||||||
|
return Smi::cast(debug_info())->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SharedFunctionInfo::set_debugger_hints(int value) {
|
||||||
|
if (HasDebugInfo()) {
|
||||||
|
GetDebugInfo()->set_debugger_hints(value);
|
||||||
|
} else {
|
||||||
|
set_debug_info(Smi::FromInt(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool SharedFunctionInfo::IsApiFunction() {
|
bool SharedFunctionInfo::IsApiFunction() {
|
||||||
return function_data()->IsFunctionTemplateInfo();
|
return function_data()->IsFunctionTemplateInfo();
|
||||||
@ -6350,11 +6351,11 @@ void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) {
|
|||||||
set_function_data(data);
|
set_function_data(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharedFunctionInfo::HasBytecodeArray() {
|
bool SharedFunctionInfo::HasBytecodeArray() const {
|
||||||
return function_data()->IsBytecodeArray();
|
return function_data()->IsBytecodeArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
BytecodeArray* SharedFunctionInfo::bytecode_array() {
|
BytecodeArray* SharedFunctionInfo::bytecode_array() const {
|
||||||
DCHECK(HasBytecodeArray());
|
DCHECK(HasBytecodeArray());
|
||||||
return BytecodeArray::cast(function_data());
|
return BytecodeArray::cast(function_data());
|
||||||
}
|
}
|
||||||
@ -6369,11 +6370,11 @@ void SharedFunctionInfo::ClearBytecodeArray() {
|
|||||||
set_function_data(GetHeap()->undefined_value());
|
set_function_data(GetHeap()->undefined_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharedFunctionInfo::HasAsmWasmData() {
|
bool SharedFunctionInfo::HasAsmWasmData() const {
|
||||||
return function_data()->IsFixedArray();
|
return function_data()->IsFixedArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedArray* SharedFunctionInfo::asm_wasm_data() {
|
FixedArray* SharedFunctionInfo::asm_wasm_data() const {
|
||||||
DCHECK(HasAsmWasmData());
|
DCHECK(HasAsmWasmData());
|
||||||
return FixedArray::cast(function_data());
|
return FixedArray::cast(function_data());
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1094,11 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
|
|||||||
os << "\n - function token position = " << function_token_position();
|
os << "\n - function token position = " << function_token_position();
|
||||||
os << "\n - start position = " << start_position();
|
os << "\n - start position = " << start_position();
|
||||||
os << "\n - end position = " << end_position();
|
os << "\n - end position = " << end_position();
|
||||||
os << "\n - debug info = " << Brief(debug_info());
|
if (HasDebugInfo()) {
|
||||||
|
os << "\n - debug info = " << Brief(debug_info());
|
||||||
|
} else {
|
||||||
|
os << "\n - no debug info";
|
||||||
|
}
|
||||||
os << "\n - length = " << length();
|
os << "\n - length = " << length();
|
||||||
os << "\n - num_literals = " << num_literals();
|
os << "\n - num_literals = " << num_literals();
|
||||||
os << "\n - optimized_code_map = " << Brief(optimized_code_map());
|
os << "\n - optimized_code_map = " << Brief(optimized_code_map());
|
||||||
|
@ -7292,12 +7292,12 @@ class SharedFunctionInfo: public HeapObject {
|
|||||||
inline bool IsApiFunction();
|
inline bool IsApiFunction();
|
||||||
inline FunctionTemplateInfo* get_api_func_data();
|
inline FunctionTemplateInfo* get_api_func_data();
|
||||||
inline void set_api_func_data(FunctionTemplateInfo* data);
|
inline void set_api_func_data(FunctionTemplateInfo* data);
|
||||||
inline bool HasBytecodeArray();
|
inline bool HasBytecodeArray() const;
|
||||||
inline BytecodeArray* bytecode_array();
|
inline BytecodeArray* bytecode_array() const;
|
||||||
inline void set_bytecode_array(BytecodeArray* bytecode);
|
inline void set_bytecode_array(BytecodeArray* bytecode);
|
||||||
inline void ClearBytecodeArray();
|
inline void ClearBytecodeArray();
|
||||||
inline bool HasAsmWasmData();
|
inline bool HasAsmWasmData() const;
|
||||||
inline FixedArray* asm_wasm_data();
|
inline FixedArray* asm_wasm_data() const;
|
||||||
inline void set_asm_wasm_data(FixedArray* data);
|
inline void set_asm_wasm_data(FixedArray* data);
|
||||||
inline void ClearAsmWasmData();
|
inline void ClearAsmWasmData();
|
||||||
|
|
||||||
@ -7335,15 +7335,41 @@ class SharedFunctionInfo: public HeapObject {
|
|||||||
inline void set_start_position_and_type(int value);
|
inline void set_start_position_and_type(int value);
|
||||||
|
|
||||||
// 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();
|
inline bool HasDebugInfo() const;
|
||||||
inline DebugInfo* GetDebugInfo();
|
inline DebugInfo* GetDebugInfo() const;
|
||||||
|
|
||||||
// A function has debug code if the compiled code has debug break slots.
|
// A function has debug code if the compiled code has debug break slots.
|
||||||
inline bool HasDebugCode();
|
inline bool HasDebugCode() const;
|
||||||
|
|
||||||
// [debug info]: Debug information.
|
// [debug info]: Debug information.
|
||||||
DECL_ACCESSORS(debug_info, Object)
|
DECL_ACCESSORS(debug_info, Object)
|
||||||
|
|
||||||
|
// Bit field containing various information collected for debugging.
|
||||||
|
// This field is either stored on the kDebugInfo slot or inside the
|
||||||
|
// debug info struct.
|
||||||
|
inline int debugger_hints() const;
|
||||||
|
inline void set_debugger_hints(int value);
|
||||||
|
|
||||||
|
// Indicates that the function was created by the Function function.
|
||||||
|
// Though it's anonymous, toString should treat it as if it had the name
|
||||||
|
// "anonymous". We don't set the name itself so that the system does not
|
||||||
|
// see a binding for it.
|
||||||
|
DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)
|
||||||
|
|
||||||
|
// Indicates that the function is either an anonymous expression
|
||||||
|
// or an arrow function (the name field can be set through the API,
|
||||||
|
// which does not change this flag).
|
||||||
|
DECL_BOOLEAN_ACCESSORS(is_anonymous_expression)
|
||||||
|
|
||||||
|
// Indicates that the the shared function info is deserialized from cache.
|
||||||
|
DECL_BOOLEAN_ACCESSORS(deserialized)
|
||||||
|
|
||||||
|
// Indicates that the function cannot cause side-effects.
|
||||||
|
DECL_BOOLEAN_ACCESSORS(has_no_side_effect)
|
||||||
|
|
||||||
|
// Indicates that |has_no_side_effect| has been computed and set.
|
||||||
|
DECL_BOOLEAN_ACCESSORS(computed_has_no_side_effect)
|
||||||
|
|
||||||
// The function's name if it is non-empty, otherwise the inferred name.
|
// The function's name if it is non-empty, otherwise the inferred name.
|
||||||
String* DebugName();
|
String* DebugName();
|
||||||
|
|
||||||
@ -7422,17 +7448,6 @@ class SharedFunctionInfo: public HeapObject {
|
|||||||
// Indicate that this function should always be inlined in optimized code.
|
// Indicate that this function should always be inlined in optimized code.
|
||||||
DECL_BOOLEAN_ACCESSORS(force_inline)
|
DECL_BOOLEAN_ACCESSORS(force_inline)
|
||||||
|
|
||||||
// Indicates that the function was created by the Function function.
|
|
||||||
// Though it's anonymous, toString should treat it as if it had the name
|
|
||||||
// "anonymous". We don't set the name itself so that the system does not
|
|
||||||
// see a binding for it.
|
|
||||||
DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)
|
|
||||||
|
|
||||||
// Indicates that the function is either an anonymous expression
|
|
||||||
// or an arrow function (the name field can be set through the API,
|
|
||||||
// which does not change this flag).
|
|
||||||
DECL_BOOLEAN_ACCESSORS(is_anonymous_expression)
|
|
||||||
|
|
||||||
// Indicates that code for this function must be compiled through the
|
// Indicates that code for this function must be compiled through the
|
||||||
// Ignition / TurboFan pipeline, and is unsupported by
|
// Ignition / TurboFan pipeline, and is unsupported by
|
||||||
// FullCodegen / Crankshaft.
|
// FullCodegen / Crankshaft.
|
||||||
@ -7444,9 +7459,6 @@ class SharedFunctionInfo: public HeapObject {
|
|||||||
// Indicates that this function is an asm function.
|
// Indicates that this function is an asm function.
|
||||||
DECL_BOOLEAN_ACCESSORS(asm_function)
|
DECL_BOOLEAN_ACCESSORS(asm_function)
|
||||||
|
|
||||||
// Indicates that the the shared function info is deserialized from cache.
|
|
||||||
DECL_BOOLEAN_ACCESSORS(deserialized)
|
|
||||||
|
|
||||||
// Whether this function was created from a FunctionDeclaration.
|
// Whether this function was created from a FunctionDeclaration.
|
||||||
DECL_BOOLEAN_ACCESSORS(is_declaration)
|
DECL_BOOLEAN_ACCESSORS(is_declaration)
|
||||||
|
|
||||||
@ -7456,12 +7468,6 @@ class SharedFunctionInfo: public HeapObject {
|
|||||||
// Indicates that asm->wasm conversion failed and should not be re-attempted.
|
// Indicates that asm->wasm conversion failed and should not be re-attempted.
|
||||||
DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken)
|
DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken)
|
||||||
|
|
||||||
// Indicates that the function cannot cause side-effects.
|
|
||||||
DECL_BOOLEAN_ACCESSORS(has_no_side_effect)
|
|
||||||
|
|
||||||
// Indicates that |has_no_side_effect| has been computed and set.
|
|
||||||
DECL_BOOLEAN_ACCESSORS(computed_has_no_side_effect)
|
|
||||||
|
|
||||||
inline FunctionKind kind() const;
|
inline FunctionKind kind() const;
|
||||||
inline void set_kind(FunctionKind kind);
|
inline void set_kind(FunctionKind kind);
|
||||||
|
|
||||||
@ -7736,23 +7742,30 @@ class SharedFunctionInfo: public HeapObject {
|
|||||||
// byte 1
|
// byte 1
|
||||||
kForceInline,
|
kForceInline,
|
||||||
kIsAsmFunction,
|
kIsAsmFunction,
|
||||||
kIsAnonymousExpression,
|
|
||||||
kNameShouldPrintAsAnonymous,
|
|
||||||
kMustUseIgnitionTurbo,
|
kMustUseIgnitionTurbo,
|
||||||
kDontFlush,
|
kDontFlush,
|
||||||
kIsDeclaration,
|
kIsDeclaration,
|
||||||
|
kIsAsmWasmBroken,
|
||||||
|
|
||||||
|
kUnused1, // Unused fields.
|
||||||
|
kUnused2,
|
||||||
|
|
||||||
kUnused, // unused.
|
|
||||||
// byte 2
|
// byte 2
|
||||||
kFunctionKind,
|
kFunctionKind,
|
||||||
// rest of byte 2 and first two bits of byte 3 are used by FunctionKind
|
// rest of byte 2 and first two bits of byte 3 are used by FunctionKind
|
||||||
// byte 3
|
// byte 3
|
||||||
kDeserialized = kFunctionKind + 10,
|
kCompilerHintsCount = kFunctionKind + 10, // Pseudo entry
|
||||||
kIsAsmWasmBroken,
|
};
|
||||||
|
|
||||||
|
// Bit positions in debugger_hints.
|
||||||
|
enum DebuggerHints {
|
||||||
|
kIsAnonymousExpression,
|
||||||
|
kNameShouldPrintAsAnonymous,
|
||||||
|
kDeserialized,
|
||||||
kHasNoSideEffect,
|
kHasNoSideEffect,
|
||||||
kComputedHasNoSideEffect,
|
kComputedHasNoSideEffect,
|
||||||
kCompilerHintsCount, // Pseudo entry
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// kFunctionKind has to be byte-aligned
|
// kFunctionKind has to be byte-aligned
|
||||||
STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0);
|
STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0);
|
||||||
|
|
||||||
@ -11490,6 +11503,9 @@ class DebugInfo: public Struct {
|
|||||||
// The shared function info for the source being debugged.
|
// The shared function info for the source being debugged.
|
||||||
DECL_ACCESSORS(shared, SharedFunctionInfo)
|
DECL_ACCESSORS(shared, SharedFunctionInfo)
|
||||||
|
|
||||||
|
// Bit field containing various information collected for debugging.
|
||||||
|
DECL_INT_ACCESSORS(debugger_hints)
|
||||||
|
|
||||||
DECL_ACCESSORS(debug_bytecode_array, Object)
|
DECL_ACCESSORS(debug_bytecode_array, Object)
|
||||||
// Fixed array holding status information for each active break point.
|
// Fixed array holding status information for each active break point.
|
||||||
DECL_ACCESSORS(break_points, FixedArray)
|
DECL_ACCESSORS(break_points, FixedArray)
|
||||||
@ -11510,8 +11526,6 @@ class DebugInfo: public Struct {
|
|||||||
// Get the number of break points for this function.
|
// Get the number of break points for this function.
|
||||||
int GetBreakPointCount();
|
int GetBreakPointCount();
|
||||||
|
|
||||||
static Smi* uninitialized() { return Smi::kZero; }
|
|
||||||
|
|
||||||
inline bool HasDebugBytecodeArray();
|
inline bool HasDebugBytecodeArray();
|
||||||
inline bool HasDebugCode();
|
inline bool HasDebugCode();
|
||||||
|
|
||||||
@ -11526,8 +11540,10 @@ class DebugInfo: public Struct {
|
|||||||
DECLARE_VERIFIER(DebugInfo)
|
DECLARE_VERIFIER(DebugInfo)
|
||||||
|
|
||||||
static const int kSharedFunctionInfoIndex = Struct::kHeaderSize;
|
static const int kSharedFunctionInfoIndex = Struct::kHeaderSize;
|
||||||
static const int kDebugBytecodeArrayIndex =
|
static const int kDebuggerHintsIndex =
|
||||||
kSharedFunctionInfoIndex + kPointerSize;
|
kSharedFunctionInfoIndex + kPointerSize;
|
||||||
|
static const int kDebugBytecodeArrayIndex =
|
||||||
|
kDebuggerHintsIndex + kPointerSize;
|
||||||
static const int kBreakPointsStateIndex =
|
static const int kBreakPointsStateIndex =
|
||||||
kDebugBytecodeArrayIndex + kPointerSize;
|
kDebugBytecodeArrayIndex + kPointerSize;
|
||||||
static const int kSize = kBreakPointsStateIndex + kPointerSize;
|
static const int kSize = kBreakPointsStateIndex + kPointerSize;
|
||||||
|
@ -1570,6 +1570,11 @@ void MacroAssembler::JumpIfNotSmi(Register src,
|
|||||||
j(NegateCondition(smi), on_not_smi, near_jump);
|
j(NegateCondition(smi), on_not_smi, near_jump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroAssembler::JumpIfNotSmi(Operand src, Label* on_not_smi,
|
||||||
|
Label::Distance near_jump) {
|
||||||
|
Condition smi = CheckSmi(src);
|
||||||
|
j(NegateCondition(smi), on_not_smi, near_jump);
|
||||||
|
}
|
||||||
|
|
||||||
void MacroAssembler::JumpUnlessNonNegativeSmi(
|
void MacroAssembler::JumpUnlessNonNegativeSmi(
|
||||||
Register src, Label* on_not_smi_or_negative,
|
Register src, Label* on_not_smi_or_negative,
|
||||||
|
@ -551,6 +551,10 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* on_not_smi,
|
Label* on_not_smi,
|
||||||
Label::Distance near_jump = Label::kFar);
|
Label::Distance near_jump = Label::kFar);
|
||||||
|
|
||||||
|
// Jump to label if the value is not a tagged smi.
|
||||||
|
void JumpIfNotSmi(Operand src, Label* on_not_smi,
|
||||||
|
Label::Distance near_jump = Label::kFar);
|
||||||
|
|
||||||
// Jump to label if the value is not a non-negative tagged smi.
|
// Jump to label if the value is not a non-negative tagged smi.
|
||||||
void JumpUnlessNonNegativeSmi(Register src,
|
void JumpUnlessNonNegativeSmi(Register src,
|
||||||
Label* on_not_smi,
|
Label* on_not_smi,
|
||||||
|
Loading…
Reference in New Issue
Block a user