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

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

Issue 981243002: [turbofan] Introduce JSStackCheck operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 9 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
« no previous file with comments | « src/compiler/ast-graph-builder.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-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-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 node->InsertInput(zone(), 0, stub_code); 473 node->InsertInput(zone(), 0, stub_code);
474 node->set_op(common()->Call(desc)); 474 node->set_op(common()->Call(desc));
475 } 475 }
476 476
477 477
478 void JSGenericLowering::LowerJSCallRuntime(Node* node) { 478 void JSGenericLowering::LowerJSCallRuntime(Node* node) {
479 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); 479 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op());
480 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); 480 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity()));
481 } 481 }
482 482
483
484 void JSGenericLowering::LowerJSStackCheck(Node* node) {
485 Node* effect = NodeProperties::GetEffectInput(node);
486 Node* control = NodeProperties::GetControlInput(node);
487
488 Node* limit = graph()->NewNode(
489 machine()->Load(kMachPtr),
490 jsgraph()->ExternalConstant(
491 ExternalReference::address_of_stack_limit(isolate())),
492 jsgraph()->IntPtrConstant(0), effect, control);
493 Node* pointer = graph()->NewNode(machine()->LoadStackPointer());
494
495 Node* check = graph()->NewNode(machine()->UintLessThan(), limit, pointer);
496 Node* branch =
497 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
498
499 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
500 Node* etrue = effect;
501
502 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
503 NodeProperties::ReplaceControlInput(node, if_false);
504 Node* efalse = node;
505
506 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
507 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
508
509 // Relax controls of {node}, i.e. make it free floating.
510 NodeProperties::ReplaceWithValue(node, node, ephi, merge);
511 NodeProperties::ReplaceEffectInput(ephi, efalse, 1);
512
513 // Turn the stack check into a runtime call.
514 ReplaceWithRuntimeCall(node, Runtime::kStackGuard);
515 }
516
483 } // namespace compiler 517 } // namespace compiler
484 } // namespace internal 518 } // namespace internal
485 } // namespace v8 519 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698