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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 878263002: Add MEGAMORPHIC state support for KeyedLoadIC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/ic/x64/ic-x64.cc ('k') | test/cctest/test-heap-profiler.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/runtime/runtime.h" 10 #include "src/runtime/runtime.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // prototype including own lookups. 594 // prototype including own lookups.
595 // 595 //
596 // Additionally, we need to make sure that we do not cache results 596 // Additionally, we need to make sure that we do not cache results
597 // for objects that require access checks. 597 // for objects that require access checks.
598 if (receiver_obj->IsJSObject()) { 598 if (receiver_obj->IsJSObject()) {
599 if (!receiver_obj->IsJSGlobalProxy() && 599 if (!receiver_obj->IsJSGlobalProxy() &&
600 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) { 600 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) {
601 DisallowHeapAllocation no_allocation; 601 DisallowHeapAllocation no_allocation;
602 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); 602 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj);
603 Handle<Name> key = Handle<Name>::cast(key_obj); 603 Handle<Name> key = Handle<Name>::cast(key_obj);
604 if (receiver->HasFastProperties()) { 604 if (!receiver->HasFastProperties()) {
605 // Attempt to use lookup cache.
606 Handle<Map> receiver_map(receiver->map(), isolate);
607 KeyedLookupCache* keyed_lookup_cache = isolate->keyed_lookup_cache();
608 int index = keyed_lookup_cache->Lookup(receiver_map, key);
609 if (index != -1) {
610 // Doubles are not cached, so raw read the value.
611 return receiver->RawFastPropertyAt(
612 FieldIndex::ForKeyedLookupCacheIndex(*receiver_map, index));
613 }
614 // Lookup cache miss. Perform lookup and update the cache if
615 // appropriate.
616 LookupIterator it(receiver, key, LookupIterator::OWN);
617 if (it.state() == LookupIterator::DATA &&
618 it.property_details().type() == DATA) {
619 FieldIndex field_index = it.GetFieldIndex();
620 // Do not track double fields in the keyed lookup cache. Reading
621 // double values requires boxing.
622 if (!it.representation().IsDouble()) {
623 keyed_lookup_cache->Update(receiver_map, key,
624 field_index.GetKeyedLookupCacheIndex());
625 }
626 AllowHeapAllocation allow_allocation;
627 return *JSObject::FastPropertyAt(receiver, it.representation(),
628 field_index);
629 }
630 } else {
631 // Attempt dictionary lookup. 605 // Attempt dictionary lookup.
632 NameDictionary* dictionary = receiver->property_dictionary(); 606 NameDictionary* dictionary = receiver->property_dictionary();
633 int entry = dictionary->FindEntry(key); 607 int entry = dictionary->FindEntry(key);
634 if ((entry != NameDictionary::kNotFound) && 608 if ((entry != NameDictionary::kNotFound) &&
635 (dictionary->DetailsAt(entry).type() == DATA)) { 609 (dictionary->DetailsAt(entry).type() == DATA)) {
636 Object* value = dictionary->ValueAt(entry); 610 Object* value = dictionary->ValueAt(entry);
637 if (!receiver->IsGlobalObject()) return value; 611 if (!receiver->IsGlobalObject()) return value;
638 value = PropertyCell::cast(value)->value(); 612 value = PropertyCell::cast(value)->value();
639 if (!value->IsTheHole()) return value; 613 if (!value->IsTheHole()) return value;
640 // If value is the hole (meaning, absent) do the general lookup. 614 // If value is the hole (meaning, absent) do the general lookup.
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); 1610 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2);
1637 1611
1638 RETURN_FAILURE_ON_EXCEPTION( 1612 RETURN_FAILURE_ON_EXCEPTION(
1639 isolate, 1613 isolate,
1640 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), 1614 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
1641 setter, NONE)); 1615 setter, NONE));
1642 return isolate->heap()->undefined_value(); 1616 return isolate->heap()->undefined_value();
1643 } 1617 }
1644 } 1618 }
1645 } // namespace v8::internal 1619 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic/x64/ic-x64.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698