| 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. | |
| 11252 Context* context = GetIsolate()->context(); | |
| 11253 if (context != NULL) { | |
| 11254 Context* native_context = context->native_context(); | |
| 11255 Object* candidate = native_context->get(Context::ARRAY_FUNCTION_INDEX); | |
| 11256 if (candidate->IsJSFunction()) { | |
| 11257 array_function = JSFunction::cast(candidate); | |
| 11258 } | |
| 11259 } | |
| 11260 | |
| 11261 int length = vector->length(); | 11248 int length = vector->length(); |
| 11262 | 11249 |
| 11263 for (int i = 0; i < length; i++) { | 11250 for (int i = 0; i < length; i++) { |
| 11264 Object* obj = vector->get(i); | 11251 Object* obj = vector->get(i); |
| 11265 if (obj->IsHeapObject()) { | 11252 if (obj->IsHeapObject()) { |
| 11266 InstanceType instance_type = | 11253 InstanceType instance_type = |
| 11267 HeapObject::cast(obj)->map()->instance_type(); | 11254 HeapObject::cast(obj)->map()->instance_type(); |
| 11268 switch (instance_type) { | 11255 switch (instance_type) { |
| 11269 case ALLOCATION_SITE_TYPE: | 11256 case ALLOCATION_SITE_TYPE: |
| 11270 // AllocationSites are not cleared because they do not store | 11257 // AllocationSites are not cleared because they do not store |
| 11271 // information that leaks. | 11258 // information that leaks. |
| 11272 break; | 11259 break; |
| 11273 case JS_FUNCTION_TYPE: | 11260 case JS_FUNCTION_TYPE: |
| 11274 // No need to clear the native context array function. | 11261 // No need to clear the native context array function. |
| 11275 if (obj == array_function) break; | 11262 if (obj == JSFunction::cast(obj)->context()->native_context()-> |
| 11263 get(Context::ARRAY_FUNCTION_INDEX)) { |
| 11264 break; |
| 11265 } |
| 11276 // Fall through... | 11266 // Fall through... |
| 11267 |
| 11277 default: | 11268 default: |
| 11278 vector->set(i, TypeFeedbackInfo::RawUninitializedSentinel(heap), | 11269 vector->set(i, TypeFeedbackInfo::RawUninitializedSentinel(heap), |
| 11279 SKIP_WRITE_BARRIER); | 11270 SKIP_WRITE_BARRIER); |
| 11280 } | 11271 } |
| 11281 } | 11272 } |
| 11282 } | 11273 } |
| 11283 } | 11274 } |
| 11284 | 11275 |
| 11285 | 11276 |
| 11286 BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) { | 11277 BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) { |
| (...skipping 6032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17319 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17310 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 17320 static const char* error_messages_[] = { | 17311 static const char* error_messages_[] = { |
| 17321 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17312 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 17322 }; | 17313 }; |
| 17323 #undef ERROR_MESSAGES_TEXTS | 17314 #undef ERROR_MESSAGES_TEXTS |
| 17324 return error_messages_[reason]; | 17315 return error_messages_[reason]; |
| 17325 } | 17316 } |
| 17326 | 17317 |
| 17327 | 17318 |
| 17328 } } // namespace v8::internal | 17319 } } // namespace v8::internal |
| OLD | NEW |