Commit 878071af authored by mvstanton's avatar mvstanton Committed by Commit bot

VectorICs: VisitClassLiteral needs adjustment for IC slot usage.

Also, generic lowering for keyed stores needs to handle the case when
there is no IC slot available (it can use the generic keyed store).

BUG=
R=mstarzinger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29847}
parent cd9ae446
......@@ -1663,9 +1663,10 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
DCHECK_NOT_NULL(expr->class_variable_proxy());
Variable* var = expr->class_variable_proxy()->var();
FrameStateBeforeAndAfter states(this, BailoutId::None());
VectorSlotPair feedback = CreateVectorSlotPair(
FLAG_vector_stores ? expr->GetNthSlot(store_slot_index++)
: FeedbackVectorICSlot::Invalid());
VectorSlotPair feedback =
CreateVectorSlotPair(FLAG_vector_stores && var->IsUnallocated()
? expr->GetNthSlot(store_slot_index++)
: FeedbackVectorICSlot::Invalid());
BuildVariableAssignment(var, literal, Token::INIT_CONST, feedback,
BailoutId::None(), states);
}
......@@ -1972,6 +1973,9 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
FrameStateBeforeAndAfter states(this, subexpr->id());
Node* value = environment()->Pop();
Node* index = jsgraph()->Constant(array_index);
// TODO(turbofan): More efficient code could be generated here. Consider
// that the store will be generic because we don't have a feedback vector
// slot.
Node* store = BuildKeyedStore(literal, index, value, VectorSlotPair(),
TypeFeedbackId::None());
states.AddToNode(store, expr->GetIdForElement(array_index),
......
......@@ -359,10 +359,14 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) {
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
const StorePropertyParameters& p = StorePropertyParametersOf(node->op());
LanguageMode language_mode = OpParameter<LanguageMode>(node);
// We have a special case where we do keyed stores but don't have a type
// feedback vector slot allocated to support it. In this case, install
// the megamorphic keyed store stub which needs neither vector nor slot.
bool use_vector_slot = FLAG_vector_stores && p.feedback().index() != -1;
Callable callable = CodeFactory::KeyedStoreICInOptimizedCode(
isolate(), language_mode, UNINITIALIZED);
if (FLAG_vector_stores) {
DCHECK(p.feedback().index() != -1);
isolate(), language_mode,
(use_vector_slot || !FLAG_vector_stores) ? UNINITIALIZED : MEGAMORPHIC);
if (use_vector_slot) {
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
} else {
node->RemoveInput(3);
......
......@@ -1309,9 +1309,11 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) {
if (lit->scope() != NULL) {
DCHECK_NOT_NULL(lit->class_variable_proxy());
FeedbackVectorICSlot slot = FLAG_vector_stores
? lit->GetNthSlot(store_slot_index++)
: FeedbackVectorICSlot::Invalid();
FeedbackVectorICSlot slot =
FLAG_vector_stores &&
lit->class_variable_proxy()->var()->IsUnallocated()
? lit->GetNthSlot(store_slot_index++)
: FeedbackVectorICSlot::Invalid();
EmitVariableAssignment(lit->class_variable_proxy()->var(),
Token::INIT_CONST, slot);
}
......
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