OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 4906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4917 if (context == NULL) { | 4917 if (context == NULL) { |
4918 // Not an inlined return, so an actual one. | 4918 // Not an inlined return, so an actual one. |
4919 CHECK_ALIVE(VisitForValue(stmt->expression())); | 4919 CHECK_ALIVE(VisitForValue(stmt->expression())); |
4920 HValue* result = environment()->Pop(); | 4920 HValue* result = environment()->Pop(); |
4921 Add<HReturn>(result); | 4921 Add<HReturn>(result); |
4922 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { | 4922 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { |
4923 // Return from an inlined construct call. In a test context the return value | 4923 // Return from an inlined construct call. In a test context the return value |
4924 // will always evaluate to true, in a value context the return value needs | 4924 // will always evaluate to true, in a value context the return value needs |
4925 // to be a JSObject. | 4925 // to be a JSObject. |
4926 if (context->IsTest()) { | 4926 if (context->IsTest()) { |
4927 TestContext* test = TestContext::cast(context); | |
4928 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4927 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
4929 Goto(test->if_true(), state); | 4928 context->ReturnValue(graph()->GetConstantTrue()); |
4930 } else if (context->IsEffect()) { | 4929 } else if (context->IsEffect()) { |
4931 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4930 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
4932 Goto(function_return(), state); | 4931 Goto(function_return(), state); |
4933 } else { | 4932 } else { |
4934 DCHECK(context->IsValue()); | 4933 DCHECK(context->IsValue()); |
4935 CHECK_ALIVE(VisitForValue(stmt->expression())); | 4934 CHECK_ALIVE(VisitForValue(stmt->expression())); |
4936 HValue* return_value = Pop(); | 4935 HValue* return_value = Pop(); |
4937 HValue* receiver = environment()->arguments_environment()->Lookup(0); | 4936 HValue* receiver = environment()->arguments_environment()->Lookup(0); |
4938 HHasInstanceTypeAndBranch* typecheck = | 4937 HHasInstanceTypeAndBranch* typecheck = |
4939 New<HHasInstanceTypeAndBranch>(return_value, | 4938 New<HHasInstanceTypeAndBranch>(return_value, |
(...skipping 3617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8557 | 8556 |
8558 TraceInline(target, caller, NULL, syntactic_tail_call_mode); | 8557 TraceInline(target, caller, NULL, syntactic_tail_call_mode); |
8559 | 8558 |
8560 if (current_block() != NULL) { | 8559 if (current_block() != NULL) { |
8561 FunctionState* state = function_state(); | 8560 FunctionState* state = function_state(); |
8562 if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { | 8561 if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { |
8563 // Falling off the end of an inlined construct call. In a test context the | 8562 // Falling off the end of an inlined construct call. In a test context the |
8564 // return value will always evaluate to true, in a value context the | 8563 // return value will always evaluate to true, in a value context the |
8565 // return value is the newly allocated receiver. | 8564 // return value is the newly allocated receiver. |
8566 if (call_context()->IsTest()) { | 8565 if (call_context()->IsTest()) { |
8567 Goto(inlined_test_context()->if_true(), state); | 8566 inlined_test_context()->ReturnValue(graph()->GetConstantTrue()); |
8568 } else if (call_context()->IsEffect()) { | 8567 } else if (call_context()->IsEffect()) { |
8569 Goto(function_return(), state); | 8568 Goto(function_return(), state); |
8570 } else { | 8569 } else { |
8571 DCHECK(call_context()->IsValue()); | 8570 DCHECK(call_context()->IsValue()); |
8572 AddLeaveInlined(implicit_return_value, state); | 8571 AddLeaveInlined(implicit_return_value, state); |
8573 } | 8572 } |
8574 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { | 8573 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { |
8575 // Falling off the end of an inlined setter call. The returned value is | 8574 // Falling off the end of an inlined setter call. The returned value is |
8576 // never used, the value of an assignment is always the value of the RHS | 8575 // never used, the value of an assignment is always the value of the RHS |
8577 // of the assignment. | 8576 // of the assignment. |
8578 if (call_context()->IsTest()) { | 8577 if (call_context()->IsTest()) { |
8579 inlined_test_context()->ReturnValue(implicit_return_value); | 8578 inlined_test_context()->ReturnValue(implicit_return_value); |
8580 } else if (call_context()->IsEffect()) { | 8579 } else if (call_context()->IsEffect()) { |
8581 Goto(function_return(), state); | 8580 Goto(function_return(), state); |
8582 } else { | 8581 } else { |
8583 DCHECK(call_context()->IsValue()); | 8582 DCHECK(call_context()->IsValue()); |
8584 AddLeaveInlined(implicit_return_value, state); | 8583 AddLeaveInlined(implicit_return_value, state); |
8585 } | 8584 } |
8586 } else { | 8585 } else { |
8587 // Falling off the end of a normal inlined function. This basically means | 8586 // Falling off the end of a normal inlined function. This basically means |
8588 // returning undefined. | 8587 // returning undefined. |
8589 if (call_context()->IsTest()) { | 8588 if (call_context()->IsTest()) { |
8590 Goto(inlined_test_context()->if_false(), state); | 8589 inlined_test_context()->ReturnValue(graph()->GetConstantFalse()); |
8591 } else if (call_context()->IsEffect()) { | 8590 } else if (call_context()->IsEffect()) { |
8592 Goto(function_return(), state); | 8591 Goto(function_return(), state); |
8593 } else { | 8592 } else { |
8594 DCHECK(call_context()->IsValue()); | 8593 DCHECK(call_context()->IsValue()); |
8595 AddLeaveInlined(undefined, state); | 8594 AddLeaveInlined(undefined, state); |
8596 } | 8595 } |
8597 } | 8596 } |
8598 } | 8597 } |
8599 | 8598 |
8600 // Fix up the function exits. | 8599 // Fix up the function exits. |
(...skipping 4894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13495 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13494 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13496 } | 13495 } |
13497 | 13496 |
13498 #ifdef DEBUG | 13497 #ifdef DEBUG |
13499 graph_->Verify(false); // No full verify. | 13498 graph_->Verify(false); // No full verify. |
13500 #endif | 13499 #endif |
13501 } | 13500 } |
13502 | 13501 |
13503 } // namespace internal | 13502 } // namespace internal |
13504 } // namespace v8 | 13503 } // namespace v8 |
OLD | NEW |