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

Side by Side Diff: src/compiler/ast-graph-builder.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.h ('k') | src/compiler/js-generic-lowering.cc » ('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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 501
502 // Visit implicit declaration of the function name. 502 // Visit implicit declaration of the function name.
503 if (scope->is_function_scope() && scope->function() != NULL) { 503 if (scope->is_function_scope() && scope->function() != NULL) {
504 VisitVariableDeclaration(scope->function()); 504 VisitVariableDeclaration(scope->function());
505 } 505 }
506 506
507 // Visit declarations within the function scope. 507 // Visit declarations within the function scope.
508 VisitDeclarations(scope->declarations()); 508 VisitDeclarations(scope->declarations());
509 509
510 // Build a stack-check before the body. 510 // Build a stack-check before the body.
511 Node* node = BuildStackCheck(); 511 Node* node = NewNode(javascript()->StackCheck());
512 PrepareFrameState(node, BailoutId::FunctionEntry()); 512 PrepareFrameState(node, BailoutId::FunctionEntry());
513 513
514 // Visit statements in the function body. 514 // Visit statements in the function body.
515 VisitStatements(info()->function()->body()); 515 VisitStatements(info()->function()->body());
516 516
517 // Emit tracing call if requested to do so. 517 // Emit tracing call if requested to do so.
518 if (FLAG_trace) { 518 if (FLAG_trace) {
519 // TODO(mstarzinger): Only traces implicit return. 519 // TODO(mstarzinger): Only traces implicit return.
520 Node* return_value = jsgraph()->UndefinedConstant(); 520 Node* return_value = jsgraph()->UndefinedConstant();
521 NewNode(javascript()->CallRuntime(Runtime::kTraceExit, 1), return_value); 521 NewNode(javascript()->CallRuntime(Runtime::kTraceExit, 1), return_value);
(...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2958 js_op = javascript()->Modulus(); 2958 js_op = javascript()->Modulus();
2959 break; 2959 break;
2960 default: 2960 default:
2961 UNREACHABLE(); 2961 UNREACHABLE();
2962 js_op = NULL; 2962 js_op = NULL;
2963 } 2963 }
2964 return NewNode(js_op, left, right); 2964 return NewNode(js_op, left, right);
2965 } 2965 }
2966 2966
2967 2967
2968 Node* AstGraphBuilder::BuildStackCheck() {
2969 IfBuilder stack_check(this);
2970 Node* limit = BuildLoadExternal(
2971 ExternalReference::address_of_stack_limit(isolate()), kMachPtr);
2972 Node* stack = NewNode(jsgraph()->machine()->LoadStackPointer());
2973 Node* tag = NewNode(jsgraph()->machine()->UintLessThan(), limit, stack);
2974 stack_check.If(tag, BranchHint::kTrue);
2975 stack_check.Then();
2976 stack_check.Else();
2977 Node* guard = NewNode(javascript()->CallRuntime(Runtime::kStackGuard, 0));
2978 stack_check.End();
2979 return guard;
2980 }
2981
2982
2983 bool AstGraphBuilder::CheckOsrEntry(IterationStatement* stmt) { 2968 bool AstGraphBuilder::CheckOsrEntry(IterationStatement* stmt) {
2984 if (info()->osr_ast_id() == stmt->OsrEntryId()) { 2969 if (info()->osr_ast_id() == stmt->OsrEntryId()) {
2985 info()->set_osr_expr_stack_height(std::max( 2970 info()->set_osr_expr_stack_height(std::max(
2986 environment()->stack_height(), info()->osr_expr_stack_height())); 2971 environment()->stack_height(), info()->osr_expr_stack_height()));
2987 return true; 2972 return true;
2988 } 2973 }
2989 return false; 2974 return false;
2990 } 2975 }
2991 2976
2992 2977
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
3282 // Phi does not exist yet, introduce one. 3267 // Phi does not exist yet, introduce one.
3283 value = NewPhi(inputs, value, control); 3268 value = NewPhi(inputs, value, control);
3284 value->ReplaceInput(inputs - 1, other); 3269 value->ReplaceInput(inputs - 1, other);
3285 } 3270 }
3286 return value; 3271 return value;
3287 } 3272 }
3288 3273
3289 } // namespace compiler 3274 } // namespace compiler
3290 } // namespace internal 3275 } // namespace internal
3291 } // namespace v8 3276 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698