[turbofan] Clean up a few things in the serializer

- Remove CLEAR_ENVIRONMENT_LIST of bytecodes, since clearing the
  environment is already the default behavior.
- Address a TODO in Environment::Merge: also merge context hints.
- Don't needlessly clear register hints for InvokeIntrinsic.

Bug: v8:7790
Change-Id: Ibead921002e45ed46c8c1629cae7bb9febf09b90
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1952870
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65399}
This commit is contained in:
Georg Neis 2019-12-09 11:35:51 +01:00 committed by Commit Bot
parent c924f54ee0
commit 20b73b0d2d

View File

@ -28,12 +28,6 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
#define CLEAR_ENVIRONMENT_LIST(V) \
V(CallRuntimeForPair) \
V(Debugger) \
V(ResumeGenerator) \
V(SuspendGenerator)
#define KILL_ENVIRONMENT_LIST(V) \ #define KILL_ENVIRONMENT_LIST(V) \
V(Abort) \ V(Abort) \
V(ReThrow) \ V(ReThrow) \
@ -224,7 +218,6 @@ namespace compiler {
BINARY_OP_LIST(V) \ BINARY_OP_LIST(V) \
COMPARE_OP_LIST(V) \ COMPARE_OP_LIST(V) \
CLEAR_ACCUMULATOR_LIST(V) \ CLEAR_ACCUMULATOR_LIST(V) \
CLEAR_ENVIRONMENT_LIST(V) \
CONDITIONAL_JUMPS_LIST(V) \ CONDITIONAL_JUMPS_LIST(V) \
IGNORED_BYTECODE_LIST(V) \ IGNORED_BYTECODE_LIST(V) \
KILL_ENVIRONMENT_LIST(V) \ KILL_ENVIRONMENT_LIST(V) \
@ -815,8 +808,7 @@ class SerializerForBackgroundCompilation::Environment : public ZoneObject {
return ephemeral_hints_[local_index]; return ephemeral_hints_[local_index];
} }
// Clears all hints except those for the context, return value, and the // Clears all hints except those for the context and the closure.
// closure.
void ClearEphemeralHints() { void ClearEphemeralHints() {
for (auto& hints : ephemeral_hints_) hints = Hints(); for (auto& hints : ephemeral_hints_) hints = Hints();
} }
@ -910,15 +902,15 @@ void SerializerForBackgroundCompilation::Environment::Merge(Environment* other,
if (IsDead()) { if (IsDead()) {
ephemeral_hints_ = other->ephemeral_hints_; ephemeral_hints_ = other->ephemeral_hints_;
current_context_hints_ = other->current_context_hints_;
} else { } else {
CHECK_EQ(ephemeral_hints_.size(), other->ephemeral_hints_.size()); CHECK_EQ(ephemeral_hints_.size(), other->ephemeral_hints_.size());
for (size_t i = 0; i < ephemeral_hints_.size(); ++i) { for (size_t i = 0; i < ephemeral_hints_.size(); ++i) {
ephemeral_hints_[i].Merge(other->ephemeral_hints_[i], zone); ephemeral_hints_[i].Merge(other->ephemeral_hints_[i], zone);
} }
current_context_hints_.Merge(other->current_context_hints_, zone);
} }
// TODO(neis): Deal with context hints.
CHECK(!IsDead()); CHECK(!IsDead());
} }
@ -1250,10 +1242,9 @@ void SerializerForBackgroundCompilation::TraverseBytecode() {
break; break;
SUPPORTED_BYTECODE_LIST(DEFINE_BYTECODE_CASE) SUPPORTED_BYTECODE_LIST(DEFINE_BYTECODE_CASE)
#undef DEFINE_BYTECODE_CASE #undef DEFINE_BYTECODE_CASE
default: { default:
environment()->ClearEphemeralHints(); environment()->ClearEphemeralHints();
break; break;
}
} }
} }
@ -1371,7 +1362,6 @@ void SerializerForBackgroundCompilation::VisitInvokeIntrinsic(
HintsVector args = PrepareArgumentsHints(first_reg, reg_count); HintsVector args = PrepareArgumentsHints(first_reg, reg_count);
Hints const& resolution_hints = args[1]; // The resolution object. Hints const& resolution_hints = args[1]; // The resolution object.
ProcessHintsForPromiseResolve(resolution_hints); ProcessHintsForPromiseResolve(resolution_hints);
environment()->accumulator_hints() = Hints();
return; return;
} }
case Runtime::kInlineAsyncGeneratorReject: case Runtime::kInlineAsyncGeneratorReject:
@ -1437,7 +1427,7 @@ void SerializerForBackgroundCompilation::VisitInvokeIntrinsic(
break; break;
} }
} }
environment()->ClearEphemeralHints(); environment()->accumulator_hints() = Hints();
} }
void SerializerForBackgroundCompilation::VisitLdaConstant( void SerializerForBackgroundCompilation::VisitLdaConstant(
@ -3347,14 +3337,6 @@ void SerializerForBackgroundCompilation::VisitStaDataPropertyInLiteral(
false); false);
} }
#define DEFINE_CLEAR_ENVIRONMENT(name, ...) \
void SerializerForBackgroundCompilation::Visit##name( \
BytecodeArrayIterator* iterator) { \
environment()->ClearEphemeralHints(); \
}
CLEAR_ENVIRONMENT_LIST(DEFINE_CLEAR_ENVIRONMENT)
#undef DEFINE_CLEAR_ENVIRONMENT
#define DEFINE_CLEAR_ACCUMULATOR(name, ...) \ #define DEFINE_CLEAR_ACCUMULATOR(name, ...) \
void SerializerForBackgroundCompilation::Visit##name( \ void SerializerForBackgroundCompilation::Visit##name( \
BytecodeArrayIterator* iterator) { \ BytecodeArrayIterator* iterator) { \
@ -3431,7 +3413,6 @@ UNARY_OP_LIST(DEFINE_UNARY_OP)
#undef BINARY_OP_LIST #undef BINARY_OP_LIST
#undef CLEAR_ACCUMULATOR_LIST #undef CLEAR_ACCUMULATOR_LIST
#undef CLEAR_ENVIRONMENT_LIST
#undef COMPARE_OP_LIST #undef COMPARE_OP_LIST
#undef CONDITIONAL_JUMPS_LIST #undef CONDITIONAL_JUMPS_LIST
#undef IGNORED_BYTECODE_LIST #undef IGNORED_BYTECODE_LIST