summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-27 21:51:42 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-27 21:51:42 +0200
commitbe01689f43cf6882cf670d33df49ead1f570c53a (patch)
tree4bb2161d8983b38e3e7ed37b4a50303bfd5e2e85 /Source/JavaScriptCore/bytecode
parenta89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (diff)
downloadqtwebkit-be01689f43cf6882cf670d33df49ead1f570c53a.tar.gz
Imported WebKit commit 8d6c5efc74f0222dfc7bcce8d845d4a2707ed9e6 (http://svn.webkit.org/repository/webkit/trunk@118629)
Diffstat (limited to 'Source/JavaScriptCore/bytecode')
-rw-r--r--Source/JavaScriptCore/bytecode/CodeBlock.cpp7
-rw-r--r--Source/JavaScriptCore/bytecode/CodeBlock.h6
-rw-r--r--Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp4
-rw-r--r--Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h2
-rw-r--r--Source/JavaScriptCore/bytecode/Opcode.h2
-rw-r--r--Source/JavaScriptCore/bytecode/ValueProfile.h27
6 files changed, 40 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
index 6677b302b..e3ee2ed41 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -670,6 +670,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
case op_convert_this: {
int r0 = (++it)->u.operand;
dataLog("[%4d] convert_this\t %s\n", location, registerName(exec, r0).data());
+ ++it; // Skip value profile.
break;
}
case op_new_object: {
@@ -2085,14 +2086,14 @@ void CodeBlock::stronglyVisitStrongReferences(SlotVisitor& visitor)
}
}
- m_lazyOperandValueProfiles.computeUpdatedPredictions();
+ m_lazyOperandValueProfiles.computeUpdatedPredictions(Collection);
#endif
#if ENABLE(VALUE_PROFILER)
for (unsigned profileIndex = 0; profileIndex < numberOfArgumentValueProfiles(); ++profileIndex)
- valueProfileForArgument(profileIndex)->computeUpdatedPrediction();
+ valueProfileForArgument(profileIndex)->computeUpdatedPrediction(Collection);
for (unsigned profileIndex = 0; profileIndex < numberOfValueProfiles(); ++profileIndex)
- valueProfile(profileIndex)->computeUpdatedPrediction();
+ valueProfile(profileIndex)->computeUpdatedPrediction(Collection);
#endif
}
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h
index c1772c3bf..ccaca3373 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.h
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.h
@@ -449,6 +449,12 @@ namespace JSC {
ASSERT(needsFullScopeChain());
return m_activationRegister;
}
+ int uncheckedActivationRegister()
+ {
+ if (!needsFullScopeChain())
+ return InvalidVirtualRegister;
+ return activationRegister();
+ }
bool usesArguments() const { return m_argumentsRegister != -1; }
bool needsActivation() const
diff --git a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp
index f199b6923..695e21219 100644
--- a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp
+++ b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp
@@ -33,13 +33,13 @@ namespace JSC {
CompressedLazyOperandValueProfileHolder::CompressedLazyOperandValueProfileHolder() { }
CompressedLazyOperandValueProfileHolder::~CompressedLazyOperandValueProfileHolder() { }
-void CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions()
+void CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions(OperationInProgress operation)
{
if (!m_data)
return;
for (unsigned i = 0; i < m_data->size(); ++i)
- m_data->at(i).computeUpdatedPrediction();
+ m_data->at(i).computeUpdatedPrediction(operation);
}
LazyOperandValueProfile* CompressedLazyOperandValueProfileHolder::add(
diff --git a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
index d0260f991..91e5314aa 100644
--- a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
+++ b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
@@ -155,7 +155,7 @@ public:
CompressedLazyOperandValueProfileHolder();
~CompressedLazyOperandValueProfileHolder();
- void computeUpdatedPredictions();
+ void computeUpdatedPredictions(OperationInProgress);
LazyOperandValueProfile* add(const LazyOperandValueProfileKey& key);
diff --git a/Source/JavaScriptCore/bytecode/Opcode.h b/Source/JavaScriptCore/bytecode/Opcode.h
index ebf15bbd4..aa83d9b97 100644
--- a/Source/JavaScriptCore/bytecode/Opcode.h
+++ b/Source/JavaScriptCore/bytecode/Opcode.h
@@ -43,7 +43,7 @@ namespace JSC {
macro(op_init_lazy_reg, 2) \
macro(op_create_arguments, 2) \
macro(op_create_this, 2) \
- macro(op_convert_this, 2) \
+ macro(op_convert_this, 3) \
\
macro(op_new_object, 2) \
macro(op_new_array, 4) \
diff --git a/Source/JavaScriptCore/bytecode/ValueProfile.h b/Source/JavaScriptCore/bytecode/ValueProfile.h
index 73e363a8b..47fa8b72c 100644
--- a/Source/JavaScriptCore/bytecode/ValueProfile.h
+++ b/Source/JavaScriptCore/bytecode/ValueProfile.h
@@ -33,6 +33,7 @@
#if ENABLE(VALUE_PROFILER)
+#include "Heap.h"
#include "JSArray.h"
#include "PredictedType.h"
#include "Structure.h"
@@ -51,6 +52,7 @@ struct ValueProfileBase {
: m_bytecodeOffset(-1)
, m_prediction(PredictNone)
, m_numberOfSamplesInPrediction(0)
+ , m_singletonValueIsTop(false)
{
for (unsigned i = 0; i < totalNumberOfBuckets; ++i)
m_buckets[i] = JSValue::encode(JSValue());
@@ -60,6 +62,7 @@ struct ValueProfileBase {
: m_bytecodeOffset(bytecodeOffset)
, m_prediction(PredictNone)
, m_numberOfSamplesInPrediction(0)
+ , m_singletonValueIsTop(false)
{
for (unsigned i = 0; i < totalNumberOfBuckets; ++i)
m_buckets[i] = JSValue::encode(JSValue());
@@ -112,6 +115,11 @@ struct ValueProfileBase {
"samples = %u, prediction = %s",
totalNumberOfSamples(),
predictionToString(m_prediction));
+ fprintf(out, ", value = ");
+ if (m_singletonValueIsTop)
+ fprintf(out, "TOP");
+ else
+ fprintf(out, "%s", m_singletonValue.description());
bool first = true;
for (unsigned i = 0; i < totalNumberOfBuckets; ++i) {
JSValue value = JSValue::decode(m_buckets[i]);
@@ -127,7 +135,7 @@ struct ValueProfileBase {
}
// Updates the prediction and returns the new one.
- PredictedType computeUpdatedPrediction()
+ PredictedType computeUpdatedPrediction(OperationInProgress operation = NoOperation)
{
for (unsigned i = 0; i < totalNumberOfBuckets; ++i) {
JSValue value = JSValue::decode(m_buckets[i]);
@@ -137,9 +145,23 @@ struct ValueProfileBase {
m_numberOfSamplesInPrediction++;
mergePrediction(m_prediction, predictionFromValue(value));
+ if (!m_singletonValueIsTop && !!value) {
+ if (!m_singletonValue)
+ m_singletonValue = value;
+ else if (m_singletonValue != value)
+ m_singletonValueIsTop = true;
+ }
+
m_buckets[i] = JSValue::encode(JSValue());
}
+ if (operation == Collection
+ && !m_singletonValueIsTop
+ && !!m_singletonValue
+ && m_singletonValue.isCell()
+ && !Heap::isMarked(m_singletonValue.asCell()))
+ m_singletonValueIsTop = true;
+
return m_prediction;
}
@@ -148,6 +170,9 @@ struct ValueProfileBase {
PredictedType m_prediction;
unsigned m_numberOfSamplesInPrediction;
+ bool m_singletonValueIsTop;
+ JSValue m_singletonValue;
+
EncodedJSValue m_buckets[totalNumberOfBuckets];
};