| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.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/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (key->IsThinString()) { | 64 if (key->IsThinString()) { |
| 65 key = handle(Handle<ThinString>::cast(key)->actual(), isolate); | 65 key = handle(Handle<ThinString>::cast(key)->actual(), isolate); |
| 66 } | 66 } |
| 67 if (receiver->IsJSGlobalObject()) { | 67 if (receiver->IsJSGlobalObject()) { |
| 68 // Attempt dictionary lookup. | 68 // Attempt dictionary lookup. |
| 69 GlobalDictionary* dictionary = receiver->global_dictionary(); | 69 GlobalDictionary* dictionary = receiver->global_dictionary(); |
| 70 int entry = dictionary->FindEntry(key); | 70 int entry = dictionary->FindEntry(key); |
| 71 if (entry != GlobalDictionary::kNotFound) { | 71 if (entry != GlobalDictionary::kNotFound) { |
| 72 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); | 72 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); |
| 73 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); | 73 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); |
| 74 if (cell->property_details().type() == DATA) { | 74 if (cell->property_details().kind() == kData) { |
| 75 Object* value = cell->value(); | 75 Object* value = cell->value(); |
| 76 if (!value->IsTheHole(isolate)) { | 76 if (!value->IsTheHole(isolate)) { |
| 77 return Handle<Object>(value, isolate); | 77 return Handle<Object>(value, isolate); |
| 78 } | 78 } |
| 79 // If value is the hole (meaning, absent) do the general lookup. | 79 // If value is the hole (meaning, absent) do the general lookup. |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 } else if (!receiver->HasFastProperties()) { | 82 } else if (!receiver->HasFastProperties()) { |
| 83 // Attempt dictionary lookup. | 83 // Attempt dictionary lookup. |
| 84 NameDictionary* dictionary = receiver->property_dictionary(); | 84 NameDictionary* dictionary = receiver->property_dictionary(); |
| 85 int entry = dictionary->FindEntry(key); | 85 int entry = dictionary->FindEntry(key); |
| 86 if ((entry != NameDictionary::kNotFound) && | 86 if ((entry != NameDictionary::kNotFound) && |
| 87 (dictionary->DetailsAt(entry).type() == DATA)) { | 87 (dictionary->DetailsAt(entry).kind() == kData)) { |
| 88 Object* value = dictionary->ValueAt(entry); | 88 Object* value = dictionary->ValueAt(entry); |
| 89 return Handle<Object>(value, isolate); | 89 return Handle<Object>(value, isolate); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } else if (key_obj->IsSmi()) { | 92 } else if (key_obj->IsSmi()) { |
| 93 // JSObject without a name key. If the key is a Smi, check for a | 93 // JSObject without a name key. If the key is a Smi, check for a |
| 94 // definite out-of-bounds access to elements, which is a strong indicator | 94 // definite out-of-bounds access to elements, which is a strong indicator |
| 95 // that subsequent accesses will also call the runtime. Proactively | 95 // that subsequent accesses will also call the runtime. Proactively |
| 96 // transition elements to FAST_*_ELEMENTS to avoid excessive boxing of | 96 // transition elements to FAST_*_ELEMENTS to avoid excessive boxing of |
| 97 // doubles for those future calls in the case that the elements would | 97 // doubles for those future calls in the case that the elements would |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 if (!success) return isolate->heap()->exception(); | 971 if (!success) return isolate->heap()->exception(); |
| 972 MAYBE_RETURN( | 972 MAYBE_RETURN( |
| 973 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 973 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
| 974 isolate->heap()->exception()); | 974 isolate->heap()->exception()); |
| 975 return *value; | 975 return *value; |
| 976 } | 976 } |
| 977 | 977 |
| 978 | 978 |
| 979 } // namespace internal | 979 } // namespace internal |
| 980 } // namespace v8 | 980 } // namespace v8 |
| OLD | NEW |