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

Side by Side Diff: src/objects.cc

Issue 678843004: Use shared function info for eval cache key. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | 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 // 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 14831 matching lines...) Expand 10 before | Expand all | Expand 10 after
14842 Isolate* isolate = GetIsolate(); 14842 Isolate* isolate = GetIsolate();
14843 Handle<SharedFunctionInfo> shared(context->closure()->shared()); 14843 Handle<SharedFunctionInfo> shared(context->closure()->shared());
14844 StringSharedKey key(src, shared, FLAG_use_strict ? STRICT : SLOPPY, 14844 StringSharedKey key(src, shared, FLAG_use_strict ? STRICT : SLOPPY,
14845 RelocInfo::kNoPosition); 14845 RelocInfo::kNoPosition);
14846 int entry = FindEntry(&key); 14846 int entry = FindEntry(&key);
14847 if (entry == kNotFound) return isolate->factory()->undefined_value(); 14847 if (entry == kNotFound) return isolate->factory()->undefined_value();
14848 return Handle<Object>(get(EntryToIndex(entry) + 1), isolate); 14848 return Handle<Object>(get(EntryToIndex(entry) + 1), isolate);
14849 } 14849 }
14850 14850
14851 14851
14852 Handle<Object> CompilationCacheTable::LookupEval(Handle<String> src, 14852 Handle<Object> CompilationCacheTable::LookupEval(
14853 Handle<Context> context, 14853 Handle<String> src, Handle<SharedFunctionInfo> outer_info,
14854 StrictMode strict_mode, 14854 StrictMode strict_mode, int scope_position) {
14855 int scope_position) {
14856 Isolate* isolate = GetIsolate(); 14855 Isolate* isolate = GetIsolate();
14857 Handle<SharedFunctionInfo> shared(context->closure()->shared()); 14856 // Cache key is the tuple (source, outer shared function info, scope position)
14858 StringSharedKey key(src, shared, strict_mode, scope_position); 14857 // to unambiguously identify the context chain the cached eval code assumes.
14858 StringSharedKey key(src, outer_info, strict_mode, scope_position);
14859 int entry = FindEntry(&key); 14859 int entry = FindEntry(&key);
14860 if (entry == kNotFound) return isolate->factory()->undefined_value(); 14860 if (entry == kNotFound) return isolate->factory()->undefined_value();
14861 return Handle<Object>(get(EntryToIndex(entry) + 1), isolate); 14861 return Handle<Object>(get(EntryToIndex(entry) + 1), isolate);
14862 } 14862 }
14863 14863
14864 14864
14865 Handle<Object> CompilationCacheTable::LookupRegExp(Handle<String> src, 14865 Handle<Object> CompilationCacheTable::LookupRegExp(Handle<String> src,
14866 JSRegExp::Flags flags) { 14866 JSRegExp::Flags flags) {
14867 Isolate* isolate = GetIsolate(); 14867 Isolate* isolate = GetIsolate();
14868 DisallowHeapAllocation no_allocation; 14868 DisallowHeapAllocation no_allocation;
(...skipping 16 matching lines...) Expand all
14885 int entry = cache->FindInsertionEntry(key.Hash()); 14885 int entry = cache->FindInsertionEntry(key.Hash());
14886 cache->set(EntryToIndex(entry), *k); 14886 cache->set(EntryToIndex(entry), *k);
14887 cache->set(EntryToIndex(entry) + 1, *value); 14887 cache->set(EntryToIndex(entry) + 1, *value);
14888 cache->ElementAdded(); 14888 cache->ElementAdded();
14889 return cache; 14889 return cache;
14890 } 14890 }
14891 14891
14892 14892
14893 Handle<CompilationCacheTable> CompilationCacheTable::PutEval( 14893 Handle<CompilationCacheTable> CompilationCacheTable::PutEval(
14894 Handle<CompilationCacheTable> cache, Handle<String> src, 14894 Handle<CompilationCacheTable> cache, Handle<String> src,
14895 Handle<Context> context, Handle<SharedFunctionInfo> value, 14895 Handle<SharedFunctionInfo> outer_info, Handle<SharedFunctionInfo> value,
14896 int scope_position) { 14896 int scope_position) {
14897 Isolate* isolate = cache->GetIsolate(); 14897 Isolate* isolate = cache->GetIsolate();
14898 Handle<SharedFunctionInfo> shared(context->closure()->shared()); 14898 StringSharedKey key(src, outer_info, value->strict_mode(), scope_position);
14899 StringSharedKey key(src, shared, value->strict_mode(), scope_position);
14900 cache = EnsureCapacity(cache, 1, &key); 14899 cache = EnsureCapacity(cache, 1, &key);
14901 Handle<Object> k = key.AsHandle(isolate); 14900 Handle<Object> k = key.AsHandle(isolate);
14902 int entry = cache->FindInsertionEntry(key.Hash()); 14901 int entry = cache->FindInsertionEntry(key.Hash());
14903 cache->set(EntryToIndex(entry), *k); 14902 cache->set(EntryToIndex(entry), *k);
14904 cache->set(EntryToIndex(entry) + 1, *value); 14903 cache->set(EntryToIndex(entry) + 1, *value);
14905 cache->ElementAdded(); 14904 cache->ElementAdded();
14906 return cache; 14905 return cache;
14907 } 14906 }
14908 14907
14909 14908
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
16500 Handle<DependentCode> codes = 16499 Handle<DependentCode> codes =
16501 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16500 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16502 DependentCode::kPropertyCellChangedGroup, 16501 DependentCode::kPropertyCellChangedGroup,
16503 info->object_wrapper()); 16502 info->object_wrapper());
16504 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16503 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16505 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16504 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16506 cell, info->zone()); 16505 cell, info->zone());
16507 } 16506 }
16508 16507
16509 } } // namespace v8::internal 16508 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698