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 } | |
67 if (receiver->IsJSGlobalObject()) { | 59 if (receiver->IsJSGlobalObject()) { |
68 // Attempt dictionary lookup. | 60 // Attempt dictionary lookup. |
69 GlobalDictionary* dictionary = receiver->global_dictionary(); | 61 GlobalDictionary* dictionary = receiver->global_dictionary(); |
70 int entry = dictionary->FindEntry(key); | 62 int entry = dictionary->FindEntry(key); |
71 if (entry != GlobalDictionary::kNotFound) { | 63 if (entry != GlobalDictionary::kNotFound) { |
72 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); | 64 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); |
73 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); | 65 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); |
74 if (cell->property_details().type() == DATA) { | 66 if (cell->property_details().type() == DATA) { |
75 Object* value = cell->value(); | 67 Object* value = cell->value(); |
76 if (!value->IsTheHole(isolate)) { | 68 if (!value->IsTheHole(isolate)) { |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 if (!success) return isolate->heap()->exception(); | 963 if (!success) return isolate->heap()->exception(); |
972 MAYBE_RETURN( | 964 MAYBE_RETURN( |
973 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 965 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
974 isolate->heap()->exception()); | 966 isolate->heap()->exception()); |
975 return *value; | 967 return *value; |
976 } | 968 } |
977 | 969 |
978 | 970 |
979 } // namespace internal | 971 } // namespace internal |
980 } // namespace v8 | 972 } // namespace v8 |
OLD | NEW |