OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "allocation-site-scopes.h" | 8 #include "allocation-site-scopes.h" |
9 #include "api.h" | 9 #include "api.h" |
10 #include "arguments.h" | 10 #include "arguments.h" |
(...skipping 11227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11238 info->host()->constant_pool()); | 11238 info->host()->constant_pool()); |
11239 } | 11239 } |
11240 } | 11240 } |
11241 } | 11241 } |
11242 } | 11242 } |
11243 | 11243 |
11244 | 11244 |
11245 void SharedFunctionInfo::ClearTypeFeedbackInfo() { | 11245 void SharedFunctionInfo::ClearTypeFeedbackInfo() { |
11246 FixedArray* vector = feedback_vector(); | 11246 FixedArray* vector = feedback_vector(); |
11247 Heap* heap = GetHeap(); | 11247 Heap* heap = GetHeap(); |
| 11248 JSFunction* array_function = NULL; |
| 11249 |
| 11250 // Clearing type feedback can be called when the contexts are still being |
| 11251 // set up so caution is required. |
11248 Context* context = GetIsolate()->context(); | 11252 Context* context = GetIsolate()->context(); |
11249 JSFunction* array_function = context != NULL | 11253 if (context != NULL) { |
11250 ? context->native_context()->array_function() | 11254 Context* native_context = context->native_context(); |
11251 : NULL; | 11255 Object* candidate = native_context->get(Context::ARRAY_FUNCTION_INDEX); |
| 11256 if (candidate->IsJSFunction()) { |
| 11257 array_function = JSFunction::cast(candidate); |
| 11258 } |
| 11259 } |
| 11260 |
11252 int length = vector->length(); | 11261 int length = vector->length(); |
11253 | 11262 |
11254 for (int i = 0; i < length; i++) { | 11263 for (int i = 0; i < length; i++) { |
11255 Object* obj = vector->get(i); | 11264 Object* obj = vector->get(i); |
11256 if (obj->IsHeapObject()) { | 11265 if (obj->IsHeapObject()) { |
11257 InstanceType instance_type = | 11266 InstanceType instance_type = |
11258 HeapObject::cast(obj)->map()->instance_type(); | 11267 HeapObject::cast(obj)->map()->instance_type(); |
11259 switch (instance_type) { | 11268 switch (instance_type) { |
11260 case ALLOCATION_SITE_TYPE: | 11269 case ALLOCATION_SITE_TYPE: |
11261 // AllocationSites are not cleared because they do not store | 11270 // AllocationSites are not cleared because they do not store |
(...skipping 6048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17310 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17319 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17311 static const char* error_messages_[] = { | 17320 static const char* error_messages_[] = { |
17312 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17321 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17313 }; | 17322 }; |
17314 #undef ERROR_MESSAGES_TEXTS | 17323 #undef ERROR_MESSAGES_TEXTS |
17315 return error_messages_[reason]; | 17324 return error_messages_[reason]; |
17316 } | 17325 } |
17317 | 17326 |
17318 | 17327 |
17319 } } // namespace v8::internal | 17328 } } // namespace v8::internal |
OLD | NEW |