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()));
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: {
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;
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(
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());