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

Side by Side Diff: src/objects.cc

Issue 2369933005: Speedup global_proxy.* attributes/accessors (specialize GlobalProxy access). (Closed)
Patch Set: Merge cached accessors + global proxy specialization Created 4 years, 2 months 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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 1349
1350 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder, 1350 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder,
1351 Object::DONT_THROW); 1351 Object::DONT_THROW);
1352 Handle<Object> result = args.Call(call_fun, name); 1352 Handle<Object> result = args.Call(call_fun, name);
1353 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 1353 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
1354 if (result.is_null()) return isolate->factory()->undefined_value(); 1354 if (result.is_null()) return isolate->factory()->undefined_value();
1355 // Rebox handle before return. 1355 // Rebox handle before return.
1356 return handle(*result, isolate); 1356 return handle(*result, isolate);
1357 } 1357 }
1358 1358
1359 // Regular accessor.
1360 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); 1359 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
1361 if (getter->IsFunctionTemplateInfo()) { 1360 if (getter->IsFunctionTemplateInfo()) {
1362 return Builtins::InvokeApiFunction( 1361 Handle<FunctionTemplateInfo> fti =
1363 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0, 1362 Handle<FunctionTemplateInfo>::cast(getter);
1364 nullptr, isolate->factory()->undefined_value()); 1363
1364 // Check if the accessor is backed by a private property (surrogate
1365 // accessor).
1366 if (!fti->cache_property()->IsTheHole(isolate)) {
1367 Handle<Name> name = handle(Name::cast(fti->cache_property()), isolate);
1368
1369 LookupIterator cache_it = LookupIterator::PropertyOrElement(
1370 isolate, it->GetStoreTarget(), name);
1371
1372 // The hidden property must be set before it's accessed.
1373 // This will catch setting the hidden property on the wrong object in most
1374 // cases.
1375 CHECK_EQ(LookupIterator::DATA, cache_it.state());
1376 return Object::GetProperty(&cache_it);
1377 }
1378
1379 // Regular accessor.
1380 return Builtins::InvokeApiFunction(isolate, false, fti, receiver, 0,
1381 nullptr,
1382 isolate->factory()->undefined_value());
1383
1365 } else if (getter->IsCallable()) { 1384 } else if (getter->IsCallable()) {
1366 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1385 // TODO(rossberg): nicer would be to cast to some JSCallable here...
1367 return Object::GetPropertyWithDefinedGetter( 1386 return Object::GetPropertyWithDefinedGetter(
1368 receiver, Handle<JSReceiver>::cast(getter)); 1387 receiver, Handle<JSReceiver>::cast(getter));
1369 } 1388 }
1370 // Getter is not a function. 1389 // Getter is not a function.
1371 return isolate->factory()->undefined_value(); 1390 return isolate->factory()->undefined_value();
1372 } 1391 }
1373 1392
1374 // static 1393 // static
(...skipping 18518 matching lines...) Expand 10 before | Expand all | Expand 10 after
19893 ResolveSet resolve_set(&zone); 19912 ResolveSet resolve_set(&zone);
19894 if (ResolveExport(module, Handle<String>::cast(name), true, &resolve_set) 19913 if (ResolveExport(module, Handle<String>::cast(name), true, &resolve_set)
19895 .is_null()) { 19914 .is_null()) {
19896 return false; 19915 return false;
19897 } 19916 }
19898 } 19917 }
19899 19918
19900 return true; 19919 return true;
19901 } 19920 }
19902 19921
19922 MaybeHandle<Name> FunctionTemplateInfo::TryGetCachePropertyName(
19923 Isolate* isolate, Handle<Object> getter) {
19924 if (getter->IsFunctionTemplateInfo()) {
19925 Handle<FunctionTemplateInfo> fti =
19926 Handle<FunctionTemplateInfo>::cast(getter);
19927 // Check if the accessor is backed by a private property (cached accessor).
19928 if (!fti->cache_property()->IsTheHole(isolate)) {
19929 Handle<Name> name = handle(Name::cast(fti->cache_property()));
19930 return MaybeHandle<Name>(name);
19931 }
19932 }
19933 return MaybeHandle<Name>();
19934 }
19935
19903 } // namespace internal 19936 } // namespace internal
19904 } // namespace v8 19937 } // 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