| 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 9550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9561 FixedArray* literals) { | 9561 FixedArray* literals) { |
| 9562 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); | 9562 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); |
| 9563 ASSERT(native_context->IsNativeContext()); | 9563 ASSERT(native_context->IsNativeContext()); |
| 9564 STATIC_ASSERT(kEntryLength == 3); | 9564 STATIC_ASSERT(kEntryLength == 3); |
| 9565 Heap* heap = GetHeap(); | 9565 Heap* heap = GetHeap(); |
| 9566 FixedArray* new_code_map; | 9566 FixedArray* new_code_map; |
| 9567 Object* value = optimized_code_map(); | 9567 Object* value = optimized_code_map(); |
| 9568 if (value->IsSmi()) { | 9568 if (value->IsSmi()) { |
| 9569 // No optimized code map. | 9569 // No optimized code map. |
| 9570 ASSERT_EQ(0, Smi::cast(value)->value()); | 9570 ASSERT_EQ(0, Smi::cast(value)->value()); |
| 9571 // Crate 3 entries per context {context, code, literals}. | 9571 // Create 3 entries per context {context, code, literals}. |
| 9572 MaybeObject* maybe = heap->AllocateFixedArray(kInitialLength); | 9572 MaybeObject* maybe = heap->AllocateFixedArray(kInitialLength); |
| 9573 if (!maybe->To(&new_code_map)) return maybe; | 9573 if (!maybe->To(&new_code_map)) return maybe; |
| 9574 new_code_map->set(kEntriesStart + 0, native_context); | 9574 new_code_map->set(kEntriesStart + 0, native_context); |
| 9575 new_code_map->set(kEntriesStart + 1, code); | 9575 new_code_map->set(kEntriesStart + 1, code); |
| 9576 new_code_map->set(kEntriesStart + 2, literals); | 9576 new_code_map->set(kEntriesStart + 2, literals); |
| 9577 } else { | 9577 } else { |
| 9578 // Copy old map and append one new entry. | 9578 // Copy old map and append one new entry. |
| 9579 FixedArray* old_code_map = FixedArray::cast(value); | 9579 FixedArray* old_code_map = FixedArray::cast(value); |
| 9580 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context)); | 9580 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context)); |
| 9581 int old_length = old_code_map->length(); | 9581 int old_length = old_code_map->length(); |
| (...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11557 } | 11557 } |
| 11558 | 11558 |
| 11559 | 11559 |
| 11560 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, | 11560 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, |
| 11561 DependencyGroup group, | 11561 DependencyGroup group, |
| 11562 Handle<Object> object) { | 11562 Handle<Object> object) { |
| 11563 GroupStartIndexes starts(*entries); | 11563 GroupStartIndexes starts(*entries); |
| 11564 int start = starts.at(group); | 11564 int start = starts.at(group); |
| 11565 int end = starts.at(group + 1); | 11565 int end = starts.at(group + 1); |
| 11566 int number_of_entries = starts.number_of_entries(); | 11566 int number_of_entries = starts.number_of_entries(); |
| 11567 if (start < end && entries->object_at(end - 1) == *object) { | 11567 // Check for existing entry to avoid duplicates. |
| 11568 // Do not append the compilation info if it is already in the array. | 11568 for (int i = start; i < end; i++) { |
| 11569 // It is sufficient to just check only the last element because | 11569 if (entries->object_at(i) == *object) return entries; |
| 11570 // we process embedded maps of an optimized code in one batch. | |
| 11571 return entries; | |
| 11572 } | 11570 } |
| 11573 if (entries->length() < kCodesStartIndex + number_of_entries + 1) { | 11571 if (entries->length() < kCodesStartIndex + number_of_entries + 1) { |
| 11574 Factory* factory = entries->GetIsolate()->factory(); | 11572 Factory* factory = entries->GetIsolate()->factory(); |
| 11575 int capacity = kCodesStartIndex + number_of_entries + 1; | 11573 int capacity = kCodesStartIndex + number_of_entries + 1; |
| 11576 if (capacity > 5) capacity = capacity * 5 / 4; | 11574 if (capacity > 5) capacity = capacity * 5 / 4; |
| 11577 Handle<DependentCode> new_entries = Handle<DependentCode>::cast( | 11575 Handle<DependentCode> new_entries = Handle<DependentCode>::cast( |
| 11578 factory->CopySizeFixedArray(entries, capacity, TENURED)); | 11576 factory->CopySizeFixedArray(entries, capacity, TENURED)); |
| 11579 // The number of codes can change after GC. | 11577 // The number of codes can change after GC. |
| 11580 starts.Recompute(*entries); | 11578 starts.Recompute(*entries); |
| 11581 start = starts.at(group); | 11579 start = starts.at(group); |
| (...skipping 4814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16396 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16394 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16397 static const char* error_messages_[] = { | 16395 static const char* error_messages_[] = { |
| 16398 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16396 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16399 }; | 16397 }; |
| 16400 #undef ERROR_MESSAGES_TEXTS | 16398 #undef ERROR_MESSAGES_TEXTS |
| 16401 return error_messages_[reason]; | 16399 return error_messages_[reason]; |
| 16402 } | 16400 } |
| 16403 | 16401 |
| 16404 | 16402 |
| 16405 } } // namespace v8::internal | 16403 } } // namespace v8::internal |
| OLD | NEW |