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

Side by Side Diff: src/runtime.cc

Issue 2816006: [Isolates] KeyedLookupCache / DescriptorLookupCache / ContextSlotCache moved to Isolate. (Closed)
Patch Set: Created 10 years, 6 months 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
« no previous file with comments | « src/objects.cc ('k') | src/scopeinfo.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 3753 matching lines...) Expand 10 before | Expand all | Expand 10 after
3764 // for objects that require access checks. 3764 // for objects that require access checks.
3765 if (args[0]->IsJSObject() && 3765 if (args[0]->IsJSObject() &&
3766 !args[0]->IsJSGlobalProxy() && 3766 !args[0]->IsJSGlobalProxy() &&
3767 !args[0]->IsAccessCheckNeeded() && 3767 !args[0]->IsAccessCheckNeeded() &&
3768 args[1]->IsString()) { 3768 args[1]->IsString()) {
3769 JSObject* receiver = JSObject::cast(args[0]); 3769 JSObject* receiver = JSObject::cast(args[0]);
3770 String* key = String::cast(args[1]); 3770 String* key = String::cast(args[1]);
3771 if (receiver->HasFastProperties()) { 3771 if (receiver->HasFastProperties()) {
3772 // Attempt to use lookup cache. 3772 // Attempt to use lookup cache.
3773 Map* receiver_map = receiver->map(); 3773 Map* receiver_map = receiver->map();
3774 int offset = KeyedLookupCache::Lookup(receiver_map, key); 3774 KeyedLookupCache* keyed_lookup_cache = Isolate::Current()->
3775 keyed_lookup_cache();
3776 int offset = keyed_lookup_cache->Lookup(receiver_map, key);
3775 if (offset != -1) { 3777 if (offset != -1) {
3776 Object* value = receiver->FastPropertyAt(offset); 3778 Object* value = receiver->FastPropertyAt(offset);
3777 return value->IsTheHole() ? HEAP->undefined_value() : value; 3779 return value->IsTheHole() ? HEAP->undefined_value() : value;
3778 } 3780 }
3779 // Lookup cache miss. Perform lookup and update the cache if appropriate. 3781 // Lookup cache miss. Perform lookup and update the cache if appropriate.
3780 LookupResult result; 3782 LookupResult result;
3781 receiver->LocalLookup(key, &result); 3783 receiver->LocalLookup(key, &result);
3782 if (result.IsProperty() && result.type() == FIELD) { 3784 if (result.IsProperty() && result.type() == FIELD) {
3783 int offset = result.GetFieldIndex(); 3785 int offset = result.GetFieldIndex();
3784 KeyedLookupCache::Update(receiver_map, key, offset); 3786 keyed_lookup_cache->Update(receiver_map, key, offset);
3785 return receiver->FastPropertyAt(offset); 3787 return receiver->FastPropertyAt(offset);
3786 } 3788 }
3787 } else { 3789 } else {
3788 // Attempt dictionary lookup. 3790 // Attempt dictionary lookup.
3789 StringDictionary* dictionary = receiver->property_dictionary(); 3791 StringDictionary* dictionary = receiver->property_dictionary();
3790 int entry = dictionary->FindEntry(key); 3792 int entry = dictionary->FindEntry(key);
3791 if ((entry != StringDictionary::kNotFound) && 3793 if ((entry != StringDictionary::kNotFound) &&
3792 (dictionary->DetailsAt(entry).type() == NORMAL)) { 3794 (dictionary->DetailsAt(entry).type() == NORMAL)) {
3793 Object* value = dictionary->ValueAt(entry); 3795 Object* value = dictionary->ValueAt(entry);
3794 if (!receiver->IsGlobalObject()) return value; 3796 if (!receiver->IsGlobalObject()) return value;
(...skipping 6544 matching lines...) Expand 10 before | Expand all | Expand 10 after
10339 } else { 10341 } else {
10340 // Handle last resort GC and make sure to allow future allocations 10342 // Handle last resort GC and make sure to allow future allocations
10341 // to grow the heap without causing GCs (if possible). 10343 // to grow the heap without causing GCs (if possible).
10342 Counters::gc_last_resort_from_js.Increment(); 10344 Counters::gc_last_resort_from_js.Increment();
10343 HEAP->CollectAllGarbage(false); 10345 HEAP->CollectAllGarbage(false);
10344 } 10346 }
10345 } 10347 }
10346 10348
10347 10349
10348 } } // namespace v8::internal 10350 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/scopeinfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698