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/ieee754.h" | 9 #include "src/base/ieee754.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 // Install the "constructor" property on the {prototype}. | 1865 // Install the "constructor" property on the {prototype}. |
1866 JSObject::AddProperty(prototype, factory->constructor_string(), promise_fun, | 1866 JSObject::AddProperty(prototype, factory->constructor_string(), promise_fun, |
1867 DONT_ENUM); | 1867 DONT_ENUM); |
1868 | 1868 |
1869 // Install the @@toStringTag property on the {prototype}. | 1869 // Install the @@toStringTag property on the {prototype}. |
1870 JSObject::AddProperty( | 1870 JSObject::AddProperty( |
1871 prototype, factory->to_string_tag_symbol(), factory->Promise_string(), | 1871 prototype, factory->to_string_tag_symbol(), factory->Promise_string(), |
1872 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 1872 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
1873 | 1873 |
1874 Handle<JSFunction> promise_then = | 1874 Handle<JSFunction> promise_then = |
1875 SimpleCreateFunction(isolate, isolate->factory()->then_string(), | 1875 SimpleInstallFunction(prototype, isolate->factory()->then_string(), |
1876 Builtins::kPromiseThen, 2, true); | 1876 Builtins::kPromiseThen, 2, true); |
1877 JSObject::AddProperty(prototype, isolate->factory()->then_string(), | |
1878 promise_then, DONT_ENUM); | |
1879 InstallWithIntrinsicDefaultProto(isolate, promise_then, | 1877 InstallWithIntrinsicDefaultProto(isolate, promise_then, |
1880 Context::PROMISE_THEN_INDEX); | 1878 Context::PROMISE_THEN_INDEX); |
1881 | 1879 |
1882 // TODO(gsathya): Move to TF | 1880 Handle<JSFunction> promise_catch = SimpleInstallFunction( |
1883 SimpleInstallFunction(prototype, "catch", Builtins::kIllegal, 1, true, | 1881 prototype, "catch", Builtins::kPromiseCatch, 1, true, DONT_ENUM); |
1884 DONT_ENUM); | 1882 InstallWithIntrinsicDefaultProto(isolate, promise_catch, |
| 1883 Context::PROMISE_CATCH_INDEX); |
1885 | 1884 |
1886 SimpleInstallGetter(promise_fun, factory->symbol_species_string(), | 1885 SimpleInstallGetter(promise_fun, factory->symbol_species_string(), |
1887 factory->species_symbol(), Builtins::kReturnReceiver, | 1886 factory->species_symbol(), Builtins::kReturnReceiver, |
1888 true); | 1887 true); |
1889 | 1888 |
1890 Handle<Map> prototype_map(prototype->map()); | 1889 Handle<Map> prototype_map(prototype->map()); |
1891 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); | 1890 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
1892 | 1891 |
1893 // Store the initial Promise.prototype map. This is used in fast-path | 1892 // Store the initial Promise.prototype map. This is used in fast-path |
1894 // checks. Do not alter the prototype after this point. | 1893 // checks. Do not alter the prototype after this point. |
(...skipping 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4666 } | 4665 } |
4667 | 4666 |
4668 | 4667 |
4669 // Called when the top-level V8 mutex is destroyed. | 4668 // Called when the top-level V8 mutex is destroyed. |
4670 void Bootstrapper::FreeThreadResources() { | 4669 void Bootstrapper::FreeThreadResources() { |
4671 DCHECK(!IsActive()); | 4670 DCHECK(!IsActive()); |
4672 } | 4671 } |
4673 | 4672 |
4674 } // namespace internal | 4673 } // namespace internal |
4675 } // namespace v8 | 4674 } // namespace v8 |
OLD | NEW |