Commit 37eb501b authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

Move VectorSlotPair to its own files

This is a preparation for a larger CL that needs VectorSlotPair
throughtout the compilation chain (including deoptimizer.cc).

Bug: v8:7127
Change-Id: Ia746805ca3fa294eedba19d23656f858840cd501
Reviewed-on: https://chromium-review.googlesource.com/813934Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49928}
parent 7ff3005e
...@@ -2086,6 +2086,8 @@ v8_source_set("v8_base") { ...@@ -2086,6 +2086,8 @@ v8_source_set("v8_base") {
"src/v8threads.h", "src/v8threads.h",
"src/value-serializer.cc", "src/value-serializer.cc",
"src/value-serializer.h", "src/value-serializer.h",
"src/vector-slot-pair.cc",
"src/vector-slot-pair.h",
"src/vector.h", "src/vector.h",
"src/version.cc", "src/version.cc",
"src/version.h", "src/version.h",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "src/interpreter/bytecodes.h" #include "src/interpreter/bytecodes.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/objects/literal-objects.h" #include "src/objects/literal-objects.h"
#include "src/vector-slot-pair.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class VectorSlotPair;
namespace compiler { namespace compiler {
class Reduction; class Reduction;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "src/feedback-vector-inl.h" #include "src/feedback-vector-inl.h"
#include "src/ic/call-optimization.h" #include "src/ic/call-optimization.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/vector-slot-pair.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -15,6 +15,7 @@ namespace internal { ...@@ -15,6 +15,7 @@ namespace internal {
// Forward declarations. // Forward declarations.
class CompilationDependencies; class CompilationDependencies;
class Factory; class Factory;
class VectorSlotPair;
namespace compiler { namespace compiler {
...@@ -24,7 +25,6 @@ class CommonOperatorBuilder; ...@@ -24,7 +25,6 @@ class CommonOperatorBuilder;
class JSGraph; class JSGraph;
class JSOperatorBuilder; class JSOperatorBuilder;
class SimplifiedOperatorBuilder; class SimplifiedOperatorBuilder;
class VectorSlotPair;
// Performs strength reduction on {JSConstruct} and {JSCall} nodes, // Performs strength reduction on {JSConstruct} and {JSCall} nodes,
// which might allow inlining or other optimizations to be performed afterwards. // which might allow inlining or other optimizations to be performed afterwards.
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "src/feedback-vector.h" #include "src/feedback-vector.h"
#include "src/field-index-inl.h" #include "src/field-index-inl.h"
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/vector-slot-pair.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include "src/base/lazy-instance.h" #include "src/base/lazy-instance.h"
#include "src/compiler/opcodes.h" #include "src/compiler/opcodes.h"
#include "src/compiler/operator.h" #include "src/compiler/operator.h"
#include "src/feedback-vector.h"
#include "src/handles-inl.h" #include "src/handles-inl.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/vector-slot-pair.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -28,29 +28,6 @@ CallFrequency CallFrequencyOf(Operator const* op) { ...@@ -28,29 +28,6 @@ CallFrequency CallFrequencyOf(Operator const* op) {
return OpParameter<CallFrequency>(op); return OpParameter<CallFrequency>(op);
} }
VectorSlotPair::VectorSlotPair() {}
int VectorSlotPair::index() const {
return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
}
bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return lhs.slot() == rhs.slot() &&
lhs.vector().location() == rhs.vector().location();
}
bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return !(lhs == rhs);
}
size_t hash_value(VectorSlotPair const& p) {
return base::hash_combine(p.slot(), p.vector().location());
}
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os,
ConstructForwardVarargsParameters const& p) { ConstructForwardVarargsParameters const& p) {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "src/handles.h" #include "src/handles.h"
#include "src/runtime/runtime.h" #include "src/runtime/runtime.h"
#include "src/type-hints.h" #include "src/type-hints.h"
#include "src/vector-slot-pair.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -18,7 +19,6 @@ class AllocationSite; ...@@ -18,7 +19,6 @@ class AllocationSite;
class BoilerplateDescription; class BoilerplateDescription;
class ConstantElementsPair; class ConstantElementsPair;
class SharedFunctionInfo; class SharedFunctionInfo;
class FeedbackVector;
namespace compiler { namespace compiler {
...@@ -59,32 +59,6 @@ std::ostream& operator<<(std::ostream&, CallFrequency); ...@@ -59,32 +59,6 @@ std::ostream& operator<<(std::ostream&, CallFrequency);
CallFrequency CallFrequencyOf(Operator const* op) WARN_UNUSED_RESULT; CallFrequency CallFrequencyOf(Operator const* op) WARN_UNUSED_RESULT;
// Defines a pair of {FeedbackVector} and {FeedbackSlot}, which
// is used to access the type feedback for a certain {Node}.
class V8_EXPORT_PRIVATE VectorSlotPair {
public:
VectorSlotPair();
VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot)
: vector_(vector), slot_(slot) {}
bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); }
Handle<FeedbackVector> vector() const { return vector_; }
FeedbackSlot slot() const { return slot_; }
int index() const;
private:
const Handle<FeedbackVector> vector_;
const FeedbackSlot slot_;
};
bool operator==(VectorSlotPair const&, VectorSlotPair const&);
bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
size_t hash_value(VectorSlotPair const&);
// Defines the flags for a JavaScript call forwarding parameters. This // Defines the flags for a JavaScript call forwarding parameters. This
// is used as parameter by JSConstructForwardVarargs operators. // is used as parameter by JSConstructForwardVarargs operators.
class ConstructForwardVarargsParameters final { class ConstructForwardVarargsParameters final {
......
...@@ -1440,6 +1440,8 @@ ...@@ -1440,6 +1440,8 @@
'v8threads.h', 'v8threads.h',
'value-serializer.cc', 'value-serializer.cc',
'value-serializer.h', 'value-serializer.h',
'vector-slot-pair.cc',
'vector-slot-pair.h',
'vector.h', 'vector.h',
'version.cc', 'version.cc',
'version.h', 'version.h',
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/vector-slot-pair.h"
#include "src/feedback-vector.h"
namespace v8 {
namespace internal {
VectorSlotPair::VectorSlotPair() {}
int VectorSlotPair::index() const {
return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
}
bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return lhs.slot() == rhs.slot() &&
lhs.vector().location() == rhs.vector().location();
}
bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return !(lhs == rhs);
}
size_t hash_value(VectorSlotPair const& p) {
return base::hash_combine(p.slot(), p.vector().location());
}
} // namespace internal
} // namespace v8
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_VECTOR_SLOT_PAIR_H_
#define V8_VECTOR_SLOT_PAIR_H_
#include "src/globals.h"
#include "src/handles.h"
#include "src/utils.h"
namespace v8 {
namespace internal {
class FeedbackVector;
// Defines a pair of {FeedbackVector} and {FeedbackSlot}, which
// is used to access the type feedback for a certain {Node}.
class V8_EXPORT_PRIVATE VectorSlotPair {
public:
VectorSlotPair();
VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot)
: vector_(vector), slot_(slot) {}
bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); }
Handle<FeedbackVector> vector() const { return vector_; }
FeedbackSlot slot() const { return slot_; }
int index() const;
private:
const Handle<FeedbackVector> vector_;
const FeedbackSlot slot_;
};
bool operator==(VectorSlotPair const&, VectorSlotPair const&);
bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
size_t hash_value(VectorSlotPair const&);
} // namespace internal
} // namespace v8
#endif // V8_VECTOR_SLOT_PAIR_H_
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