OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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-call-gen.h" | 5 #include "src/builtins/builtins-call-gen.h" |
6 | 6 |
7 #include "src/builtins/builtins-utils-gen.h" | 7 #include "src/builtins/builtins-utils-gen.h" |
8 #include "src/builtins/builtins.h" | 8 #include "src/builtins/builtins.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 Label if_target_callable(this), | 113 Label if_target_callable(this), |
114 if_target_not_callable(this, Label::kDeferred); | 114 if_target_not_callable(this, Label::kDeferred); |
115 GotoIf(TaggedIsSmi(target), &if_target_not_callable); | 115 GotoIf(TaggedIsSmi(target), &if_target_not_callable); |
116 Branch(IsCallable(target), &if_target_callable, &if_target_not_callable); | 116 Branch(IsCallable(target), &if_target_callable, &if_target_not_callable); |
117 BIND(&if_target_not_callable); | 117 BIND(&if_target_not_callable); |
118 { | 118 { |
119 CallRuntime(Runtime::kThrowApplyNonFunction, context, target); | 119 CallRuntime(Runtime::kThrowApplyNonFunction, context, target); |
120 Unreachable(); | 120 Unreachable(); |
121 } | 121 } |
122 BIND(&if_target_callable); | 122 BIND(&if_target_callable); |
| 123 } else { |
| 124 // Check that {target} is a Constructor. |
| 125 Label if_target_constructor(this), |
| 126 if_target_not_constructor(this, Label::kDeferred); |
| 127 GotoIf(TaggedIsSmi(target), &if_target_not_constructor); |
| 128 Branch(IsConstructor(target), &if_target_constructor, |
| 129 &if_target_not_constructor); |
| 130 BIND(&if_target_not_constructor); |
| 131 { |
| 132 CallRuntime(Runtime::kThrowNotConstructor, context, target); |
| 133 Unreachable(); |
| 134 } |
| 135 BIND(&if_target_constructor); |
| 136 |
| 137 // Check that {new_target} is a Constructor. |
| 138 Label if_new_target_constructor(this), |
| 139 if_new_target_not_constructor(this, Label::kDeferred); |
| 140 GotoIf(TaggedIsSmi(new_target), &if_new_target_not_constructor); |
| 141 Branch(IsConstructor(new_target), &if_new_target_constructor, |
| 142 &if_new_target_not_constructor); |
| 143 BIND(&if_new_target_not_constructor); |
| 144 { |
| 145 CallRuntime(Runtime::kThrowNotConstructor, context, new_target); |
| 146 Unreachable(); |
| 147 } |
| 148 BIND(&if_new_target_constructor); |
123 } | 149 } |
124 | 150 |
125 GotoIf(TaggedIsSmi(arguments_list), &if_runtime); | 151 GotoIf(TaggedIsSmi(arguments_list), &if_runtime); |
126 Node* arguments_list_map = LoadMap(arguments_list); | 152 Node* arguments_list_map = LoadMap(arguments_list); |
127 Node* native_context = LoadNativeContext(context); | 153 Node* native_context = LoadNativeContext(context); |
128 | 154 |
129 // Check if {arguments_list} is an (unmodified) arguments object. | 155 // Check if {arguments_list} is an (unmodified) arguments object. |
130 Node* sloppy_arguments_map = | 156 Node* sloppy_arguments_map = |
131 LoadContextElement(native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX); | 157 LoadContextElement(native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
132 GotoIf(WordEqual(arguments_list_map, sloppy_arguments_map), &if_arguments); | 158 GotoIf(WordEqual(arguments_list_map, sloppy_arguments_map), &if_arguments); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 Node* target = Parameter(CallWithSpreadDescriptor::kTarget); | 430 Node* target = Parameter(CallWithSpreadDescriptor::kTarget); |
405 Node* new_target = nullptr; | 431 Node* new_target = nullptr; |
406 Node* spread = Parameter(CallWithSpreadDescriptor::kSpread); | 432 Node* spread = Parameter(CallWithSpreadDescriptor::kSpread); |
407 Node* args_count = Parameter(CallWithSpreadDescriptor::kArgumentsCount); | 433 Node* args_count = Parameter(CallWithSpreadDescriptor::kArgumentsCount); |
408 Node* context = Parameter(CallWithSpreadDescriptor::kContext); | 434 Node* context = Parameter(CallWithSpreadDescriptor::kContext); |
409 CallOrConstructWithSpread(target, new_target, spread, args_count, context); | 435 CallOrConstructWithSpread(target, new_target, spread, args_count, context); |
410 } | 436 } |
411 | 437 |
412 } // namespace internal | 438 } // namespace internal |
413 } // namespace v8 | 439 } // namespace v8 |
OLD | NEW |