VectorICs: recreate feedback vector if scoping changes on recompile.

BUG=476488
LOG=N
R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1080253003

Cr-Commit-Position: refs/heads/master@{#27817}
This commit is contained in:
mvstanton 2015-04-14 05:31:33 -07:00 committed by Commit bot
parent cf663c487f
commit 2ebb794b4f
4 changed files with 35 additions and 1 deletions

View File

@ -251,7 +251,8 @@ bool CompilationInfo::ShouldSelfOptimize() {
void CompilationInfo::EnsureFeedbackVector() {
if (feedback_vector_.is_null()) {
if (feedback_vector_.is_null() ||
feedback_vector_->SpecDiffersFrom(function()->feedback_vector_spec())) {
feedback_vector_ = isolate()->factory()->NewTypeFeedbackVector(
function()->feedback_vector_spec());
}

View File

@ -137,6 +137,22 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::Copy(
}
bool TypeFeedbackVector::SpecDiffersFrom(
const ZoneFeedbackVectorSpec* other_spec) const {
if (other_spec->slots() != Slots() || other_spec->ic_slots() != ICSlots()) {
return true;
}
int ic_slots = ICSlots();
for (int i = 0; i < ic_slots; i++) {
if (GetKind(FeedbackVectorICSlot(i)) != other_spec->GetKind(i)) {
return true;
}
}
return false;
}
// This logic is copied from
// StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget.
static bool ClearLogic(Heap* heap) {

View File

@ -134,6 +134,8 @@ class TypeFeedbackVector : public FixedArray {
inline int ic_metadata_length() const;
bool SpecDiffersFrom(const ZoneFeedbackVectorSpec* other_spec) const;
int Slots() const {
if (length() == 0) return 0;
return Max(

View File

@ -0,0 +1,15 @@
// Copyright 2015 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.
// Flags: --always-opt --expose-gc
function __f_0(message, a) {
eval(), message;
(function blue() {
'use strict';
eval(), eval(), message;
gc();
})();
}
__f_0();