OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1318 | 1318 |
1319 MaybeHandle<Object> Object::GetPropertyWithAccessor(LookupIterator* it) { | 1319 MaybeHandle<Object> Object::GetPropertyWithAccessor(LookupIterator* it) { |
1320 Isolate* isolate = it->isolate(); | 1320 Isolate* isolate = it->isolate(); |
1321 Handle<Object> structure = it->GetAccessors(); | 1321 Handle<Object> structure = it->GetAccessors(); |
1322 Handle<Object> receiver = it->GetReceiver(); | 1322 Handle<Object> receiver = it->GetReceiver(); |
1323 | 1323 |
1324 // We should never get here to initialize a const with the hole value since a | 1324 // We should never get here to initialize a const with the hole value since a |
1325 // const declaration would conflict with the getter. | 1325 // const declaration would conflict with the getter. |
1326 DCHECK(!structure->IsForeign()); | 1326 DCHECK(!structure->IsForeign()); |
1327 | 1327 |
1328 // Accessor with 'cached' private property. | |
1329 if (it->TryLookupCacheProperty()) { | |
1330 return Object::GetProperty(it); | |
Toon Verwaest
2016/10/21 08:22:14
Why not do GetProperty directly in TryLookupCached
vogelheim
2016/11/03 16:12:24
Hmm. That would seem to do the wrong thing for the
| |
1331 } | |
1332 | |
1328 // API style callbacks. | 1333 // API style callbacks. |
1329 if (structure->IsAccessorInfo()) { | 1334 if (structure->IsAccessorInfo()) { |
1330 Handle<JSObject> holder = it->GetHolder<JSObject>(); | 1335 Handle<JSObject> holder = it->GetHolder<JSObject>(); |
1331 Handle<Name> name = it->GetName(); | 1336 Handle<Name> name = it->GetName(); |
1332 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); | 1337 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure); |
1333 if (!info->IsCompatibleReceiver(*receiver)) { | 1338 if (!info->IsCompatibleReceiver(*receiver)) { |
1334 THROW_NEW_ERROR(isolate, | 1339 THROW_NEW_ERROR(isolate, |
1335 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, | 1340 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, |
1336 name, receiver), | 1341 name, receiver), |
1337 Object); | 1342 Object); |
(...skipping 18873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20211 for (const auto& name : names) { | 20216 for (const auto& name : names) { |
20212 JSObject::SetAccessor( | 20217 JSObject::SetAccessor( |
20213 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) | 20218 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) |
20214 .Check(); | 20219 .Check(); |
20215 } | 20220 } |
20216 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); | 20221 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); |
20217 | 20222 |
20218 return ns; | 20223 return ns; |
20219 } | 20224 } |
20220 | 20225 |
20226 MaybeHandle<Name> FunctionTemplateInfo::TryGetCachePropertyName( | |
20227 Isolate* isolate, Handle<Object> getter) { | |
20228 if (getter->IsFunctionTemplateInfo()) { | |
Toon Verwaest
2016/10/21 08:22:14
It should be easy to support JSFunctions backed by
vogelheim
2016/11/03 16:12:24
Do we have a use case for that?
(I'm generally fo
| |
20229 Handle<FunctionTemplateInfo> fti = | |
20230 Handle<FunctionTemplateInfo>::cast(getter); | |
20231 // Check if the accessor is backed by a private property (cached accessor). | |
20232 if (!fti->cache_property()->IsTheHole(isolate)) { | |
20233 Handle<Name> name = handle(Name::cast(fti->cache_property())); | |
20234 return MaybeHandle<Name>(name); | |
20235 } | |
20236 } | |
20237 return MaybeHandle<Name>(); | |
20238 } | |
20239 | |
20221 } // namespace internal | 20240 } // namespace internal |
20222 } // namespace v8 | 20241 } // namespace v8 |
OLD | NEW |