| 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 11818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11829 object->GetElementsKind(), new_elements); | 11829 object->GetElementsKind(), new_elements); |
| 11830 } | 11830 } |
| 11831 | 11831 |
| 11832 if (object->IsJSArray()) { | 11832 if (object->IsJSArray()) { |
| 11833 Handle<JSArray>::cast(object)->set_length(Smi::FromInt(length)); | 11833 Handle<JSArray>::cast(object)->set_length(Smi::FromInt(length)); |
| 11834 } | 11834 } |
| 11835 return new_elements; | 11835 return new_elements; |
| 11836 } | 11836 } |
| 11837 | 11837 |
| 11838 | 11838 |
| 11839 void Code::GetICCounts(int* ic_with_type_info_count, |
| 11840 int* ic_total_count, |
| 11841 int* percentage) { |
| 11842 *ic_total_count = 0; |
| 11843 *ic_with_type_info_count = 0; |
| 11844 Object* raw_info = type_feedback_info(); |
| 11845 if (raw_info->IsTypeFeedbackInfo()) { |
| 11846 TypeFeedbackInfo* info = TypeFeedbackInfo::cast(raw_info); |
| 11847 *ic_with_type_info_count = info->ic_with_type_info_count(); |
| 11848 *ic_total_count = info->ic_total_count(); |
| 11849 } |
| 11850 *percentage = *ic_total_count > 0 |
| 11851 ? 100 * *ic_with_type_info_count / *ic_total_count |
| 11852 : 100; |
| 11853 } |
| 11854 |
| 11855 |
| 11839 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, | 11856 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, |
| 11840 int capacity, | 11857 int capacity, |
| 11841 int length) { | 11858 int length) { |
| 11842 // We should never end in here with a pixel or external array. | 11859 // We should never end in here with a pixel or external array. |
| 11843 ASSERT(!object->HasExternalArrayElements()); | 11860 ASSERT(!object->HasExternalArrayElements()); |
| 11844 | 11861 |
| 11845 Handle<FixedArrayBase> elems = | 11862 Handle<FixedArrayBase> elems = |
| 11846 object->GetIsolate()->factory()->NewFixedDoubleArray(capacity); | 11863 object->GetIsolate()->factory()->NewFixedDoubleArray(capacity); |
| 11847 | 11864 |
| 11848 ElementsKind elements_kind = object->GetElementsKind(); | 11865 ElementsKind elements_kind = object->GetElementsKind(); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12308 } | 12325 } |
| 12309 for (int i = start; i < end; i++) { | 12326 for (int i = start; i < end; i++) { |
| 12310 if (object_at(i) == code) return true; | 12327 if (object_at(i) == code) return true; |
| 12311 } | 12328 } |
| 12312 return false; | 12329 return false; |
| 12313 } | 12330 } |
| 12314 | 12331 |
| 12315 | 12332 |
| 12316 bool DependentCode::MarkCodeForDeoptimization( | 12333 bool DependentCode::MarkCodeForDeoptimization( |
| 12317 Isolate* isolate, | 12334 Isolate* isolate, |
| 12318 DependentCode::DependencyGroup group) { | 12335 DependentCode::DependencyGroup group, |
| 12336 bool instant_optimization) { |
| 12319 DisallowHeapAllocation no_allocation_scope; | 12337 DisallowHeapAllocation no_allocation_scope; |
| 12320 DependentCode::GroupStartIndexes starts(this); | 12338 DependentCode::GroupStartIndexes starts(this); |
| 12321 int start = starts.at(group); | 12339 int start = starts.at(group); |
| 12322 int end = starts.at(group + 1); | 12340 int end = starts.at(group + 1); |
| 12323 int code_entries = starts.number_of_entries(); | 12341 int code_entries = starts.number_of_entries(); |
| 12324 if (start == end) return false; | 12342 if (start == end) return false; |
| 12325 | 12343 |
| 12326 // Mark all the code that needs to be deoptimized. | 12344 // Mark all the code that needs to be deoptimized. |
| 12327 bool marked = false; | 12345 bool marked = false; |
| 12328 for (int i = start; i < end; i++) { | 12346 for (int i = start; i < end; i++) { |
| 12329 if (is_code_at(i)) { | 12347 if (is_code_at(i)) { |
| 12330 Code* code = code_at(i); | 12348 Code* code = code_at(i); |
| 12331 if (!code->marked_for_deoptimization()) { | 12349 if (!code->marked_for_deoptimization()) { |
| 12332 code->set_marked_for_deoptimization(true); | 12350 code->set_marked_for_deoptimization(true); |
| 12333 marked = true; | 12351 marked = true; |
| 12352 if (instant_optimization) { |
| 12353 code->set_marked_for_instant_optimization(true); |
| 12354 } |
| 12334 } | 12355 } |
| 12335 } else { | 12356 } else { |
| 12336 CompilationInfo* info = compilation_info_at(i); | 12357 CompilationInfo* info = compilation_info_at(i); |
| 12337 info->AbortDueToDependencyChange(); | 12358 info->AbortDueToDependencyChange(); |
| 12338 } | 12359 } |
| 12339 } | 12360 } |
| 12340 // Compact the array by moving all subsequent groups to fill in the new holes. | 12361 // Compact the array by moving all subsequent groups to fill in the new holes. |
| 12341 for (int src = end, dst = start; src < code_entries; src++, dst++) { | 12362 for (int src = end, dst = start; src < code_entries; src++, dst++) { |
| 12342 copy(src, dst); | 12363 copy(src, dst); |
| 12343 } | 12364 } |
| (...skipping 4930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17274 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17295 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 17275 static const char* error_messages_[] = { | 17296 static const char* error_messages_[] = { |
| 17276 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17297 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 17277 }; | 17298 }; |
| 17278 #undef ERROR_MESSAGES_TEXTS | 17299 #undef ERROR_MESSAGES_TEXTS |
| 17279 return error_messages_[reason]; | 17300 return error_messages_[reason]; |
| 17280 } | 17301 } |
| 17281 | 17302 |
| 17282 | 17303 |
| 17283 } } // namespace v8::internal | 17304 } } // namespace v8::internal |
| OLD | NEW |