| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 14881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14892 } | 14892 } |
| 14893 | 14893 |
| 14894 | 14894 |
| 14895 Handle<CompilationCacheTable> CompilationCacheTable::Put( | 14895 Handle<CompilationCacheTable> CompilationCacheTable::Put( |
| 14896 Handle<CompilationCacheTable> cache, Handle<String> src, | 14896 Handle<CompilationCacheTable> cache, Handle<String> src, |
| 14897 Handle<Context> context, Handle<Object> value) { | 14897 Handle<Context> context, Handle<Object> value) { |
| 14898 Isolate* isolate = cache->GetIsolate(); | 14898 Isolate* isolate = cache->GetIsolate(); |
| 14899 Handle<SharedFunctionInfo> shared(context->closure()->shared()); | 14899 Handle<SharedFunctionInfo> shared(context->closure()->shared()); |
| 14900 StringSharedKey key(src, shared, FLAG_use_strict ? STRICT : SLOPPY, | 14900 StringSharedKey key(src, shared, FLAG_use_strict ? STRICT : SLOPPY, |
| 14901 RelocInfo::kNoPosition); | 14901 RelocInfo::kNoPosition); |
| 14902 int entry = cache->FindEntry(&key); | 14902 { |
| 14903 if (entry != kNotFound) { | |
| 14904 Handle<Object> k = key.AsHandle(isolate); | 14903 Handle<Object> k = key.AsHandle(isolate); |
| 14905 cache->set(EntryToIndex(entry), *k); | 14904 DisallowHeapAllocation no_allocation_scope; |
| 14906 cache->set(EntryToIndex(entry) + 1, *value); | 14905 int entry = cache->FindEntry(&key); |
| 14907 return cache; | 14906 if (entry != kNotFound) { |
| 14907 cache->set(EntryToIndex(entry), *k); |
| 14908 cache->set(EntryToIndex(entry) + 1, *value); |
| 14909 return cache; |
| 14910 } |
| 14908 } | 14911 } |
| 14909 | 14912 |
| 14910 cache = EnsureCapacity(cache, 1, &key); | 14913 cache = EnsureCapacity(cache, 1, &key); |
| 14911 entry = cache->FindInsertionEntry(key.Hash()); | 14914 int entry = cache->FindInsertionEntry(key.Hash()); |
| 14912 Handle<Object> k = | 14915 Handle<Object> k = |
| 14913 isolate->factory()->NewNumber(static_cast<double>(key.Hash())); | 14916 isolate->factory()->NewNumber(static_cast<double>(key.Hash())); |
| 14914 cache->set(EntryToIndex(entry), *k); | 14917 cache->set(EntryToIndex(entry), *k); |
| 14915 cache->set(EntryToIndex(entry) + 1, Smi::FromInt(kHashGenerations)); | 14918 cache->set(EntryToIndex(entry) + 1, Smi::FromInt(kHashGenerations)); |
| 14916 cache->ElementAdded(); | 14919 cache->ElementAdded(); |
| 14917 return cache; | 14920 return cache; |
| 14918 } | 14921 } |
| 14919 | 14922 |
| 14920 | 14923 |
| 14921 Handle<CompilationCacheTable> CompilationCacheTable::PutEval( | 14924 Handle<CompilationCacheTable> CompilationCacheTable::PutEval( |
| 14922 Handle<CompilationCacheTable> cache, Handle<String> src, | 14925 Handle<CompilationCacheTable> cache, Handle<String> src, |
| 14923 Handle<SharedFunctionInfo> outer_info, Handle<SharedFunctionInfo> value, | 14926 Handle<SharedFunctionInfo> outer_info, Handle<SharedFunctionInfo> value, |
| 14924 int scope_position) { | 14927 int scope_position) { |
| 14925 Isolate* isolate = cache->GetIsolate(); | 14928 Isolate* isolate = cache->GetIsolate(); |
| 14926 StringSharedKey key(src, outer_info, value->strict_mode(), scope_position); | 14929 StringSharedKey key(src, outer_info, value->strict_mode(), scope_position); |
| 14927 int entry = cache->FindEntry(&key); | 14930 { |
| 14928 if (entry != kNotFound) { | |
| 14929 Handle<Object> k = key.AsHandle(isolate); | 14931 Handle<Object> k = key.AsHandle(isolate); |
| 14930 cache->set(EntryToIndex(entry), *k); | 14932 DisallowHeapAllocation no_allocation_scope; |
| 14931 cache->set(EntryToIndex(entry) + 1, *value); | 14933 int entry = cache->FindEntry(&key); |
| 14932 return cache; | 14934 if (entry != kNotFound) { |
| 14935 cache->set(EntryToIndex(entry), *k); |
| 14936 cache->set(EntryToIndex(entry) + 1, *value); |
| 14937 return cache; |
| 14938 } |
| 14933 } | 14939 } |
| 14934 | 14940 |
| 14935 cache = EnsureCapacity(cache, 1, &key); | 14941 cache = EnsureCapacity(cache, 1, &key); |
| 14936 entry = cache->FindInsertionEntry(key.Hash()); | 14942 int entry = cache->FindInsertionEntry(key.Hash()); |
| 14937 Handle<Object> k = | 14943 Handle<Object> k = |
| 14938 isolate->factory()->NewNumber(static_cast<double>(key.Hash())); | 14944 isolate->factory()->NewNumber(static_cast<double>(key.Hash())); |
| 14939 cache->set(EntryToIndex(entry), *k); | 14945 cache->set(EntryToIndex(entry), *k); |
| 14940 cache->set(EntryToIndex(entry) + 1, Smi::FromInt(kHashGenerations)); | 14946 cache->set(EntryToIndex(entry) + 1, Smi::FromInt(kHashGenerations)); |
| 14941 cache->ElementAdded(); | 14947 cache->ElementAdded(); |
| 14942 return cache; | 14948 return cache; |
| 14943 } | 14949 } |
| 14944 | 14950 |
| 14945 | 14951 |
| 14946 Handle<CompilationCacheTable> CompilationCacheTable::PutRegExp( | 14952 Handle<CompilationCacheTable> CompilationCacheTable::PutRegExp( |
| (...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16567 Handle<DependentCode> codes = | 16573 Handle<DependentCode> codes = |
| 16568 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16574 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
| 16569 DependentCode::kPropertyCellChangedGroup, | 16575 DependentCode::kPropertyCellChangedGroup, |
| 16570 info->object_wrapper()); | 16576 info->object_wrapper()); |
| 16571 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16577 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
| 16572 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16578 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
| 16573 cell, info->zone()); | 16579 cell, info->zone()); |
| 16574 } | 16580 } |
| 16575 | 16581 |
| 16576 } } // namespace v8::internal | 16582 } } // namespace v8::internal |
| OLD | NEW |