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

Side by Side Diff: src/bootstrapper.cc

Issue 1871503002: Lazily compute boundfunction .name and .length if possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed Created 4 years, 8 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/api.cc ('k') | src/builtins.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 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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 { // --- B o u n d F u n c t i o n 1698 { // --- B o u n d F u n c t i o n
1699 Handle<Map> map = 1699 Handle<Map> map =
1700 factory->NewMap(JS_BOUND_FUNCTION_TYPE, JSBoundFunction::kSize); 1700 factory->NewMap(JS_BOUND_FUNCTION_TYPE, JSBoundFunction::kSize);
1701 map->set_is_callable(); 1701 map->set_is_callable();
1702 Map::SetPrototype(map, empty_function); 1702 Map::SetPrototype(map, empty_function);
1703 1703
1704 PropertyAttributes roc_attribs = 1704 PropertyAttributes roc_attribs =
1705 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); 1705 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
1706 Map::EnsureDescriptorSlack(map, 2); 1706 Map::EnsureDescriptorSlack(map, 2);
1707 1707
1708 Handle<AccessorInfo> bound_length =
1709 Accessors::BoundFunctionLengthInfo(isolate, roc_attribs);
1708 { // length 1710 { // length
1709 DataDescriptor d(factory->length_string(), JSBoundFunction::kLengthIndex, 1711 AccessorConstantDescriptor d(factory->length_string(), bound_length,
1710 roc_attribs, Representation::Tagged()); 1712 roc_attribs);
1711 map->AppendDescriptor(&d); 1713 map->AppendDescriptor(&d);
1712 } 1714 }
1713 { // name 1715 Handle<AccessorInfo> bound_name =
1714 DataDescriptor d(factory->name_string(), JSBoundFunction::kNameIndex, 1716 Accessors::BoundFunctionNameInfo(isolate, roc_attribs);
1715 roc_attribs, Representation::Tagged()); 1717 { // length
1718 AccessorConstantDescriptor d(factory->name_string(), bound_name,
1719 roc_attribs);
1716 map->AppendDescriptor(&d); 1720 map->AppendDescriptor(&d);
1717 } 1721 }
1718 1722 map->SetInObjectProperties(0);
1719 map->SetInObjectProperties(2);
1720 native_context()->set_bound_function_without_constructor_map(*map); 1723 native_context()->set_bound_function_without_constructor_map(*map);
1721 1724
1722 map = Map::Copy(map, "IsConstructor"); 1725 map = Map::Copy(map, "IsConstructor");
1723 map->set_is_constructor(true); 1726 map->set_is_constructor(true);
1724 native_context()->set_bound_function_with_constructor_map(*map); 1727 native_context()->set_bound_function_with_constructor_map(*map);
1725 } 1728 }
1726 1729
1727 { // --- sloppy arguments map 1730 { // --- sloppy arguments map
1728 // Make sure we can recognize argument objects at runtime. 1731 // Make sure we can recognize argument objects at runtime.
1729 // This is done by introducing an anonymous function with 1732 // This is done by introducing an anonymous function with
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
3614 } 3617 }
3615 3618
3616 3619
3617 // Called when the top-level V8 mutex is destroyed. 3620 // Called when the top-level V8 mutex is destroyed.
3618 void Bootstrapper::FreeThreadResources() { 3621 void Bootstrapper::FreeThreadResources() {
3619 DCHECK(!IsActive()); 3622 DCHECK(!IsActive());
3620 } 3623 }
3621 3624
3622 } // namespace internal 3625 } // namespace internal
3623 } // namespace v8 3626 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698