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/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 } | 2561 } |
2562 | 2562 |
2563 | 2563 |
2564 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { | 2564 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
2565 // Handle calls to runtime functions implemented in JavaScript separately as | 2565 // Handle calls to runtime functions implemented in JavaScript separately as |
2566 // the call follows JavaScript ABI and the callee is statically unknown. | 2566 // the call follows JavaScript ABI and the callee is statically unknown. |
2567 if (expr->is_jsruntime()) { | 2567 if (expr->is_jsruntime()) { |
2568 return VisitCallJSRuntime(expr); | 2568 return VisitCallJSRuntime(expr); |
2569 } | 2569 } |
2570 | 2570 |
2571 const Runtime::Function* function = expr->function(); | |
2572 | |
2573 // TODO(mstarzinger): This bailout is a gigantic hack, the owner is ashamed. | |
2574 if (function->function_id == Runtime::kInlineGeneratorNext || | |
2575 function->function_id == Runtime::kInlineGeneratorReturn || | |
2576 function->function_id == Runtime::kInlineGeneratorThrow) { | |
2577 ast_context()->ProduceValue(jsgraph()->TheHoleConstant()); | |
2578 return SetStackOverflow(); | |
2579 } | |
2580 | |
2581 // Evaluate all arguments to the runtime call. | 2571 // Evaluate all arguments to the runtime call. |
2582 ZoneList<Expression*>* args = expr->arguments(); | 2572 ZoneList<Expression*>* args = expr->arguments(); |
2583 VisitForValues(args); | 2573 VisitForValues(args); |
2584 | 2574 |
2585 // Create node to perform the runtime call. | 2575 // Create node to perform the runtime call. |
2586 Runtime::FunctionId functionId = function->function_id; | 2576 Runtime::FunctionId functionId = expr->function()->function_id; |
2587 const Operator* call = javascript()->CallRuntime(functionId, args->length()); | 2577 const Operator* call = javascript()->CallRuntime(functionId, args->length()); |
2588 FrameStateBeforeAndAfter states(this, expr->CallId()); | 2578 FrameStateBeforeAndAfter states(this, expr->CallId()); |
2589 Node* value = ProcessArguments(call, args->length()); | 2579 Node* value = ProcessArguments(call, args->length()); |
2590 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); | 2580 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); |
2591 ast_context()->ProduceValue(value); | 2581 ast_context()->ProduceValue(value); |
2592 } | 2582 } |
2593 | 2583 |
2594 | 2584 |
2595 void AstGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { | 2585 void AstGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { |
2596 switch (expr->op()) { | 2586 switch (expr->op()) { |
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4382 // Phi does not exist yet, introduce one. | 4372 // Phi does not exist yet, introduce one. |
4383 value = NewPhi(inputs, value, control); | 4373 value = NewPhi(inputs, value, control); |
4384 value->ReplaceInput(inputs - 1, other); | 4374 value->ReplaceInput(inputs - 1, other); |
4385 } | 4375 } |
4386 return value; | 4376 return value; |
4387 } | 4377 } |
4388 | 4378 |
4389 } // namespace compiler | 4379 } // namespace compiler |
4390 } // namespace internal | 4380 } // namespace internal |
4391 } // namespace v8 | 4381 } // namespace v8 |
OLD | NEW |