Fix default type feedback returned from the oracle

R=rossberg@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15459 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e67fb1e1
......@@ -9256,12 +9256,6 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
Representation combined_rep = ToRepresentation(combined_type);
Representation left_rep = ToRepresentation(left_type);
Representation right_rep = ToRepresentation(right_type);
// Check if this expression was ever executed according to type feedback.
// Note that for the special typeof/null/undefined cases we get unknown here.
if (combined_type->Is(Type::None())) {
AddSoftDeoptimize();
combined_type = left_type = right_type = handle(Type::Any(), isolate());
}
CHECK_ALIVE(VisitForValue(expr->left()));
CHECK_ALIVE(VisitForValue(expr->right()));
......@@ -9328,11 +9322,23 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
result->set_position(expr->position());
return ast_context()->ReturnInstruction(result, expr->id());
}
// Code below assumes that we don't fall through.
UNREACHABLE();
} else if (op == Token::IN) {
HIn* result = new(zone()) HIn(context, left, right);
result->set_position(expr->position());
return ast_context()->ReturnInstruction(result, expr->id());
} else if (combined_type->Is(Type::Receiver())) {
}
// Cases handled below depend on collected type feedback. They should
// soft deoptimize when there is no type feedback.
if (combined_type->Is(Type::None())) {
AddSoftDeoptimize();
combined_type = left_type = right_type = handle(Type::Any(), isolate());
}
if (combined_type->Is(Type::Receiver())) {
switch (op) {
case Token::EQ:
case Token::EQ_STRICT: {
......
......@@ -356,9 +356,12 @@ void TypeFeedbackOracle::CompareType(TypeFeedbackId id,
Handle<Type>* left_type,
Handle<Type>* right_type,
Handle<Type>* combined_type) {
*left_type = *right_type = *combined_type = handle(Type::Any(), isolate_);
Handle<Object> info = GetInfo(id);
if (!info->IsCode()) return;
if (!info->IsCode()) {
// For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
*left_type = *right_type = *combined_type = handle(Type::None(), isolate_);
return;
}
Handle<Code> code = Handle<Code>::cast(info);
Handle<Map> map;
......@@ -387,7 +390,9 @@ void TypeFeedbackOracle::CompareType(TypeFeedbackId id,
Handle<Type> TypeFeedbackOracle::UnaryType(TypeFeedbackId id) {
Handle<Object> object = GetInfo(id);
if (!object->IsCode()) return handle(Type::Any(), isolate());
if (!object->IsCode()) {
return handle(Type::None(), isolate());
}
Handle<Code> code = Handle<Code>::cast(object);
ASSERT(code->is_unary_op_stub());
return UnaryOpIC::TypeInfoToType(
......@@ -401,10 +406,13 @@ void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
Handle<Type>* result,
Maybe<int>* fixed_right_arg) {
Handle<Object> object = GetInfo(id);
*left = *right = *result = handle(Type::Any(), isolate_);
if (!object->IsCode()) return;
if (!object->IsCode()) {
// For some binary ops we don't have ICs, e.g. Token::COMMA.
*left = *right = *result = handle(Type::None(), isolate_);
return;
}
Handle<Code> code = Handle<Code>::cast(object);
if (!code->is_binary_op_stub()) return;
ASSERT(code->is_binary_op_stub());
int minor_key = code->stub_info();
BinaryOpIC::StubInfoToType(minor_key, left, right, result, isolate());
......
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