Commit 3200fafa authored by klaasb's avatar klaasb Committed by Commit bot

[interpreter] Compute and use type info percentage

Previously we would not have a total count of ICs when interpreting and
thus the check for sufficient type info would always succeed.
Also use the optimization checks for OSR while waiting for baseline
compilation and refactor the check.

BUG=v8:4280
BUG=chromium:634884

Review-Url: https://codereview.chromium.org/2360913003
Cr-Commit-Position: refs/heads/master@{#39677}
parent 73518a90
This diff is collapsed.
......@@ -13,6 +13,7 @@ namespace internal {
class Isolate;
class JavaScriptFrame;
class JSFunction;
enum class OptimizationReason : uint8_t;
class RuntimeProfiler {
public:
......@@ -30,8 +31,13 @@ class RuntimeProfiler {
int frame_count);
void MaybeBaselineIgnition(JSFunction* function, JavaScriptFrame* frame);
void MaybeOptimizeIgnition(JSFunction* function, JavaScriptFrame* frame);
void Optimize(JSFunction* function, const char* reason);
void Baseline(JSFunction* function, const char* reason);
// Potentially attempts OSR from ignition and returns whether no other
// optimization attempts should be made.
bool MaybeOSRIgnition(JSFunction* function, JavaScriptFrame* frame);
OptimizationReason ShouldOptimizeIgnition(JSFunction* function,
JavaScriptFrame* frame);
void Optimize(JSFunction* function, OptimizationReason reason);
void Baseline(JSFunction* function, OptimizationReason reason);
Isolate* isolate_;
bool any_ic_changed_;
......
......@@ -148,6 +148,7 @@ CompareOperationHint CompareOperationHintFromFeedback(int type_feedback) {
}
void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic,
int* vector_ic_count,
bool code_is_interpreted) {
Object* uninitialized_sentinel =
TypeFeedbackVector::RawUninitializedSentinel(GetIsolate());
......@@ -155,14 +156,19 @@ void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic,
*TypeFeedbackVector::MegamorphicSentinel(GetIsolate());
int with = 0;
int gen = 0;
int total = 0;
TypeFeedbackMetadataIterator iter(metadata());
while (iter.HasNext()) {
FeedbackVectorSlot slot = iter.Next();
FeedbackVectorSlotKind kind = iter.kind();
Object* obj = Get(slot);
if (obj != uninitialized_sentinel &&
kind != FeedbackVectorSlotKind::GENERAL) {
if (kind == FeedbackVectorSlotKind::GENERAL) {
continue;
}
total++;
if (obj != uninitialized_sentinel) {
if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC ||
kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) {
// If we are not running interpreted code, we need to ignore
......@@ -202,6 +208,7 @@ void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic,
*with_type_info = with;
*generic = gen;
*vector_ic_count = total;
}
Handle<Symbol> TypeFeedbackVector::UninitializedSentinel(Isolate* isolate) {
......
......@@ -248,7 +248,7 @@ class TypeFeedbackVector : public FixedArray {
static const int kReservedIndexCount = 2;
inline void ComputeCounts(int* with_type_info, int* generic,
bool code_is_interpreted);
int* vector_ic_count, bool code_is_interpreted);
inline bool is_empty() const;
......
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