OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |