| 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 9360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9371 FixedArray* literals) { | 9371 FixedArray* literals) { |
| 9372 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); | 9372 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); |
| 9373 ASSERT(native_context->IsNativeContext()); | 9373 ASSERT(native_context->IsNativeContext()); |
| 9374 STATIC_ASSERT(kEntryLength == 3); | 9374 STATIC_ASSERT(kEntryLength == 3); |
| 9375 Heap* heap = GetHeap(); | 9375 Heap* heap = GetHeap(); |
| 9376 FixedArray* new_code_map; | 9376 FixedArray* new_code_map; |
| 9377 Object* value = optimized_code_map(); | 9377 Object* value = optimized_code_map(); |
| 9378 if (value->IsSmi()) { | 9378 if (value->IsSmi()) { |
| 9379 // No optimized code map. | 9379 // No optimized code map. |
| 9380 ASSERT_EQ(0, Smi::cast(value)->value()); | 9380 ASSERT_EQ(0, Smi::cast(value)->value()); |
| 9381 // Crate 3 entries per context {context, code, literals}. | 9381 // Create 3 entries per context {context, code, literals}. |
| 9382 MaybeObject* maybe = heap->AllocateFixedArray(kInitialLength); | 9382 MaybeObject* maybe = heap->AllocateFixedArray(kInitialLength); |
| 9383 if (!maybe->To(&new_code_map)) return maybe; | 9383 if (!maybe->To(&new_code_map)) return maybe; |
| 9384 new_code_map->set(kEntriesStart + 0, native_context); | 9384 new_code_map->set(kEntriesStart + 0, native_context); |
| 9385 new_code_map->set(kEntriesStart + 1, code); | 9385 new_code_map->set(kEntriesStart + 1, code); |
| 9386 new_code_map->set(kEntriesStart + 2, literals); | 9386 new_code_map->set(kEntriesStart + 2, literals); |
| 9387 } else { | 9387 } else { |
| 9388 // Copy old map and append one new entry. | 9388 // Copy old map and append one new entry. |
| 9389 FixedArray* old_code_map = FixedArray::cast(value); | 9389 FixedArray* old_code_map = FixedArray::cast(value); |
| 9390 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context)); | 9390 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context)); |
| 9391 int old_length = old_code_map->length(); | 9391 int old_length = old_code_map->length(); |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11317 } | 11317 } |
| 11318 | 11318 |
| 11319 | 11319 |
| 11320 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, | 11320 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, |
| 11321 DependencyGroup group, | 11321 DependencyGroup group, |
| 11322 Handle<Object> object) { | 11322 Handle<Object> object) { |
| 11323 GroupStartIndexes starts(*entries); | 11323 GroupStartIndexes starts(*entries); |
| 11324 int start = starts.at(group); | 11324 int start = starts.at(group); |
| 11325 int end = starts.at(group + 1); | 11325 int end = starts.at(group + 1); |
| 11326 int number_of_entries = starts.number_of_entries(); | 11326 int number_of_entries = starts.number_of_entries(); |
| 11327 if (start < end && entries->object_at(end - 1) == *object) { | 11327 // Check for existing entry to avoid duplicates. |
| 11328 // Do not append the compilation info if it is already in the array. | 11328 for (int i = start; i < end; i++) { |
| 11329 // It is sufficient to just check only the last element because | 11329 if (entries->object_at(i) == *object) return entries; |
| 11330 // we process embedded maps of an optimized code in one batch. | |
| 11331 return entries; | |
| 11332 } | 11330 } |
| 11333 if (entries->length() < kCodesStartIndex + number_of_entries + 1) { | 11331 if (entries->length() < kCodesStartIndex + number_of_entries + 1) { |
| 11334 Factory* factory = entries->GetIsolate()->factory(); | 11332 Factory* factory = entries->GetIsolate()->factory(); |
| 11335 int capacity = kCodesStartIndex + number_of_entries + 1; | 11333 int capacity = kCodesStartIndex + number_of_entries + 1; |
| 11336 if (capacity > 5) capacity = capacity * 5 / 4; | 11334 if (capacity > 5) capacity = capacity * 5 / 4; |
| 11337 Handle<DependentCode> new_entries = Handle<DependentCode>::cast( | 11335 Handle<DependentCode> new_entries = Handle<DependentCode>::cast( |
| 11338 factory->CopySizeFixedArray(entries, capacity)); | 11336 factory->CopySizeFixedArray(entries, capacity)); |
| 11339 // The number of codes can change after GC. | 11337 // The number of codes can change after GC. |
| 11340 starts.Recompute(*entries); | 11338 starts.Recompute(*entries); |
| 11341 start = starts.at(group); | 11339 start = starts.at(group); |
| (...skipping 4796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16138 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16136 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16139 static const char* error_messages_[] = { | 16137 static const char* error_messages_[] = { |
| 16140 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16138 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16141 }; | 16139 }; |
| 16142 #undef ERROR_MESSAGES_TEXTS | 16140 #undef ERROR_MESSAGES_TEXTS |
| 16143 return error_messages_[reason]; | 16141 return error_messages_[reason]; |
| 16144 } | 16142 } |
| 16145 | 16143 |
| 16146 | 16144 |
| 16147 } } // namespace v8::internal | 16145 } } // namespace v8::internal |
| OLD | NEW |