Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: src/objects.cc

Issue 71653008: Fix duplicate check in DependentCode::Insert. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11627 matching lines...) Expand 10 before | Expand all | Expand 10 after
11638 } 11638 }
11639 11639
11640 11640
11641 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, 11641 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries,
11642 DependencyGroup group, 11642 DependencyGroup group,
11643 Handle<Object> object) { 11643 Handle<Object> object) {
11644 GroupStartIndexes starts(*entries); 11644 GroupStartIndexes starts(*entries);
11645 int start = starts.at(group); 11645 int start = starts.at(group);
11646 int end = starts.at(group + 1); 11646 int end = starts.at(group + 1);
11647 int number_of_entries = starts.number_of_entries(); 11647 int number_of_entries = starts.number_of_entries();
11648 if (start < end && entries->object_at(end - 1) == *object) { 11648 // Check for existing entry to avoid duplicates.
11649 // Do not append the compilation info if it is already in the array. 11649 for (int i = start; i < end; i++) {
11650 // It is sufficient to just check only the last element because 11650 if (entries->object_at(i) == *object) return entries;
11651 // we process embedded maps of an optimized code in one batch.
11652 return entries;
11653 } 11651 }
11654 if (entries->length() < kCodesStartIndex + number_of_entries + 1) { 11652 if (entries->length() < kCodesStartIndex + number_of_entries + 1) {
11655 Factory* factory = entries->GetIsolate()->factory(); 11653 Factory* factory = entries->GetIsolate()->factory();
11656 int capacity = kCodesStartIndex + number_of_entries + 1; 11654 int capacity = kCodesStartIndex + number_of_entries + 1;
11657 if (capacity > 5) capacity = capacity * 5 / 4; 11655 if (capacity > 5) capacity = capacity * 5 / 4;
11658 Handle<DependentCode> new_entries = Handle<DependentCode>::cast( 11656 Handle<DependentCode> new_entries = Handle<DependentCode>::cast(
11659 factory->CopySizeFixedArray(entries, capacity, TENURED)); 11657 factory->CopySizeFixedArray(entries, capacity, TENURED));
11660 // The number of codes can change after GC. 11658 // The number of codes can change after GC.
11661 starts.Recompute(*entries); 11659 starts.Recompute(*entries);
11662 start = starts.at(group); 11660 start = starts.at(group);
(...skipping 4863 matching lines...) Expand 10 before | Expand all | Expand 10 after
16526 #define ERROR_MESSAGES_TEXTS(C, T) T, 16524 #define ERROR_MESSAGES_TEXTS(C, T) T,
16527 static const char* error_messages_[] = { 16525 static const char* error_messages_[] = {
16528 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16526 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16529 }; 16527 };
16530 #undef ERROR_MESSAGES_TEXTS 16528 #undef ERROR_MESSAGES_TEXTS
16531 return error_messages_[reason]; 16529 return error_messages_[reason];
16532 } 16530 }
16533 16531
16534 16532
16535 } } // namespace v8::internal 16533 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698