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

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

Issue 1165603002: Starting using GlobalDictionary for global objects instead of NameDictionary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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-printer.cc ('k') | no next file » | 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/messages.h" 10 #include "src/messages.h"
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // prototype including own lookups. 591 // prototype including own lookups.
592 // 592 //
593 // Additionally, we need to make sure that we do not cache results 593 // Additionally, we need to make sure that we do not cache results
594 // for objects that require access checks. 594 // for objects that require access checks.
595 if (receiver_obj->IsJSObject()) { 595 if (receiver_obj->IsJSObject()) {
596 if (!receiver_obj->IsJSGlobalProxy() && 596 if (!receiver_obj->IsJSGlobalProxy() &&
597 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) { 597 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) {
598 DisallowHeapAllocation no_allocation; 598 DisallowHeapAllocation no_allocation;
599 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); 599 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj);
600 Handle<Name> key = Handle<Name>::cast(key_obj); 600 Handle<Name> key = Handle<Name>::cast(key_obj);
601 if (!receiver->HasFastProperties()) { 601 if (receiver->IsGlobalObject()) {
602 // Attempt dictionary lookup.
603 GlobalDictionary* dictionary = receiver->global_dictionary();
604 int entry = dictionary->FindEntry(key);
605 if ((entry != GlobalDictionary::kNotFound) &&
606 (dictionary->DetailsAt(entry).type() == DATA)) {
607 Object* value = dictionary->ValueAt(entry);
608 DCHECK(value->IsPropertyCell());
609 value = PropertyCell::cast(value)->value();
610 if (!value->IsTheHole()) return value;
611 // If value is the hole (meaning, absent) do the general lookup.
612 }
613 } else if (!receiver->HasFastProperties()) {
602 // Attempt dictionary lookup. 614 // Attempt dictionary lookup.
603 NameDictionary* dictionary = receiver->property_dictionary(); 615 NameDictionary* dictionary = receiver->property_dictionary();
604 int entry = dictionary->FindEntry(key); 616 int entry = dictionary->FindEntry(key);
605 if ((entry != NameDictionary::kNotFound) && 617 if ((entry != NameDictionary::kNotFound) &&
606 (dictionary->DetailsAt(entry).type() == DATA)) { 618 (dictionary->DetailsAt(entry).type() == DATA)) {
607 Object* value = dictionary->ValueAt(entry); 619 Object* value = dictionary->ValueAt(entry);
608 if (!receiver->IsGlobalObject()) return value; 620 return value;
609 DCHECK(value->IsPropertyCell());
610 value = PropertyCell::cast(value)->value();
611 if (!value->IsTheHole()) return value;
612 // If value is the hole (meaning, absent) do the general lookup.
613 } 621 }
614 } 622 }
615 } else if (key_obj->IsSmi()) { 623 } else if (key_obj->IsSmi()) {
616 // JSObject without a name key. If the key is a Smi, check for a 624 // JSObject without a name key. If the key is a Smi, check for a
617 // definite out-of-bounds access to elements, which is a strong indicator 625 // definite out-of-bounds access to elements, which is a strong indicator
618 // that subsequent accesses will also call the runtime. Proactively 626 // that subsequent accesses will also call the runtime. Proactively
619 // transition elements to FAST_*_ELEMENTS to avoid excessive boxing of 627 // transition elements to FAST_*_ELEMENTS to avoid excessive boxing of
620 // doubles for those future calls in the case that the elements would 628 // doubles for those future calls in the case that the elements would
621 // become FAST_DOUBLE_ELEMENTS. 629 // become FAST_DOUBLE_ELEMENTS.
622 Handle<JSObject> js_object = Handle<JSObject>::cast(receiver_obj); 630 Handle<JSObject> js_object = Handle<JSObject>::cast(receiver_obj);
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); 1586 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1579 1587
1580 RETURN_FAILURE_ON_EXCEPTION( 1588 RETURN_FAILURE_ON_EXCEPTION(
1581 isolate, 1589 isolate,
1582 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), 1590 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
1583 setter, attrs)); 1591 setter, attrs));
1584 return isolate->heap()->undefined_value(); 1592 return isolate->heap()->undefined_value();
1585 } 1593 }
1586 } // namespace internal 1594 } // namespace internal
1587 } // namespace v8 1595 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698