Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 453363003: Revert "Initial shot at deoptimizing JSCallFunction in Turbofan." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph-inl.h" 7 #include "src/compiler/graph-inl.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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 Handle<JSFunction> function( 342 Handle<JSFunction> function(
343 JSFunction::cast(info()->context()->builtins()->javascript_builtin(id))); 343 JSFunction::cast(info()->context()->builtins()->javascript_builtin(id)));
344 Node* stub_code = CodeConstant(stub.GetCode()); 344 Node* stub_code = CodeConstant(stub.GetCode());
345 Node* function_node = FunctionConstant(function); 345 Node* function_node = FunctionConstant(function);
346 PatchInsertInput(node, 0, stub_code); 346 PatchInsertInput(node, 0, stub_code);
347 PatchInsertInput(node, 1, function_node); 347 PatchInsertInput(node, 1, function_node);
348 PatchOperator(node, common()->Call(desc)); 348 PatchOperator(node, common()->Call(desc));
349 } 349 }
350 350
351 351
352 static CallDescriptor::DeoptimizationSupport DeoptimizationSupportForNode(
353 Node* node) {
354 return OperatorProperties::CanLazilyDeoptimize(node->op())
355 ? CallDescriptor::kCanDeoptimize
356 : CallDescriptor::kCannotDeoptimize;
357 }
358
359
360 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, 352 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
361 Runtime::FunctionId f, 353 Runtime::FunctionId f,
362 int nargs_override) { 354 int nargs_override) {
363 Operator::Property props = node->op()->properties(); 355 Operator::Property props = node->op()->properties();
364 const Runtime::Function* fun = Runtime::FunctionForId(f); 356 const Runtime::Function* fun = Runtime::FunctionForId(f);
365 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override; 357 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
366 CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor( 358 CallDescriptor::DeoptimizationSupport deopt =
367 f, nargs, props, DeoptimizationSupportForNode(node)); 359 OperatorProperties::CanLazilyDeoptimize(node->op())
360 ? CallDescriptor::kCanDeoptimize
361 : CallDescriptor::kCannotDeoptimize;
362 CallDescriptor* desc =
363 linkage()->GetRuntimeCallDescriptor(f, nargs, props, deopt);
368 Node* ref = ExternalConstant(ExternalReference(f, isolate())); 364 Node* ref = ExternalConstant(ExternalReference(f, isolate()));
369 Node* arity = Int32Constant(nargs); 365 Node* arity = Int32Constant(nargs);
370 if (!centrystub_constant_.is_set()) { 366 if (!centrystub_constant_.is_set()) {
371 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode())); 367 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode()));
372 } 368 }
373 PatchInsertInput(node, 0, centrystub_constant_.get()); 369 PatchInsertInput(node, 0, centrystub_constant_.get());
374 PatchInsertInput(node, nargs + 1, ref); 370 PatchInsertInput(node, nargs + 1, ref);
375 PatchInsertInput(node, nargs + 2, arity); 371 PatchInsertInput(node, nargs + 2, arity);
376 PatchOperator(node, common()->Call(desc)); 372 PatchOperator(node, common()->Call(desc));
377 } 373 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); 517 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant());
522 PatchOperator(node, common()->Call(desc)); 518 PatchOperator(node, common()->Call(desc));
523 return node; 519 return node;
524 } 520 }
525 521
526 522
527 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { 523 Node* JSGenericLowering::LowerJSCallFunction(Node* node) {
528 CallParameters p = OpParameter<CallParameters>(node); 524 CallParameters p = OpParameter<CallParameters>(node);
529 CallFunctionStub stub(isolate(), p.arity - 2, p.flags); 525 CallFunctionStub stub(isolate(), p.arity - 2, p.flags);
530 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); 526 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
531 CallDescriptor* desc = linkage()->GetStubCallDescriptor( 527 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, p.arity - 1);
532 d, p.arity - 1, DeoptimizationSupportForNode(node));
533 Node* stub_code = CodeConstant(stub.GetCode()); 528 Node* stub_code = CodeConstant(stub.GetCode());
534 PatchInsertInput(node, 0, stub_code); 529 PatchInsertInput(node, 0, stub_code);
535 PatchOperator(node, common()->Call(desc)); 530 PatchOperator(node, common()->Call(desc));
536 return node; 531 return node;
537 } 532 }
538 533
539 534
540 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 535 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
541 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 536 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
542 int arity = OperatorProperties::GetValueInputCount(node->op()); 537 int arity = OperatorProperties::GetValueInputCount(node->op());
543 ReplaceWithRuntimeCall(node, function, arity); 538 ReplaceWithRuntimeCall(node, function, arity);
544 return node; 539 return node;
545 } 540 }
546 } 541 }
547 } 542 }
548 } // namespace v8::internal::compiler 543 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698