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

Side by Side Diff: src/builtins/builtins-promise.cc

Issue 2595423002: [promises] Check if receiver is smi before loading map (Closed)
Patch Set: Created 4 years 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins-promise.h" 5 #include "src/builtins/builtins-promise.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 #include "src/builtins/builtins.h" 7 #include "src/builtins/builtins.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stub-assembler.h" 9 #include "src/code-stub-assembler.h"
10 #include "src/promise-utils.h" 10 #include "src/promise-utils.h"
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 // ES#sec-promise.prototype.catch 1004 // ES#sec-promise.prototype.catch
1005 // Promise.prototype.catch ( onRejected ) 1005 // Promise.prototype.catch ( onRejected )
1006 TF_BUILTIN(PromiseCatch, PromiseBuiltinsAssembler) { 1006 TF_BUILTIN(PromiseCatch, PromiseBuiltinsAssembler) {
1007 // 1. Let promise be the this value. 1007 // 1. Let promise be the this value.
1008 Node* const promise = Parameter(0); 1008 Node* const promise = Parameter(0);
1009 Node* const on_resolve = UndefinedConstant(); 1009 Node* const on_resolve = UndefinedConstant();
1010 Node* const on_reject = Parameter(1); 1010 Node* const on_reject = Parameter(1);
1011 Node* const context = Parameter(4); 1011 Node* const context = Parameter(4);
1012 1012
1013 Label if_internalthen(this), if_customthen(this, Label::kDeferred); 1013 Label if_internalthen(this), if_customthen(this, Label::kDeferred);
1014 GotoIf(TaggedIsSmi(promise), &if_customthen);
1014 BranchIfFastPath(context, promise, &if_internalthen, &if_customthen); 1015 BranchIfFastPath(context, promise, &if_internalthen, &if_customthen);
1015 1016
1016 Bind(&if_internalthen); 1017 Bind(&if_internalthen);
1017 { 1018 {
1018 Node* const result = 1019 Node* const result =
1019 InternalPromiseThen(context, promise, on_resolve, on_reject); 1020 InternalPromiseThen(context, promise, on_resolve, on_reject);
1020 Return(result); 1021 Return(result);
1021 } 1022 }
1022 1023
1023 Bind(&if_customthen); 1024 Bind(&if_customthen);
1024 { 1025 {
1025 Isolate* isolate = this->isolate(); 1026 Isolate* isolate = this->isolate();
1026 Node* const then_str = HeapConstant(isolate->factory()->then_string()); 1027 Node* const then_str = HeapConstant(isolate->factory()->then_string());
1027 Callable getproperty_callable = CodeFactory::GetProperty(isolate); 1028 Callable getproperty_callable = CodeFactory::GetProperty(isolate);
1028 Node* const then = 1029 Node* const then =
1029 CallStub(getproperty_callable, context, promise, then_str); 1030 CallStub(getproperty_callable, context, promise, then_str);
1030 Callable call_callable = CodeFactory::Call(isolate); 1031 Callable call_callable = CodeFactory::Call(isolate);
1031 Node* const result = 1032 Node* const result =
1032 CallJS(call_callable, context, then, promise, on_resolve, on_reject); 1033 CallJS(call_callable, context, then, promise, on_resolve, on_reject);
1033 Return(result); 1034 Return(result);
1034 } 1035 }
1035 } 1036 }
1036 1037
1037 } // namespace internal 1038 } // namespace internal
1038 } // namespace v8 1039 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698