OLD | NEW |
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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 int index = keyed_lookup_cache->Lookup(receiver_map, key); | 608 int index = keyed_lookup_cache->Lookup(receiver_map, key); |
609 if (index != -1) { | 609 if (index != -1) { |
610 // Doubles are not cached, so raw read the value. | 610 // Doubles are not cached, so raw read the value. |
611 return receiver->RawFastPropertyAt( | 611 return receiver->RawFastPropertyAt( |
612 FieldIndex::ForKeyedLookupCacheIndex(*receiver_map, index)); | 612 FieldIndex::ForKeyedLookupCacheIndex(*receiver_map, index)); |
613 } | 613 } |
614 // Lookup cache miss. Perform lookup and update the cache if | 614 // Lookup cache miss. Perform lookup and update the cache if |
615 // appropriate. | 615 // appropriate. |
616 LookupIterator it(receiver, key, LookupIterator::OWN); | 616 LookupIterator it(receiver, key, LookupIterator::OWN); |
617 if (it.state() == LookupIterator::DATA && | 617 if (it.state() == LookupIterator::DATA && |
618 it.property_details().type() == FIELD) { | 618 it.property_details().type() == DATA) { |
619 FieldIndex field_index = it.GetFieldIndex(); | 619 FieldIndex field_index = it.GetFieldIndex(); |
620 // Do not track double fields in the keyed lookup cache. Reading | 620 // Do not track double fields in the keyed lookup cache. Reading |
621 // double values requires boxing. | 621 // double values requires boxing. |
622 if (!it.representation().IsDouble()) { | 622 if (!it.representation().IsDouble()) { |
623 keyed_lookup_cache->Update(receiver_map, key, | 623 keyed_lookup_cache->Update(receiver_map, key, |
624 field_index.GetKeyedLookupCacheIndex()); | 624 field_index.GetKeyedLookupCacheIndex()); |
625 } | 625 } |
626 AllowHeapAllocation allow_allocation; | 626 AllowHeapAllocation allow_allocation; |
627 return *JSObject::FastPropertyAt(receiver, it.representation(), | 627 return *JSObject::FastPropertyAt(receiver, it.representation(), |
628 field_index); | 628 field_index); |
629 } | 629 } |
630 } else { | 630 } else { |
631 // Attempt dictionary lookup. | 631 // Attempt dictionary lookup. |
632 NameDictionary* dictionary = receiver->property_dictionary(); | 632 NameDictionary* dictionary = receiver->property_dictionary(); |
633 int entry = dictionary->FindEntry(key); | 633 int entry = dictionary->FindEntry(key); |
634 if ((entry != NameDictionary::kNotFound) && | 634 if ((entry != NameDictionary::kNotFound) && |
635 (dictionary->DetailsAt(entry).type() == FIELD)) { | 635 (dictionary->DetailsAt(entry).type() == DATA)) { |
636 Object* value = dictionary->ValueAt(entry); | 636 Object* value = dictionary->ValueAt(entry); |
637 if (!receiver->IsGlobalObject()) return value; | 637 if (!receiver->IsGlobalObject()) return value; |
638 value = PropertyCell::cast(value)->value(); | 638 value = PropertyCell::cast(value)->value(); |
639 if (!value->IsTheHole()) return value; | 639 if (!value->IsTheHole()) return value; |
640 // If value is the hole (meaning, absent) do the general lookup. | 640 // If value is the hole (meaning, absent) do the general lookup. |
641 } | 641 } |
642 } | 642 } |
643 } else if (key_obj->IsSmi()) { | 643 } else if (key_obj->IsSmi()) { |
644 // JSObject without a name key. If the key is a Smi, check for a | 644 // JSObject without a name key. If the key is a Smi, check for a |
645 // definite out-of-bounds access to elements, which is a strong indicator | 645 // definite out-of-bounds access to elements, which is a strong indicator |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 | 1601 |
1602 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { | 1602 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { |
1603 SealHandleScope shs(isolate); | 1603 SealHandleScope shs(isolate); |
1604 DCHECK(args.length() == 1); | 1604 DCHECK(args.length() == 1); |
1605 CONVERT_ARG_CHECKED(Object, obj, 0); | 1605 CONVERT_ARG_CHECKED(Object, obj, 0); |
1606 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); | 1606 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); |
1607 return JSReceiver::cast(obj)->class_name(); | 1607 return JSReceiver::cast(obj)->class_name(); |
1608 } | 1608 } |
1609 } | 1609 } |
1610 } // namespace v8::internal | 1610 } // namespace v8::internal |
OLD | NEW |