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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-aux-data-inl.h" | 10 #include "src/compiler/node-aux-data-inl.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // Lower to a direct call to a constant JSFunction if legal. | 390 // Lower to a direct call to a constant JSFunction if legal. |
391 const CallFunctionParameters& p = CallFunctionParametersOf(node->op()); | 391 const CallFunctionParameters& p = CallFunctionParametersOf(node->op()); |
392 int arg_count = static_cast<int>(p.arity() - 2); | 392 int arg_count = static_cast<int>(p.arity() - 2); |
393 | 393 |
394 // Check the function is a constant and is really a JSFunction. | 394 // Check the function is a constant and is really a JSFunction. |
395 HeapObjectMatcher<Object> function_const(node->InputAt(0)); | 395 HeapObjectMatcher<Object> function_const(node->InputAt(0)); |
396 if (!function_const.HasValue()) return false; // not a constant. | 396 if (!function_const.HasValue()) return false; // not a constant. |
397 Handle<Object> func = function_const.Value().handle(); | 397 Handle<Object> func = function_const.Value().handle(); |
398 if (!func->IsJSFunction()) return false; // not a function. | 398 if (!func->IsJSFunction()) return false; // not a function. |
399 Handle<JSFunction> function = Handle<JSFunction>::cast(func); | 399 Handle<JSFunction> function = Handle<JSFunction>::cast(func); |
400 if (arg_count != function->shared()->formal_parameter_count()) return false; | 400 if (arg_count != function->shared()->internal_formal_parameter_count()) { |
| 401 return false; |
| 402 } |
401 | 403 |
402 // Check the receiver doesn't need to be wrapped. | 404 // Check the receiver doesn't need to be wrapped. |
403 Node* receiver = node->InputAt(1); | 405 Node* receiver = node->InputAt(1); |
404 if (!NodeProperties::IsTyped(receiver)) return false; | 406 if (!NodeProperties::IsTyped(receiver)) return false; |
405 Type* ok_receiver = Type::Union(Type::Undefined(), Type::Receiver(), zone()); | 407 Type* ok_receiver = Type::Union(Type::Undefined(), Type::Receiver(), zone()); |
406 if (!NodeProperties::GetBounds(receiver).upper->Is(ok_receiver)) return false; | 408 if (!NodeProperties::GetBounds(receiver).upper->Is(ok_receiver)) return false; |
407 | 409 |
408 int index = NodeProperties::FirstContextIndex(node); | 410 int index = NodeProperties::FirstContextIndex(node); |
409 | 411 |
410 // TODO(titzer): total hack to share function context constants. | 412 // TODO(titzer): total hack to share function context constants. |
(...skipping 30 matching lines...) Expand all Loading... |
441 | 443 |
442 | 444 |
443 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 445 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
444 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 446 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
445 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 447 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
446 } | 448 } |
447 | 449 |
448 } // namespace compiler | 450 } // namespace compiler |
449 } // namespace internal | 451 } // namespace internal |
450 } // namespace v8 | 452 } // namespace v8 |
OLD | NEW |