| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // prototype including own lookups. | 49 // prototype including own lookups. |
| 50 // | 50 // |
| 51 // Additionally, we need to make sure that we do not cache results | 51 // Additionally, we need to make sure that we do not cache results |
| 52 // for objects that require access checks. | 52 // for objects that require access checks. |
| 53 if (receiver_obj->IsJSObject()) { | 53 if (receiver_obj->IsJSObject()) { |
| 54 if (!receiver_obj->IsJSGlobalProxy() && | 54 if (!receiver_obj->IsJSGlobalProxy() && |
| 55 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) { | 55 !receiver_obj->IsAccessCheckNeeded() && key_obj->IsName()) { |
| 56 DisallowHeapAllocation no_allocation; | 56 DisallowHeapAllocation no_allocation; |
| 57 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); | 57 Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj); |
| 58 Handle<Name> key = Handle<Name>::cast(key_obj); | 58 Handle<Name> key = Handle<Name>::cast(key_obj); |
| 59 // Get to a ThinString's referenced internalized string, but don't |
| 60 // otherwise force internalization. We assume that internalization |
| 61 // (which is a dictionary lookup with a non-internalized key) is |
| 62 // about as expensive as doing the property dictionary lookup with |
| 63 // the non-internalized key directly. |
| 64 if (key->IsThinString()) { |
| 65 key = handle(Handle<ThinString>::cast(key)->actual(), isolate); |
| 66 } |
| 59 if (receiver->IsJSGlobalObject()) { | 67 if (receiver->IsJSGlobalObject()) { |
| 60 // Attempt dictionary lookup. | 68 // Attempt dictionary lookup. |
| 61 GlobalDictionary* dictionary = receiver->global_dictionary(); | 69 GlobalDictionary* dictionary = receiver->global_dictionary(); |
| 62 int entry = dictionary->FindEntry(key); | 70 int entry = dictionary->FindEntry(key); |
| 63 if (entry != GlobalDictionary::kNotFound) { | 71 if (entry != GlobalDictionary::kNotFound) { |
| 64 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); | 72 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); |
| 65 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); | 73 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); |
| 66 if (cell->property_details().kind() == kData) { | 74 if (cell->property_details().kind() == kData) { |
| 67 Object* value = cell->value(); | 75 Object* value = cell->value(); |
| 68 if (!value->IsTheHole(isolate)) { | 76 if (!value->IsTheHole(isolate)) { |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 if (!success) return isolate->heap()->exception(); | 972 if (!success) return isolate->heap()->exception(); |
| 965 MAYBE_RETURN( | 973 MAYBE_RETURN( |
| 966 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 974 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
| 967 isolate->heap()->exception()); | 975 isolate->heap()->exception()); |
| 968 return *value; | 976 return *value; |
| 969 } | 977 } |
| 970 | 978 |
| 971 | 979 |
| 972 } // namespace internal | 980 } // namespace internal |
| 973 } // namespace v8 | 981 } // namespace v8 |
| OLD | NEW |