void SharedFunctionInfo::ClearTypeFeedbackInfo() {
FixedArray* vector = feedback_vector();
Heap* heap = GetHeap();
- JSFunction* array_function = NULL;
-
- // Clearing type feedback can be called when the contexts are still being
- // set up so caution is required.
- Context* context = GetIsolate()->context();
- if (context != NULL) {
- Context* native_context = context->native_context();
- Object* candidate = native_context->get(Context::ARRAY_FUNCTION_INDEX);
- if (candidate->IsJSFunction()) {
- array_function = JSFunction::cast(candidate);
- }
- }
-
int length = vector->length();
for (int i = 0; i < length; i++) {
break;
case JS_FUNCTION_TYPE:
// No need to clear the native context array function.
- if (obj == array_function) break;
+ if (obj == JSFunction::cast(obj)->context()->native_context()->
+ get(Context::ARRAY_FUNCTION_INDEX)) {
+ break;
+ }
// Fall through...
+
default:
vector->set(i, TypeFeedbackInfo::RawUninitializedSentinel(heap),
SKIP_WRITE_BARRIER);