| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 9303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9314 FixedArray* literals) { | 9314 FixedArray* literals) { |
| 9315 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); | 9315 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); |
| 9316 ASSERT(native_context->IsNativeContext()); | 9316 ASSERT(native_context->IsNativeContext()); |
| 9317 STATIC_ASSERT(kEntryLength == 3); | 9317 STATIC_ASSERT(kEntryLength == 3); |
| 9318 Heap* heap = GetHeap(); | 9318 Heap* heap = GetHeap(); |
| 9319 FixedArray* new_code_map; | 9319 FixedArray* new_code_map; |
| 9320 Object* value = optimized_code_map(); | 9320 Object* value = optimized_code_map(); |
| 9321 if (value->IsSmi()) { | 9321 if (value->IsSmi()) { |
| 9322 // No optimized code map. | 9322 // No optimized code map. |
| 9323 ASSERT_EQ(0, Smi::cast(value)->value()); | 9323 ASSERT_EQ(0, Smi::cast(value)->value()); |
| 9324 // Crate 3 entries per context {context, code, literals}. | 9324 // Create 3 entries per context {context, code, literals}. |
| 9325 MaybeObject* maybe = heap->AllocateFixedArray(kInitialLength); | 9325 MaybeObject* maybe = heap->AllocateFixedArray(kInitialLength); |
| 9326 if (!maybe->To(&new_code_map)) return maybe; | 9326 if (!maybe->To(&new_code_map)) return maybe; |
| 9327 new_code_map->set(kEntriesStart + 0, native_context); | 9327 new_code_map->set(kEntriesStart + 0, native_context); |
| 9328 new_code_map->set(kEntriesStart + 1, code); | 9328 new_code_map->set(kEntriesStart + 1, code); |
| 9329 new_code_map->set(kEntriesStart + 2, literals); | 9329 new_code_map->set(kEntriesStart + 2, literals); |
| 9330 } else { | 9330 } else { |
| 9331 // Copy old map and append one new entry. | 9331 // Copy old map and append one new entry. |
| 9332 FixedArray* old_code_map = FixedArray::cast(value); | 9332 FixedArray* old_code_map = FixedArray::cast(value); |
| 9333 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context)); | 9333 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context)); |
| 9334 int old_length = old_code_map->length(); | 9334 int old_length = old_code_map->length(); |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11236 } | 11236 } |
| 11237 | 11237 |
| 11238 | 11238 |
| 11239 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, | 11239 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, |
| 11240 DependencyGroup group, | 11240 DependencyGroup group, |
| 11241 Handle<Object> object) { | 11241 Handle<Object> object) { |
| 11242 GroupStartIndexes starts(*entries); | 11242 GroupStartIndexes starts(*entries); |
| 11243 int start = starts.at(group); | 11243 int start = starts.at(group); |
| 11244 int end = starts.at(group + 1); | 11244 int end = starts.at(group + 1); |
| 11245 int number_of_entries = starts.number_of_entries(); | 11245 int number_of_entries = starts.number_of_entries(); |
| 11246 if (start < end && entries->object_at(end - 1) == *object) { | 11246 // Check for existing entry to avoid duplicates. |
| 11247 // Do not append the compilation info if it is already in the array. | 11247 for (int i = start; i < end; i++) { |
| 11248 // It is sufficient to just check only the last element because | 11248 if (entries->object_at(i) == *object) return entries; |
| 11249 // we process embedded maps of an optimized code in one batch. | |
| 11250 return entries; | |
| 11251 } | 11249 } |
| 11252 if (entries->length() < kCodesStartIndex + number_of_entries + 1) { | 11250 if (entries->length() < kCodesStartIndex + number_of_entries + 1) { |
| 11253 Factory* factory = entries->GetIsolate()->factory(); | 11251 Factory* factory = entries->GetIsolate()->factory(); |
| 11254 int capacity = kCodesStartIndex + number_of_entries + 1; | 11252 int capacity = kCodesStartIndex + number_of_entries + 1; |
| 11255 if (capacity > 5) capacity = capacity * 5 / 4; | 11253 if (capacity > 5) capacity = capacity * 5 / 4; |
| 11256 Handle<DependentCode> new_entries = Handle<DependentCode>::cast( | 11254 Handle<DependentCode> new_entries = Handle<DependentCode>::cast( |
| 11257 factory->CopySizeFixedArray(entries, capacity)); | 11255 factory->CopySizeFixedArray(entries, capacity)); |
| 11258 // The number of codes can change after GC. | 11256 // The number of codes can change after GC. |
| 11259 starts.Recompute(*entries); | 11257 starts.Recompute(*entries); |
| 11260 start = starts.at(group); | 11258 start = starts.at(group); |
| (...skipping 4716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15977 #define ERROR_MESSAGES_TEXTS(C, T) T, | 15975 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 15978 static const char* error_messages_[] = { | 15976 static const char* error_messages_[] = { |
| 15979 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 15977 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 15980 }; | 15978 }; |
| 15981 #undef ERROR_MESSAGES_TEXTS | 15979 #undef ERROR_MESSAGES_TEXTS |
| 15982 return error_messages_[reason]; | 15980 return error_messages_[reason]; |
| 15983 } | 15981 } |
| 15984 | 15982 |
| 15985 | 15983 |
| 15986 } } // namespace v8::internal | 15984 } } // namespace v8::internal |
| OLD | NEW |