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

Side by Side Diff: src/bootstrapper.cc

Issue 1379323002: [runtime] Share constructor/non-constructor bound function maps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | src/contexts.h » ('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/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 // Later the map is replaced with writable prototype map, allocated below. 759 // Later the map is replaced with writable prototype map, allocated below.
760 Handle<Map> strict_function_map = 760 Handle<Map> strict_function_map =
761 CreateStrictFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE, empty); 761 CreateStrictFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE, empty);
762 native_context()->set_strict_function_map(*strict_function_map); 762 native_context()->set_strict_function_map(*strict_function_map);
763 763
764 // The final map for the strict mode functions. Writeable prototype. 764 // The final map for the strict mode functions. Writeable prototype.
765 // This map is installed in MakeFunctionInstancePrototypeWritable. 765 // This map is installed in MakeFunctionInstancePrototypeWritable.
766 strict_function_map_writable_prototype_ = 766 strict_function_map_writable_prototype_ =
767 CreateStrictFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); 767 CreateStrictFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty);
768 768
769 // Special map for bound functions. 769 // Special map for non-constructor bound functions.
770 Handle<Map> bound_function_map = 770 // TODO(bmeurer): Bound functions should not be represented as JSFunctions.
771 Handle<Map> bound_function_without_constructor_map =
771 CreateStrictFunctionMap(BOUND_FUNCTION, empty); 772 CreateStrictFunctionMap(BOUND_FUNCTION, empty);
772 native_context()->set_bound_function_map(*bound_function_map); 773 native_context()->set_bound_function_without_constructor_map(
774 *bound_function_without_constructor_map);
775
776 // Special map for constructor bound functions.
777 // TODO(bmeurer): Bound functions should not be represented as JSFunctions.
778 Handle<Map> bound_function_with_constructor_map =
779 Map::Copy(bound_function_without_constructor_map, "IsConstructor");
780 bound_function_with_constructor_map->set_is_constructor(true);
781 native_context()->set_bound_function_with_constructor_map(
782 *bound_function_with_constructor_map);
773 } 783 }
774 784
775 785
776 void Genesis::CreateStrongModeFunctionMaps(Handle<JSFunction> empty) { 786 void Genesis::CreateStrongModeFunctionMaps(Handle<JSFunction> empty) {
777 // Allocate map for strong mode instances, which never have prototypes. 787 // Allocate map for strong mode instances, which never have prototypes.
778 Handle<Map> strong_function_map = CreateStrongFunctionMap(empty, false); 788 Handle<Map> strong_function_map = CreateStrongFunctionMap(empty, false);
779 native_context()->set_strong_function_map(*strong_function_map); 789 native_context()->set_strong_function_map(*strong_function_map);
780 // Constructors do, though. 790 // Constructors do, though.
781 Handle<Map> strong_constructor_map = CreateStrongFunctionMap(empty, true); 791 Handle<Map> strong_constructor_map = CreateStrongFunctionMap(empty, true);
782 native_context()->set_strong_constructor_map(*strong_constructor_map); 792 native_context()->set_strong_constructor_map(*strong_constructor_map);
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 } 3279 }
3270 3280
3271 3281
3272 // Called when the top-level V8 mutex is destroyed. 3282 // Called when the top-level V8 mutex is destroyed.
3273 void Bootstrapper::FreeThreadResources() { 3283 void Bootstrapper::FreeThreadResources() {
3274 DCHECK(!IsActive()); 3284 DCHECK(!IsActive());
3275 } 3285 }
3276 3286
3277 } // namespace internal 3287 } // namespace internal
3278 } // namespace v8 3288 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698