Commit 1972e373 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Compare handles by location only.

This is in preparation for running code generation off the main thread.

Bug: v8:6048
Change-Id: Ic1ddcbbb8995d49dfcef1ffbf135117291a00ea7
Reviewed-on: https://chromium-review.googlesource.com/505513Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45334}
parent f846e7df
......@@ -99,7 +99,7 @@ Handle<Code> CodeGenerator::GenerateCode() {
DCHECK_EQ(0u, deoptimization_literals_.size());
for (CompilationInfo::InlinedFunctionHolder& inlined :
info->inlined_functions()) {
if (!inlined.shared_info.is_identical_to(info->shared_info())) {
if (!inlined.shared_info.equals(info->shared_info())) {
int index = DefineDeoptimizationLiteral(inlined.shared_info);
inlined.RegisterInlinedFunctionId(index);
}
......@@ -110,7 +110,7 @@ Handle<Code> CodeGenerator::GenerateCode() {
// functions. This ensures unoptimized code is kept alive by optimized code.
for (const CompilationInfo::InlinedFunctionHolder& inlined :
info->inlined_functions()) {
if (!inlined.shared_info.is_identical_to(info->shared_info())) {
if (!inlined.shared_info.equals(info->shared_info())) {
DefineDeoptimizationLiteral(inlined.inlined_code_object_root);
}
}
......@@ -660,7 +660,7 @@ void CodeGenerator::RecordCallPosition(Instruction* instr) {
int CodeGenerator::DefineDeoptimizationLiteral(Handle<Object> literal) {
int result = static_cast<int>(deoptimization_literals_.size());
for (unsigned i = 0; i < deoptimization_literals_.size(); ++i) {
if (deoptimization_literals_[i].is_identical_to(literal)) return i;
if (deoptimization_literals_[i].equals(literal)) return i;
}
deoptimization_literals_.push_back(literal);
return result;
......@@ -970,7 +970,7 @@ void CodeGenerator::AddTranslationForOperand(Translation* translation,
default:
UNREACHABLE();
}
if (constant_object.is_identical_to(info()->closure())) {
if (constant_object.equals(info()->closure())) {
translation->StoreJSFrameFunction();
} else {
int literal_id = DefineDeoptimizationLiteral(constant_object);
......
......@@ -133,10 +133,13 @@ class Handle final : public HandleBase {
// MaybeHandle to force validation before being used as handles.
static const Handle<T> null() { return Handle<T>(); }
// Location equality.
bool equals(Handle<T> other) const { return address() == other.address(); }
// Provide function object for location equality comparison.
struct equal_to : public std::binary_function<Handle<T>, Handle<T>, bool> {
V8_INLINE bool operator()(Handle<T> lhs, Handle<T> rhs) const {
return lhs.address() == rhs.address();
return lhs.equals(rhs);
}
};
......
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