| 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, MachineRepresentation::kTagged); | 104 VARIABLE(var_elements, MachineRepresentation::kTagged); |
| 105 VARIABLE(var_length, MachineRepresentation::kWord32); | 105 VARIABLE(var_length, MachineRepresentation::kWord32); |
| 106 Label if_done(this), if_arguments(this), if_array(this), | 106 Label if_done(this), if_arguments(this), if_array(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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 Node* target = Parameter(CallWithSpreadDescriptor::kTarget); | 404 Node* target = Parameter(CallWithSpreadDescriptor::kTarget); |
| 390 Node* new_target = nullptr; | 405 Node* new_target = nullptr; |
| 391 Node* spread = Parameter(CallWithSpreadDescriptor::kSpread); | 406 Node* spread = Parameter(CallWithSpreadDescriptor::kSpread); |
| 392 Node* args_count = Parameter(CallWithSpreadDescriptor::kArgumentsCount); | 407 Node* args_count = Parameter(CallWithSpreadDescriptor::kArgumentsCount); |
| 393 Node* context = Parameter(CallWithSpreadDescriptor::kContext); | 408 Node* context = Parameter(CallWithSpreadDescriptor::kContext); |
| 394 CallOrConstructWithSpread(target, new_target, spread, args_count, context); | 409 CallOrConstructWithSpread(target, new_target, spread, args_count, context); |
| 395 } | 410 } |
| 396 | 411 |
| 397 } // namespace internal | 412 } // namespace internal |
| 398 } // namespace v8 | 413 } // namespace v8 |
| OLD | NEW |