OLD | NEW |
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/compiler/js-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
6 | 6 |
7 #include "src/ast/modules.h" | 7 #include "src/ast/modules.h" |
8 #include "src/builtins/builtins-utils.h" | 8 #include "src/builtins/builtins-utils.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compilation-dependencies.h" | 10 #include "src/compilation-dependencies.h" |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 // -- 2 + n + 1: target | 1881 // -- 2 + n + 1: target |
1882 // -- 2 + n + 2: new_target | 1882 // -- 2 + n + 2: new_target |
1883 // --- Register args --- | 1883 // --- Register args --- |
1884 // -- 2 + n + 3: the C entry point | 1884 // -- 2 + n + 3: the C entry point |
1885 // -- 2 + n + 4: argc (Int32) | 1885 // -- 2 + n + 4: argc (Int32) |
1886 // ----------------------------------- | 1886 // ----------------------------------- |
1887 | 1887 |
1888 // The logic contained here is mirrored in Builtins::Generate_Adaptor. | 1888 // The logic contained here is mirrored in Builtins::Generate_Adaptor. |
1889 // Keep these in sync. | 1889 // Keep these in sync. |
1890 | 1890 |
1891 const bool is_construct = (node->opcode() == IrOpcode::kJSCallConstruct); | 1891 const bool is_construct = (node->opcode() == IrOpcode::kJSConstruct); |
1892 | 1892 |
1893 DCHECK(Builtins::HasCppImplementation(builtin_index)); | 1893 DCHECK(Builtins::HasCppImplementation(builtin_index)); |
1894 DCHECK_EQ(0, flags & CallDescriptor::kSupportsTailCalls); | 1894 DCHECK_EQ(0, flags & CallDescriptor::kSupportsTailCalls); |
1895 | 1895 |
1896 Node* target = NodeProperties::GetValueInput(node, 0); | 1896 Node* target = NodeProperties::GetValueInput(node, 0); |
1897 Node* new_target = is_construct | 1897 Node* new_target = is_construct |
1898 ? NodeProperties::GetValueInput(node, arity + 1) | 1898 ? NodeProperties::GetValueInput(node, arity + 1) |
1899 : jsgraph->UndefinedConstant(); | 1899 : jsgraph->UndefinedConstant(); |
1900 | 1900 |
1901 // API and CPP builtins are implemented in C++, and we can inline both. | 1901 // API and CPP builtins are implemented in C++, and we can inline both. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 } | 1941 } |
1942 | 1942 |
1943 bool NeedsArgumentAdaptorFrame(Handle<SharedFunctionInfo> shared, int arity) { | 1943 bool NeedsArgumentAdaptorFrame(Handle<SharedFunctionInfo> shared, int arity) { |
1944 static const int sentinel = SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 1944 static const int sentinel = SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
1945 const int num_decl_parms = shared->internal_formal_parameter_count(); | 1945 const int num_decl_parms = shared->internal_formal_parameter_count(); |
1946 return (num_decl_parms != arity && num_decl_parms != sentinel); | 1946 return (num_decl_parms != arity && num_decl_parms != sentinel); |
1947 } | 1947 } |
1948 | 1948 |
1949 } // namespace | 1949 } // namespace |
1950 | 1950 |
1951 Reduction JSTypedLowering::ReduceJSCallConstruct(Node* node) { | 1951 Reduction JSTypedLowering::ReduceJSConstruct(Node* node) { |
1952 DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode()); | 1952 DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode()); |
1953 CallConstructParameters const& p = CallConstructParametersOf(node->op()); | 1953 ConstructParameters const& p = ConstructParametersOf(node->op()); |
1954 DCHECK_LE(2u, p.arity()); | 1954 DCHECK_LE(2u, p.arity()); |
1955 int const arity = static_cast<int>(p.arity() - 2); | 1955 int const arity = static_cast<int>(p.arity() - 2); |
1956 Node* target = NodeProperties::GetValueInput(node, 0); | 1956 Node* target = NodeProperties::GetValueInput(node, 0); |
1957 Type* target_type = NodeProperties::GetType(target); | 1957 Type* target_type = NodeProperties::GetType(target); |
1958 Node* new_target = NodeProperties::GetValueInput(node, arity + 1); | 1958 Node* new_target = NodeProperties::GetValueInput(node, arity + 1); |
1959 Node* effect = NodeProperties::GetEffectInput(node); | 1959 Node* effect = NodeProperties::GetEffectInput(node); |
1960 Node* control = NodeProperties::GetControlInput(node); | 1960 Node* control = NodeProperties::GetControlInput(node); |
1961 | 1961 |
1962 // Check if {target} is a known JSFunction. | 1962 // Check if {target} is a known JSFunction. |
1963 if (target_type->IsHeapConstant() && | 1963 if (target_type->IsHeapConstant() && |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 case IrOpcode::kJSLoadContext: | 2405 case IrOpcode::kJSLoadContext: |
2406 return ReduceJSLoadContext(node); | 2406 return ReduceJSLoadContext(node); |
2407 case IrOpcode::kJSStoreContext: | 2407 case IrOpcode::kJSStoreContext: |
2408 return ReduceJSStoreContext(node); | 2408 return ReduceJSStoreContext(node); |
2409 case IrOpcode::kJSLoadModule: | 2409 case IrOpcode::kJSLoadModule: |
2410 return ReduceJSLoadModule(node); | 2410 return ReduceJSLoadModule(node); |
2411 case IrOpcode::kJSStoreModule: | 2411 case IrOpcode::kJSStoreModule: |
2412 return ReduceJSStoreModule(node); | 2412 return ReduceJSStoreModule(node); |
2413 case IrOpcode::kJSConvertReceiver: | 2413 case IrOpcode::kJSConvertReceiver: |
2414 return ReduceJSConvertReceiver(node); | 2414 return ReduceJSConvertReceiver(node); |
2415 case IrOpcode::kJSCallConstruct: | 2415 case IrOpcode::kJSConstruct: |
2416 return ReduceJSCallConstruct(node); | 2416 return ReduceJSConstruct(node); |
2417 case IrOpcode::kJSCallForwardVarargs: | 2417 case IrOpcode::kJSCallForwardVarargs: |
2418 return ReduceJSCallForwardVarargs(node); | 2418 return ReduceJSCallForwardVarargs(node); |
2419 case IrOpcode::kJSCallFunction: | 2419 case IrOpcode::kJSCallFunction: |
2420 return ReduceJSCallFunction(node); | 2420 return ReduceJSCallFunction(node); |
2421 case IrOpcode::kJSForInNext: | 2421 case IrOpcode::kJSForInNext: |
2422 return ReduceJSForInNext(node); | 2422 return ReduceJSForInNext(node); |
2423 case IrOpcode::kJSLoadMessage: | 2423 case IrOpcode::kJSLoadMessage: |
2424 return ReduceJSLoadMessage(node); | 2424 return ReduceJSLoadMessage(node); |
2425 case IrOpcode::kJSStoreMessage: | 2425 case IrOpcode::kJSStoreMessage: |
2426 return ReduceJSStoreMessage(node); | 2426 return ReduceJSStoreMessage(node); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 } | 2460 } |
2461 | 2461 |
2462 | 2462 |
2463 CompilationDependencies* JSTypedLowering::dependencies() const { | 2463 CompilationDependencies* JSTypedLowering::dependencies() const { |
2464 return dependencies_; | 2464 return dependencies_; |
2465 } | 2465 } |
2466 | 2466 |
2467 } // namespace compiler | 2467 } // namespace compiler |
2468 } // namespace internal | 2468 } // namespace internal |
2469 } // namespace v8 | 2469 } // namespace v8 |
OLD | NEW |