Index: src/type-info.cc |
diff --git a/src/type-info.cc b/src/type-info.cc |
index bc6a46b4b664f095e6587ed8fa873df9868b5093..f97605bded9c4f6f58ec368e5a00e8ff92a1f687 100644 |
--- a/src/type-info.cc |
+++ b/src/type-info.cc |
@@ -171,6 +171,11 @@ bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { |
Handle<Object> value = GetInfo(expr->CallNewFeedbackId()); |
+ if (value->IsSmi()) { |
+ ASSERT(static_cast<ElementsKind>(Smi::cast(*value)->value()) <= |
+ LAST_FAST_ELEMENTS_KIND); |
+ return Isolate::Current()->global_context()->array_function(); |
+ } |
return value->IsJSFunction(); |
} |
@@ -295,7 +300,25 @@ Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { |
Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { |
- return Handle<JSFunction>::cast(GetInfo(expr->CallNewFeedbackId())); |
+ Handle <Object> info = GetInfo(expr->CallNewFeedbackId()); |
+ if (info->IsSmi()) { |
+ ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <= |
+ LAST_FAST_ELEMENTS_KIND); |
+ return Handle<JSFunction>(Isolate::Current()->global_context()-> |
+ array_function()); |
+ } else { |
+ return Handle<JSFunction>::cast(info); |
+ } |
+} |
+ |
+ |
+ElementsKind TypeFeedbackOracle::GetCallNewElementsKind(CallNew* expr) { |
+ Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
+ if (info->IsSmi()) { |
+ return static_cast<ElementsKind>(Smi::cast(*info)->value()); |
+ } else { |
+ return GetInitialFastElementsKind(); |
+ } |
} |