Commit f1b80386 authored by Yang Qin's avatar Yang Qin Committed by Commit Bot

AIX: Changing how CallFrequency object being passed from 'by value' to 'by...

AIX: Changing how CallFrequency object being passed from 'by value' to 'by constant reference' to avoid copy error.

GCC compile issue in AIX: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61976

There is a gcc compile issue in AIX: Being passed by values may occur a
copy error, which can be avoided by being passed by reference. This is
why the old way of CallFrequency object 'being passed by values’ has
been changed to the new way of CallFrequency object 'being passed by
references' to avoid this issue.

Bug: v8:8193
Change-Id: I3f2e662a9ef5b641b6e978c3e91167bacc0d13d2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1689027Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#62788}
parent d74cd491
...@@ -17,7 +17,7 @@ namespace v8 { ...@@ -17,7 +17,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
std::ostream& operator<<(std::ostream& os, CallFrequency f) { std::ostream& operator<<(std::ostream& os, CallFrequency const& f) {
if (f.IsUnknown()) return os << "unknown"; if (f.IsUnknown()) return os << "unknown";
return os << f.value(); return os << f.value();
} }
...@@ -28,7 +28,6 @@ CallFrequency CallFrequencyOf(Operator const* op) { ...@@ -28,7 +28,6 @@ CallFrequency CallFrequencyOf(Operator const* op) {
return OpParameter<CallFrequency>(op); return OpParameter<CallFrequency>(op);
} }
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os,
ConstructForwardVarargsParameters const& p) { ConstructForwardVarargsParameters const& p) {
return os << p.arity() << ", " << p.start_index(); return os << p.arity() << ", " << p.start_index();
...@@ -843,7 +842,8 @@ const Operator* JSOperatorBuilder::Call(size_t arity, ...@@ -843,7 +842,8 @@ const Operator* JSOperatorBuilder::Call(size_t arity,
parameters); // parameter parameters); // parameter
} }
const Operator* JSOperatorBuilder::CallWithArrayLike(CallFrequency frequency) { const Operator* JSOperatorBuilder::CallWithArrayLike(
CallFrequency const& frequency) {
return new (zone()) Operator1<CallFrequency>( // -- return new (zone()) Operator1<CallFrequency>( // --
IrOpcode::kJSCallWithArrayLike, Operator::kNoProperties, // opcode IrOpcode::kJSCallWithArrayLike, Operator::kNoProperties, // opcode
"JSCallWithArrayLike", // name "JSCallWithArrayLike", // name
...@@ -913,7 +913,7 @@ const Operator* JSOperatorBuilder::Construct(uint32_t arity, ...@@ -913,7 +913,7 @@ const Operator* JSOperatorBuilder::Construct(uint32_t arity,
} }
const Operator* JSOperatorBuilder::ConstructWithArrayLike( const Operator* JSOperatorBuilder::ConstructWithArrayLike(
CallFrequency frequency) { CallFrequency const& frequency) {
return new (zone()) Operator1<CallFrequency>( // -- return new (zone()) Operator1<CallFrequency>( // --
IrOpcode::kJSConstructWithArrayLike, // opcode IrOpcode::kJSConstructWithArrayLike, // opcode
Operator::kNoProperties, // properties Operator::kNoProperties, // properties
......
...@@ -48,7 +48,7 @@ class CallFrequency final { ...@@ -48,7 +48,7 @@ class CallFrequency final {
} }
bool operator!=(CallFrequency const& that) const { return !(*this == that); } bool operator!=(CallFrequency const& that) const { return !(*this == that); }
friend size_t hash_value(CallFrequency f) { friend size_t hash_value(CallFrequency const& f) {
return bit_cast<uint32_t>(f.value_); return bit_cast<uint32_t>(f.value_);
} }
...@@ -58,7 +58,7 @@ class CallFrequency final { ...@@ -58,7 +58,7 @@ class CallFrequency final {
float value_; float value_;
}; };
std::ostream& operator<<(std::ostream&, CallFrequency); std::ostream& operator<<(std::ostream&, CallFrequency const&);
CallFrequency CallFrequencyOf(Operator const* op) V8_WARN_UNUSED_RESULT; CallFrequency CallFrequencyOf(Operator const* op) V8_WARN_UNUSED_RESULT;
...@@ -101,7 +101,7 @@ ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf( ...@@ -101,7 +101,7 @@ ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf(
// used as a parameter by JSConstruct and JSConstructWithSpread operators. // used as a parameter by JSConstruct and JSConstructWithSpread operators.
class ConstructParameters final { class ConstructParameters final {
public: public:
ConstructParameters(uint32_t arity, CallFrequency frequency, ConstructParameters(uint32_t arity, CallFrequency const& frequency,
VectorSlotPair const& feedback) VectorSlotPair const& feedback)
: arity_(arity), frequency_(frequency), feedback_(feedback) {} : arity_(arity), frequency_(frequency), feedback_(feedback) {}
...@@ -757,7 +757,7 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final ...@@ -757,7 +757,7 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
VectorSlotPair const& feedback = VectorSlotPair(), VectorSlotPair const& feedback = VectorSlotPair(),
ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation); SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation);
const Operator* CallWithArrayLike(CallFrequency frequency); const Operator* CallWithArrayLike(CallFrequency const& frequency);
const Operator* CallWithSpread( const Operator* CallWithSpread(
uint32_t arity, CallFrequency const& frequency = CallFrequency(), uint32_t arity, CallFrequency const& frequency = CallFrequency(),
VectorSlotPair const& feedback = VectorSlotPair(), VectorSlotPair const& feedback = VectorSlotPair(),
...@@ -770,7 +770,7 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final ...@@ -770,7 +770,7 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* Construct(uint32_t arity, const Operator* Construct(uint32_t arity,
CallFrequency const& frequency = CallFrequency(), CallFrequency const& frequency = CallFrequency(),
VectorSlotPair const& feedback = VectorSlotPair()); VectorSlotPair const& feedback = VectorSlotPair());
const Operator* ConstructWithArrayLike(CallFrequency frequency); const Operator* ConstructWithArrayLike(CallFrequency const& frequency);
const Operator* ConstructWithSpread( const Operator* ConstructWithSpread(
uint32_t arity, CallFrequency const& frequency = CallFrequency(), uint32_t arity, CallFrequency const& frequency = CallFrequency(),
VectorSlotPair const& feedback = VectorSlotPair()); VectorSlotPair const& feedback = VectorSlotPair());
......
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