summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h')
-rw-r--r--Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h51
1 files changed, 25 insertions, 26 deletions
diff --git a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
index a117db64f..74e4f3318 100644
--- a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
+++ b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,14 +26,11 @@
#ifndef LazyOperandValueProfile_h
#define LazyOperandValueProfile_h
-#include <wtf/Platform.h>
-
-#if ENABLE(VALUE_PROFILER)
-
+#include "ConcurrentJITLock.h"
#include "ValueProfile.h"
+#include "VirtualRegister.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
#include <wtf/SegmentedVector.h>
namespace JSC {
@@ -44,26 +41,26 @@ class LazyOperandValueProfileKey {
public:
LazyOperandValueProfileKey()
: m_bytecodeOffset(0) // 0 = empty value
- , m_operand(-1) // not a valid operand index in our current scheme
+ , m_operand(VirtualRegister()) // not a valid operand index in our current scheme
{
}
LazyOperandValueProfileKey(WTF::HashTableDeletedValueType)
: m_bytecodeOffset(1) // 1 = deleted value
- , m_operand(-1) // not a valid operand index in our current scheme
+ , m_operand(VirtualRegister()) // not a valid operand index in our current scheme
{
}
- LazyOperandValueProfileKey(unsigned bytecodeOffset, int operand)
+ LazyOperandValueProfileKey(unsigned bytecodeOffset, VirtualRegister operand)
: m_bytecodeOffset(bytecodeOffset)
, m_operand(operand)
{
- ASSERT(operand != -1);
+ ASSERT(m_operand.isValid());
}
bool operator!() const
{
- return m_operand == -1;
+ return !m_operand.isValid();
}
bool operator==(const LazyOperandValueProfileKey& other) const
@@ -74,7 +71,7 @@ public:
unsigned hash() const
{
- return WTF::intHash(m_bytecodeOffset) + m_operand;
+ return WTF::intHash(m_bytecodeOffset) + m_operand.offset();
}
unsigned bytecodeOffset() const
@@ -82,7 +79,8 @@ public:
ASSERT(!!*this);
return m_bytecodeOffset;
}
- int operand() const
+
+ VirtualRegister operand() const
{
ASSERT(!!*this);
return m_operand;
@@ -90,11 +88,11 @@ public:
bool isHashTableDeletedValue() const
{
- return m_operand == -1 && m_bytecodeOffset;
+ return !m_operand.isValid() && m_bytecodeOffset;
}
private:
unsigned m_bytecodeOffset;
- int m_operand;
+ VirtualRegister m_operand;
};
struct LazyOperandValueProfileKeyHash {
@@ -127,7 +125,7 @@ namespace JSC {
struct LazyOperandValueProfile : public MinimalValueProfile {
LazyOperandValueProfile()
: MinimalValueProfile()
- , m_operand(-1)
+ , m_operand(VirtualRegister())
{
}
@@ -142,7 +140,7 @@ struct LazyOperandValueProfile : public MinimalValueProfile {
return LazyOperandValueProfileKey(m_bytecodeOffset, m_operand);
}
- int m_operand;
+ VirtualRegister m_operand;
typedef SegmentedVector<LazyOperandValueProfile, 8> List;
};
@@ -155,35 +153,36 @@ public:
CompressedLazyOperandValueProfileHolder();
~CompressedLazyOperandValueProfileHolder();
- void computeUpdatedPredictions(OperationInProgress);
+ void computeUpdatedPredictions(const ConcurrentJITLocker&);
- LazyOperandValueProfile* add(const LazyOperandValueProfileKey& key);
+ LazyOperandValueProfile* add(
+ const ConcurrentJITLocker&, const LazyOperandValueProfileKey& key);
private:
friend class LazyOperandValueProfileParser;
- OwnPtr<LazyOperandValueProfile::List> m_data;
+ std::unique_ptr<LazyOperandValueProfile::List> m_data;
};
class LazyOperandValueProfileParser {
WTF_MAKE_NONCOPYABLE(LazyOperandValueProfileParser);
public:
- explicit LazyOperandValueProfileParser(
- CompressedLazyOperandValueProfileHolder& holder);
+ explicit LazyOperandValueProfileParser();
~LazyOperandValueProfileParser();
+ void initialize(
+ const ConcurrentJITLocker&, CompressedLazyOperandValueProfileHolder& holder);
+
LazyOperandValueProfile* getIfPresent(
const LazyOperandValueProfileKey& key) const;
- SpeculatedType prediction(const LazyOperandValueProfileKey& key) const;
+ SpeculatedType prediction(
+ const ConcurrentJITLocker&, const LazyOperandValueProfileKey& key) const;
private:
- CompressedLazyOperandValueProfileHolder& m_holder;
HashMap<LazyOperandValueProfileKey, LazyOperandValueProfile*> m_map;
};
} // namespace JSC
-#endif // ENABLE(VALUE_PROFILER)
-
#endif // LazyOperandValueProfile_h