Commit 75a2fce3 authored by verwaest's avatar verwaest Committed by Commit bot

[runtime] Remove SharedFunctionInfo::is_function which is the inverse of SFI::is_toplevel

BUG=

Review-Url: https://codereview.chromium.org/2629143002
Cr-Commit-Position: refs/heads/master@{#42275}
parent aff64e9d
...@@ -2629,8 +2629,6 @@ class FunctionLiteral final : public Expression { ...@@ -2629,8 +2629,6 @@ class FunctionLiteral final : public Expression {
return HasDuplicateParameters::decode(bit_field_); return HasDuplicateParameters::decode(bit_field_);
} }
bool is_function() const { return IsFunction::decode(bit_field_); }
// This is used as a heuristic on when to eagerly compile a function // This is used as a heuristic on when to eagerly compile a function
// literal. We consider the following constructs as hints that the // literal. We consider the following constructs as hints that the
// function will be called immediately: // function will be called immediately:
...@@ -2695,7 +2693,7 @@ class FunctionLiteral final : public Expression { ...@@ -2695,7 +2693,7 @@ class FunctionLiteral final : public Expression {
int function_length, FunctionType function_type, int function_length, FunctionType function_type,
ParameterFlag has_duplicate_parameters, ParameterFlag has_duplicate_parameters,
EagerCompileHint eager_compile_hint, int position, EagerCompileHint eager_compile_hint, int position,
bool is_function, bool has_braces, int function_literal_id) bool has_braces, int function_literal_id)
: Expression(position, kFunctionLiteral), : Expression(position, kFunctionLiteral),
materialized_literal_count_(materialized_literal_count), materialized_literal_count_(materialized_literal_count),
expected_property_count_(expected_property_count), expected_property_count_(expected_property_count),
...@@ -2714,7 +2712,6 @@ class FunctionLiteral final : public Expression { ...@@ -2714,7 +2712,6 @@ class FunctionLiteral final : public Expression {
Pretenure::encode(false) | Pretenure::encode(false) |
HasDuplicateParameters::encode(has_duplicate_parameters == HasDuplicateParameters::encode(has_duplicate_parameters ==
kHasDuplicateParameters) | kHasDuplicateParameters) |
IsFunction::encode(is_function) |
ShouldNotBeUsedOnceHintField::encode(false) | ShouldNotBeUsedOnceHintField::encode(false) |
DontOptimizeReasonField::encode(kNoReason); DontOptimizeReasonField::encode(kNoReason);
if (eager_compile_hint == kShouldEagerCompile) SetShouldEagerCompile(); if (eager_compile_hint == kShouldEagerCompile) SetShouldEagerCompile();
...@@ -2724,9 +2721,8 @@ class FunctionLiteral final : public Expression { ...@@ -2724,9 +2721,8 @@ class FunctionLiteral final : public Expression {
: public BitField<FunctionType, Expression::kNextBitFieldIndex, 2> {}; : public BitField<FunctionType, Expression::kNextBitFieldIndex, 2> {};
class Pretenure : public BitField<bool, FunctionTypeBits::kNext, 1> {}; class Pretenure : public BitField<bool, FunctionTypeBits::kNext, 1> {};
class HasDuplicateParameters : public BitField<bool, Pretenure::kNext, 1> {}; class HasDuplicateParameters : public BitField<bool, Pretenure::kNext, 1> {};
class IsFunction : public BitField<bool, HasDuplicateParameters::kNext, 1> {};
class ShouldNotBeUsedOnceHintField class ShouldNotBeUsedOnceHintField
: public BitField<bool, IsFunction::kNext, 1> {}; : public BitField<bool, HasDuplicateParameters::kNext, 1> {};
class DontOptimizeReasonField class DontOptimizeReasonField
: public BitField<BailoutReason, ShouldNotBeUsedOnceHintField::kNext, 8> { : public BitField<BailoutReason, ShouldNotBeUsedOnceHintField::kNext, 8> {
}; };
...@@ -3479,7 +3475,7 @@ class AstNodeFactory final BASE_EMBEDDED { ...@@ -3479,7 +3475,7 @@ class AstNodeFactory final BASE_EMBEDDED {
zone_, name, ast_value_factory_, scope, body, zone_, name, ast_value_factory_, scope, body,
materialized_literal_count, expected_property_count, parameter_count, materialized_literal_count, expected_property_count, parameter_count,
function_length, function_type, has_duplicate_parameters, function_length, function_type, has_duplicate_parameters,
eager_compile_hint, position, true, has_braces, function_literal_id); eager_compile_hint, position, has_braces, function_literal_id);
} }
// Creates a FunctionLiteral representing a top-level script, the // Creates a FunctionLiteral representing a top-level script, the
...@@ -3494,7 +3490,7 @@ class AstNodeFactory final BASE_EMBEDDED { ...@@ -3494,7 +3490,7 @@ class AstNodeFactory final BASE_EMBEDDED {
body, materialized_literal_count, expected_property_count, body, materialized_literal_count, expected_property_count,
parameter_count, parameter_count, FunctionLiteral::kAnonymousExpression, parameter_count, parameter_count, FunctionLiteral::kAnonymousExpression,
FunctionLiteral::kNoDuplicateParameters, FunctionLiteral::kNoDuplicateParameters,
FunctionLiteral::kShouldLazyCompile, 0, false, true, FunctionLiteral::kShouldLazyCompile, 0, true,
FunctionLiteral::kIdTypeTopLevel); FunctionLiteral::kIdTypeTopLevel);
} }
......
...@@ -240,7 +240,7 @@ bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) { ...@@ -240,7 +240,7 @@ bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) {
// We only handle functions (no eval / top-level code / wasm) that are // We only handle functions (no eval / top-level code / wasm) that are
// attached to a script. // attached to a script.
if (!function->script()->IsScript() || !function->is_function() || if (!function->script()->IsScript() || function->is_toplevel() ||
function->asm_function() || function->native()) { function->asm_function() || function->native()) {
return false; return false;
} }
......
...@@ -225,7 +225,7 @@ void DebugEvaluate::ContextBuilder::MaterializeArgumentsObject( ...@@ -225,7 +225,7 @@ void DebugEvaluate::ContextBuilder::MaterializeArgumentsObject(
Handle<JSObject> target, Handle<JSFunction> function) { Handle<JSObject> target, Handle<JSFunction> function) {
// Do not materialize the arguments object for eval or top-level code. // Do not materialize the arguments object for eval or top-level code.
// Skip if "arguments" is already taken. // Skip if "arguments" is already taken.
if (!function->shared()->is_function()) return; if (function->shared()->is_toplevel()) return;
Maybe<bool> maybe = JSReceiver::HasOwnProperty( Maybe<bool> maybe = JSReceiver::HasOwnProperty(
target, isolate_->factory()->arguments_string()); target, isolate_->factory()->arguments_string());
DCHECK(maybe.IsJust()); DCHECK(maybe.IsJust());
......
...@@ -6217,7 +6217,6 @@ BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, ...@@ -6217,7 +6217,6 @@ BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
kNameShouldPrintAsAnonymous) kNameShouldPrintAsAnonymous)
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous_expression, BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous_expression,
kIsAnonymousExpression) kIsAnonymousExpression)
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction)
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, must_use_ignition_turbo, BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, must_use_ignition_turbo,
kMustUseIgnitionTurbo) kMustUseIgnitionTurbo)
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush) BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush)
......
...@@ -13570,7 +13570,6 @@ void SharedFunctionInfo::InitFromFunctionLiteral( ...@@ -13570,7 +13570,6 @@ void SharedFunctionInfo::InitFromFunctionLiteral(
shared_info->set_language_mode(lit->language_mode()); shared_info->set_language_mode(lit->language_mode());
shared_info->set_uses_arguments(lit->scope()->arguments() != NULL); shared_info->set_uses_arguments(lit->scope()->arguments() != NULL);
shared_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); shared_info->set_has_duplicate_parameters(lit->has_duplicate_parameters());
shared_info->set_is_function(lit->is_function());
shared_info->set_kind(lit->kind()); shared_info->set_kind(lit->kind());
if (!IsConstructable(lit->kind(), lit->language_mode())) { if (!IsConstructable(lit->kind(), lit->language_mode())) {
shared_info->SetConstructStub( shared_info->SetConstructStub(
......
...@@ -7438,9 +7438,6 @@ class SharedFunctionInfo: public HeapObject { ...@@ -7438,9 +7438,6 @@ class SharedFunctionInfo: public HeapObject {
// which does not change this flag). // which does not change this flag).
DECL_BOOLEAN_ACCESSORS(is_anonymous_expression) DECL_BOOLEAN_ACCESSORS(is_anonymous_expression)
// Is this a function or top-level/eval code.
DECL_BOOLEAN_ACCESSORS(is_function)
// 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.
...@@ -7746,10 +7743,11 @@ class SharedFunctionInfo: public HeapObject { ...@@ -7746,10 +7743,11 @@ class SharedFunctionInfo: public HeapObject {
kIsAsmFunction, kIsAsmFunction,
kIsAnonymousExpression, kIsAnonymousExpression,
kNameShouldPrintAsAnonymous, kNameShouldPrintAsAnonymous,
kIsFunction,
kMustUseIgnitionTurbo, kMustUseIgnitionTurbo,
kDontFlush, kDontFlush,
kIsDeclaration, kIsDeclaration,
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
......
...@@ -351,12 +351,8 @@ Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { ...@@ -351,12 +351,8 @@ Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
MessageLocation location; MessageLocation location;
if (ComputeLocation(isolate, &location)) { if (ComputeLocation(isolate, &location)) {
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
std::unique_ptr<ParseInfo> info; std::unique_ptr<ParseInfo> info(
if (location.function()->shared()->is_function()) { new ParseInfo(&zone, handle(location.function()->shared())));
info.reset(new ParseInfo(&zone, handle(location.function()->shared())));
} else {
info.reset(new ParseInfo(&zone, location.script()));
}
if (parsing::ParseAny(info.get())) { if (parsing::ParseAny(info.get())) {
CallPrinter printer(isolate, CallPrinter printer(isolate,
location.function()->shared()->IsUserJavaScript()); location.function()->shared()->IsUserJavaScript());
......
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