OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 4852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4863 Handle<Map> receiver_map(receiver->map(), isolate); | 4863 Handle<Map> receiver_map(receiver->map(), isolate); |
4864 KeyedLookupCache* keyed_lookup_cache = isolate->keyed_lookup_cache(); | 4864 KeyedLookupCache* keyed_lookup_cache = isolate->keyed_lookup_cache(); |
4865 int index = keyed_lookup_cache->Lookup(receiver_map, key); | 4865 int index = keyed_lookup_cache->Lookup(receiver_map, key); |
4866 if (index != -1) { | 4866 if (index != -1) { |
4867 // Doubles are not cached, so raw read the value. | 4867 // Doubles are not cached, so raw read the value. |
4868 return receiver->RawFastPropertyAt( | 4868 return receiver->RawFastPropertyAt( |
4869 FieldIndex::ForKeyedLookupCacheIndex(*receiver_map, index)); | 4869 FieldIndex::ForKeyedLookupCacheIndex(*receiver_map, index)); |
4870 } | 4870 } |
4871 // Lookup cache miss. Perform lookup and update the cache if | 4871 // Lookup cache miss. Perform lookup and update the cache if |
4872 // appropriate. | 4872 // appropriate. |
4873 LookupResult result(isolate); | 4873 LookupIterator it(receiver, key, LookupIterator::CHECK_OWN); |
4874 receiver->LookupOwn(key, &result); | 4874 if (it.IsFound() && it.state() == LookupIterator::PROPERTY && |
4875 if (result.IsField()) { | 4875 it.HasProperty() && it.property_details().type() == FIELD) { |
4876 FieldIndex field_index = result.GetFieldIndex(); | 4876 FieldIndex field_index = it.GetFieldIndex(); |
4877 // Do not track double fields in the keyed lookup cache. Reading | 4877 // Do not track double fields in the keyed lookup cache. Reading |
4878 // double values requires boxing. | 4878 // double values requires boxing. |
4879 if (!result.representation().IsDouble()) { | 4879 if (!it.representation().IsDouble()) { |
4880 keyed_lookup_cache->Update(receiver_map, key, | 4880 keyed_lookup_cache->Update(receiver_map, key, |
4881 field_index.GetKeyedLookupCacheIndex()); | 4881 field_index.GetKeyedLookupCacheIndex()); |
4882 } | 4882 } |
4883 AllowHeapAllocation allow_allocation; | 4883 AllowHeapAllocation allow_allocation; |
4884 return *JSObject::FastPropertyAt(receiver, result.representation(), | 4884 return *JSObject::FastPropertyAt(receiver, it.representation(), |
4885 field_index); | 4885 field_index); |
4886 } | 4886 } |
4887 } else { | 4887 } else { |
4888 // Attempt dictionary lookup. | 4888 // Attempt dictionary lookup. |
4889 NameDictionary* dictionary = receiver->property_dictionary(); | 4889 NameDictionary* dictionary = receiver->property_dictionary(); |
4890 int entry = dictionary->FindEntry(key); | 4890 int entry = dictionary->FindEntry(key); |
4891 if ((entry != NameDictionary::kNotFound) && | 4891 if ((entry != NameDictionary::kNotFound) && |
4892 (dictionary->DetailsAt(entry).type() == NORMAL)) { | 4892 (dictionary->DetailsAt(entry).type() == NORMAL)) { |
4893 Object* value = dictionary->ValueAt(entry); | 4893 Object* value = dictionary->ValueAt(entry); |
4894 if (!receiver->IsGlobalObject()) return value; | 4894 if (!receiver->IsGlobalObject()) return value; |
(...skipping 10731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15626 } | 15626 } |
15627 return NULL; | 15627 return NULL; |
15628 } | 15628 } |
15629 | 15629 |
15630 | 15630 |
15631 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15631 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15632 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15632 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15633 } | 15633 } |
15634 | 15634 |
15635 } } // namespace v8::internal | 15635 } } // namespace v8::internal |
OLD | NEW |