| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike( | 102 void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike( |
| 103 Node* target, Node* new_target, Node* arguments_list, Node* context) { | 103 Node* target, Node* new_target, Node* arguments_list, Node* context) { |
| 104 Variable var_elements(this, MachineRepresentation::kTagged); | 104 Variable var_elements(this, MachineRepresentation::kTagged); |
| 105 Variable var_length(this, MachineRepresentation::kWord32); | 105 Variable var_length(this, MachineRepresentation::kWord32); |
| 106 Label if_done(this), if_arguments(this), if_array(this), if_double(this), | 106 Label if_done(this), if_arguments(this), if_array(this), if_double(this), |
| 107 if_holey_array(this, Label::kDeferred), | 107 if_holey_array(this, Label::kDeferred), |
| 108 if_runtime(this, Label::kDeferred); | 108 if_runtime(this, Label::kDeferred); |
| 109 | 109 |
| 110 // Perform appropriate checks on {target} (and {new_target} first). |
| 111 if (new_target == nullptr) { |
| 112 // Check that {target} is Callable. |
| 113 Label if_target_callable(this), |
| 114 if_target_not_callable(this, Label::kDeferred); |
| 115 GotoIf(TaggedIsSmi(target), &if_target_not_callable); |
| 116 Branch(IsCallable(target), &if_target_callable, &if_target_not_callable); |
| 117 BIND(&if_target_not_callable); |
| 118 { |
| 119 CallRuntime(Runtime::kThrowApplyNonFunction, context, target); |
| 120 Unreachable(); |
| 121 } |
| 122 BIND(&if_target_callable); |
| 123 } |
| 124 |
| 110 GotoIf(TaggedIsSmi(arguments_list), &if_runtime); | 125 GotoIf(TaggedIsSmi(arguments_list), &if_runtime); |
| 111 Node* arguments_list_map = LoadMap(arguments_list); | 126 Node* arguments_list_map = LoadMap(arguments_list); |
| 112 Node* native_context = LoadNativeContext(context); | 127 Node* native_context = LoadNativeContext(context); |
| 113 | 128 |
| 114 // Check if {arguments_list} is an (unmodified) arguments object. | 129 // Check if {arguments_list} is an (unmodified) arguments object. |
| 115 Node* sloppy_arguments_map = | 130 Node* sloppy_arguments_map = |
| 116 LoadContextElement(native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX); | 131 LoadContextElement(native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
| 117 GotoIf(WordEqual(arguments_list_map, sloppy_arguments_map), &if_arguments); | 132 GotoIf(WordEqual(arguments_list_map, sloppy_arguments_map), &if_arguments); |
| 118 Node* strict_arguments_map = | 133 Node* strict_arguments_map = |
| 119 LoadContextElement(native_context, Context::STRICT_ARGUMENTS_MAP_INDEX); | 134 LoadContextElement(native_context, Context::STRICT_ARGUMENTS_MAP_INDEX); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 TF_BUILTIN(CallWithArrayLike, CallOrConstructBuiltinsAssembler) { | 265 TF_BUILTIN(CallWithArrayLike, CallOrConstructBuiltinsAssembler) { |
| 251 Node* target = Parameter(CallWithArrayLikeDescriptor::kTarget); | 266 Node* target = Parameter(CallWithArrayLikeDescriptor::kTarget); |
| 252 Node* new_target = nullptr; | 267 Node* new_target = nullptr; |
| 253 Node* arguments_list = Parameter(CallWithArrayLikeDescriptor::kArgumentsList); | 268 Node* arguments_list = Parameter(CallWithArrayLikeDescriptor::kArgumentsList); |
| 254 Node* context = Parameter(CallWithArrayLikeDescriptor::kContext); | 269 Node* context = Parameter(CallWithArrayLikeDescriptor::kContext); |
| 255 CallOrConstructWithArrayLike(target, new_target, arguments_list, context); | 270 CallOrConstructWithArrayLike(target, new_target, arguments_list, context); |
| 256 } | 271 } |
| 257 | 272 |
| 258 } // namespace internal | 273 } // namespace internal |
| 259 } // namespace v8 | 274 } // namespace v8 |
| OLD | NEW |