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 Handle<Map> prototype_map(prototype->map()); | 1885 Handle<Map> prototype_map(prototype->map()); |
1887 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); | 1886 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
1888 | 1887 |
1889 // Store the initial Promise.prototype map. This is used in fast-path | 1888 // Store the initial Promise.prototype map. This is used in fast-path |
1890 // checks. Do not alter the prototype after this point. | 1889 // checks. Do not alter the prototype after this point. |
1891 native_context()->set_promise_prototype_map(*prototype_map); | 1890 native_context()->set_promise_prototype_map(*prototype_map); |
1892 | 1891 |
1893 { // Internal: PromiseInternalConstructor | 1892 { // Internal: PromiseInternalConstructor |
1894 Handle<JSFunction> function = | 1893 Handle<JSFunction> function = |
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4656 } | 4655 } |
4657 | 4656 |
4658 | 4657 |
4659 // Called when the top-level V8 mutex is destroyed. | 4658 // Called when the top-level V8 mutex is destroyed. |
4660 void Bootstrapper::FreeThreadResources() { | 4659 void Bootstrapper::FreeThreadResources() { |
4661 DCHECK(!IsActive()); | 4660 DCHECK(!IsActive()); |
4662 } | 4661 } |
4663 | 4662 |
4664 } // namespace internal | 4663 } // namespace internal |
4665 } // namespace v8 | 4664 } // namespace v8 |
OLD | NEW |