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

Side by Side Diff: src/bootstrapper.cc

Issue 2497523002: [promises] Move promise constructor to TFS (Closed)
Patch Set: remove temp code Created 4 years, 1 month 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/builtins/builtins.h » ('j') | src/builtins/builtins-promise.cc » ('J')
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/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3576 Handle<String> key = factory()->Promise_string(); 3576 Handle<String> key = factory()->Promise_string();
3577 Handle<JSFunction> function = Handle<JSFunction>::cast( 3577 Handle<JSFunction> function = Handle<JSFunction>::cast(
3578 JSReceiver::GetProperty(global_object, key).ToHandleChecked()); 3578 JSReceiver::GetProperty(global_object, key).ToHandleChecked());
3579 JSFunction::EnsureHasInitialMap(function); 3579 JSFunction::EnsureHasInitialMap(function);
3580 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); 3580 function->initial_map()->set_instance_type(JS_PROMISE_TYPE);
3581 function->shared()->SetConstructStub( 3581 function->shared()->SetConstructStub(
3582 *isolate()->builtins()->JSBuiltinsConstructStub()); 3582 *isolate()->builtins()->JSBuiltinsConstructStub());
3583 InstallWithIntrinsicDefaultProto(isolate(), function, 3583 InstallWithIntrinsicDefaultProto(isolate(), function,
3584 Context::PROMISE_FUNCTION_INDEX); 3584 Context::PROMISE_FUNCTION_INDEX);
3585 3585
3586 // TODO(gsathya): Fix up the wiring to be the correct Promise constructor.
3587 Handle<JSObject> prototype =
3588 factory()->NewJSObject(isolate()->object_function(), TENURED);
3589 Handle<JSFunction> promise2_fun = SimpleInstallFunction(
3590 global_object, "Promise2", Builtins::kPromiseConstructor, 1, false);
Benedikt Meurer 2016/11/11 06:50:30 You cannot say "dont adapt" arguments here, but ha
gsathya 2016/11/22 04:31:43 Done.
3591
3592 Handle<SharedFunctionInfo> shared(promise2_fun->shared(), isolate());
3593 shared->SetConstructStub(*isolate()->builtins()->PromiseConstructor());
Benedikt Meurer 2016/11/11 06:50:30 I'm not sure we currently support having a TFS bui
gsathya 2016/11/22 04:31:43 Done.
3594 shared->set_instance_class_name(isolate()->heap()->Promise_string());
3595 shared->DontAdaptArguments();
Benedikt Meurer 2016/11/11 06:50:30 This is reundant (and wrong).
gsathya 2016/11/22 04:31:43 Done.
3596
3586 { 3597 {
3587 Handle<Code> code = handle( 3598 Handle<Code> code = handle(
3588 isolate()->builtins()->builtin(Builtins::kPromiseResolveClosure), 3599 isolate()->builtins()->builtin(Builtins::kPromiseResolveClosure),
3589 isolate()); 3600 isolate());
3590 Handle<SharedFunctionInfo> info = 3601 Handle<SharedFunctionInfo> info =
3591 isolate()->factory()->NewSharedFunctionInfo(factory()->empty_string(), 3602 isolate()->factory()->NewSharedFunctionInfo(factory()->empty_string(),
3592 code, false); 3603 code, false);
3593 info->set_internal_formal_parameter_count(1); 3604 info->set_internal_formal_parameter_count(1);
3594 info->set_length(1); 3605 info->set_length(1);
3595 native_context()->set_promise_resolve_shared_fun(*info); 3606 native_context()->set_promise_resolve_shared_fun(*info);
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
4552 } 4563 }
4553 4564
4554 4565
4555 // Called when the top-level V8 mutex is destroyed. 4566 // Called when the top-level V8 mutex is destroyed.
4556 void Bootstrapper::FreeThreadResources() { 4567 void Bootstrapper::FreeThreadResources() {
4557 DCHECK(!IsActive()); 4568 DCHECK(!IsActive());
4558 } 4569 }
4559 4570
4560 } // namespace internal 4571 } // namespace internal
4561 } // namespace v8 4572 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | src/builtins/builtins-promise.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698