Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: src/objects.cc

Issue 2405213002: V8 support for cached accessors. (Closed)
Patch Set: Toon's feedback. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 Handle<Object> reboxed_result = handle(*result, isolate); 1355 Handle<Object> reboxed_result = handle(*result, isolate);
1356 if (info->replace_on_access() && receiver->IsJSReceiver()) { 1356 if (info->replace_on_access() && receiver->IsJSReceiver()) {
1357 args.Call(reinterpret_cast<GenericNamedPropertySetterCallback>( 1357 args.Call(reinterpret_cast<GenericNamedPropertySetterCallback>(
1358 &Accessors::ReconfigureToDataProperty), 1358 &Accessors::ReconfigureToDataProperty),
1359 name, result); 1359 name, result);
1360 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 1360 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
1361 } 1361 }
1362 return reboxed_result; 1362 return reboxed_result;
1363 } 1363 }
1364 1364
1365 // AccessorPair with 'cached' private property.
1366 if (it->TryLookupCachedProperty()) {
1367 return Object::GetProperty(it);
1368 }
1369
1365 // Regular accessor. 1370 // Regular accessor.
1366 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); 1371 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
1367 if (getter->IsFunctionTemplateInfo()) { 1372 if (getter->IsFunctionTemplateInfo()) {
1368 return Builtins::InvokeApiFunction( 1373 return Builtins::InvokeApiFunction(
1369 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0, 1374 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0,
1370 nullptr, isolate->factory()->undefined_value()); 1375 nullptr, isolate->factory()->undefined_value());
1371 } else if (getter->IsCallable()) { 1376 } else if (getter->IsCallable()) {
1372 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1377 // TODO(rossberg): nicer would be to cast to some JSCallable here...
1373 return Object::GetPropertyWithDefinedGetter( 1378 return Object::GetPropertyWithDefinedGetter(
1374 receiver, Handle<JSReceiver>::cast(getter)); 1379 receiver, Handle<JSReceiver>::cast(getter));
(...skipping 18887 matching lines...) Expand 10 before | Expand all | Expand 10 after
20262 for (const auto& name : names) { 20267 for (const auto& name : names) {
20263 JSObject::SetAccessor( 20268 JSObject::SetAccessor(
20264 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) 20269 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr))
20265 .Check(); 20270 .Check();
20266 } 20271 }
20267 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); 20272 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked();
20268 20273
20269 return ns; 20274 return ns;
20270 } 20275 }
20271 20276
20277 MaybeHandle<Name> FunctionTemplateInfo::TryGetCachedPropertyName(
20278 Isolate* isolate, Handle<Object> getter) {
20279 if (getter->IsFunctionTemplateInfo()) {
20280 Handle<FunctionTemplateInfo> fti =
20281 Handle<FunctionTemplateInfo>::cast(getter);
20282 // Check if the accessor uses a cached property.
20283 if (!fti->cached_property_name()->IsTheHole(isolate)) {
20284 return handle(Name::cast(fti->cached_property_name()));
20285 }
20286 }
20287 return MaybeHandle<Name>();
20288 }
20289
20272 } // namespace internal 20290 } // namespace internal
20273 } // namespace v8 20291 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698