| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; | 618 int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; |
| 619 Map::EnsureDescriptorSlack(map, size); | 619 Map::EnsureDescriptorSlack(map, size); |
| 620 | 620 |
| 621 PropertyAttributes rw_attribs = | 621 PropertyAttributes rw_attribs = |
| 622 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 622 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
| 623 PropertyAttributes ro_attribs = | 623 PropertyAttributes ro_attribs = |
| 624 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 624 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 625 PropertyAttributes roc_attribs = | 625 PropertyAttributes roc_attribs = |
| 626 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | 626 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
| 627 | 627 |
| 628 // Add length. | |
| 629 if (function_mode == BOUND_FUNCTION) { | 628 if (function_mode == BOUND_FUNCTION) { |
| 630 Handle<String> length_string = isolate()->factory()->length_string(); | 629 { // Add length. |
| 631 DataDescriptor d(length_string, 0, roc_attribs, Representation::Tagged()); | 630 Handle<String> length_string = isolate()->factory()->length_string(); |
| 632 map->AppendDescriptor(&d); | 631 DataDescriptor d(length_string, 0, roc_attribs, Representation::Tagged()); |
| 632 map->AppendDescriptor(&d); |
| 633 } |
| 634 { // Add name. |
| 635 Handle<String> name_string = isolate()->factory()->name_string(); |
| 636 DataDescriptor d(name_string, 1, roc_attribs, Representation::Tagged()); |
| 637 map->AppendDescriptor(&d); |
| 638 } |
| 633 } else { | 639 } else { |
| 634 DCHECK(function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE || | 640 DCHECK(function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE || |
| 635 function_mode == FUNCTION_WITH_READONLY_PROTOTYPE || | 641 function_mode == FUNCTION_WITH_READONLY_PROTOTYPE || |
| 636 function_mode == FUNCTION_WITHOUT_PROTOTYPE); | 642 function_mode == FUNCTION_WITHOUT_PROTOTYPE); |
| 637 Handle<AccessorInfo> length = | 643 { // Add length. |
| 638 Accessors::FunctionLengthInfo(isolate(), roc_attribs); | 644 Handle<AccessorInfo> length = |
| 639 AccessorConstantDescriptor d(Handle<Name>(Name::cast(length->name())), | 645 Accessors::FunctionLengthInfo(isolate(), roc_attribs); |
| 640 length, roc_attribs); | 646 AccessorConstantDescriptor d(Handle<Name>(Name::cast(length->name())), |
| 641 map->AppendDescriptor(&d); | 647 length, roc_attribs); |
| 642 } | 648 map->AppendDescriptor(&d); |
| 643 Handle<AccessorInfo> name = | 649 } |
| 644 Accessors::FunctionNameInfo(isolate(), roc_attribs); | 650 { // Add name. |
| 645 { // Add name. | 651 Handle<AccessorInfo> name = |
| 646 AccessorConstantDescriptor d(Handle<Name>(Name::cast(name->name())), name, | 652 Accessors::FunctionNameInfo(isolate(), roc_attribs); |
| 647 roc_attribs); | 653 AccessorConstantDescriptor d(Handle<Name>(Name::cast(name->name())), name, |
| 648 map->AppendDescriptor(&d); | 654 roc_attribs); |
| 655 map->AppendDescriptor(&d); |
| 656 } |
| 649 } | 657 } |
| 650 if (IsFunctionModeWithPrototype(function_mode)) { | 658 if (IsFunctionModeWithPrototype(function_mode)) { |
| 651 // Add prototype. | 659 // Add prototype. |
| 652 PropertyAttributes attribs = | 660 PropertyAttributes attribs = |
| 653 function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ? rw_attribs | 661 function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ? rw_attribs |
| 654 : ro_attribs; | 662 : ro_attribs; |
| 655 Handle<AccessorInfo> prototype = | 663 Handle<AccessorInfo> prototype = |
| 656 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 664 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
| 657 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 665 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
| 658 prototype, attribs); | 666 prototype, attribs); |
| (...skipping 2618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3277 } | 3285 } |
| 3278 | 3286 |
| 3279 | 3287 |
| 3280 // Called when the top-level V8 mutex is destroyed. | 3288 // Called when the top-level V8 mutex is destroyed. |
| 3281 void Bootstrapper::FreeThreadResources() { | 3289 void Bootstrapper::FreeThreadResources() { |
| 3282 DCHECK(!IsActive()); | 3290 DCHECK(!IsActive()); |
| 3283 } | 3291 } |
| 3284 | 3292 |
| 3285 } // namespace internal | 3293 } // namespace internal |
| 3286 } // namespace v8 | 3294 } // namespace v8 |
| OLD | NEW |