| 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 4938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4949 if (context == NULL) { | 4949 if (context == NULL) { |
| 4950 // Not an inlined return, so an actual one. | 4950 // Not an inlined return, so an actual one. |
| 4951 CHECK_ALIVE(VisitForValue(stmt->expression())); | 4951 CHECK_ALIVE(VisitForValue(stmt->expression())); |
| 4952 HValue* result = environment()->Pop(); | 4952 HValue* result = environment()->Pop(); |
| 4953 Add<HReturn>(result); | 4953 Add<HReturn>(result); |
| 4954 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { | 4954 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { |
| 4955 // Return from an inlined construct call. In a test context the return value | 4955 // Return from an inlined construct call. In a test context the return value |
| 4956 // will always evaluate to true, in a value context the return value needs | 4956 // will always evaluate to true, in a value context the return value needs |
| 4957 // to be a JSObject. | 4957 // to be a JSObject. |
| 4958 if (context->IsTest()) { | 4958 if (context->IsTest()) { |
| 4959 TestContext* test = TestContext::cast(context); | |
| 4960 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4959 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
| 4961 Goto(test->if_true(), state); | 4960 context->ReturnValue(graph()->GetConstantTrue()); |
| 4962 } else if (context->IsEffect()) { | 4961 } else if (context->IsEffect()) { |
| 4963 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4962 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
| 4964 Goto(function_return(), state); | 4963 Goto(function_return(), state); |
| 4965 } else { | 4964 } else { |
| 4966 DCHECK(context->IsValue()); | 4965 DCHECK(context->IsValue()); |
| 4967 CHECK_ALIVE(VisitForValue(stmt->expression())); | 4966 CHECK_ALIVE(VisitForValue(stmt->expression())); |
| 4968 HValue* return_value = Pop(); | 4967 HValue* return_value = Pop(); |
| 4969 HValue* receiver = environment()->arguments_environment()->Lookup(0); | 4968 HValue* receiver = environment()->arguments_environment()->Lookup(0); |
| 4970 HHasInstanceTypeAndBranch* typecheck = | 4969 HHasInstanceTypeAndBranch* typecheck = |
| 4971 New<HHasInstanceTypeAndBranch>(return_value, | 4970 New<HHasInstanceTypeAndBranch>(return_value, |
| (...skipping 3639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8611 | 8610 |
| 8612 TraceInline(target, caller, NULL); | 8611 TraceInline(target, caller, NULL); |
| 8613 | 8612 |
| 8614 if (current_block() != NULL) { | 8613 if (current_block() != NULL) { |
| 8615 FunctionState* state = function_state(); | 8614 FunctionState* state = function_state(); |
| 8616 if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { | 8615 if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { |
| 8617 // Falling off the end of an inlined construct call. In a test context the | 8616 // Falling off the end of an inlined construct call. In a test context the |
| 8618 // return value will always evaluate to true, in a value context the | 8617 // return value will always evaluate to true, in a value context the |
| 8619 // return value is the newly allocated receiver. | 8618 // return value is the newly allocated receiver. |
| 8620 if (call_context()->IsTest()) { | 8619 if (call_context()->IsTest()) { |
| 8621 Goto(inlined_test_context()->if_true(), state); | 8620 inlined_test_context()->ReturnValue(graph()->GetConstantTrue()); |
| 8622 } else if (call_context()->IsEffect()) { | 8621 } else if (call_context()->IsEffect()) { |
| 8623 Goto(function_return(), state); | 8622 Goto(function_return(), state); |
| 8624 } else { | 8623 } else { |
| 8625 DCHECK(call_context()->IsValue()); | 8624 DCHECK(call_context()->IsValue()); |
| 8626 AddLeaveInlined(implicit_return_value, state); | 8625 AddLeaveInlined(implicit_return_value, state); |
| 8627 } | 8626 } |
| 8628 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { | 8627 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { |
| 8629 // Falling off the end of an inlined setter call. The returned value is | 8628 // Falling off the end of an inlined setter call. The returned value is |
| 8630 // never used, the value of an assignment is always the value of the RHS | 8629 // never used, the value of an assignment is always the value of the RHS |
| 8631 // of the assignment. | 8630 // of the assignment. |
| 8632 if (call_context()->IsTest()) { | 8631 if (call_context()->IsTest()) { |
| 8633 inlined_test_context()->ReturnValue(implicit_return_value); | 8632 inlined_test_context()->ReturnValue(implicit_return_value); |
| 8634 } else if (call_context()->IsEffect()) { | 8633 } else if (call_context()->IsEffect()) { |
| 8635 Goto(function_return(), state); | 8634 Goto(function_return(), state); |
| 8636 } else { | 8635 } else { |
| 8637 DCHECK(call_context()->IsValue()); | 8636 DCHECK(call_context()->IsValue()); |
| 8638 AddLeaveInlined(implicit_return_value, state); | 8637 AddLeaveInlined(implicit_return_value, state); |
| 8639 } | 8638 } |
| 8640 } else { | 8639 } else { |
| 8641 // Falling off the end of a normal inlined function. This basically means | 8640 // Falling off the end of a normal inlined function. This basically means |
| 8642 // returning undefined. | 8641 // returning undefined. |
| 8643 if (call_context()->IsTest()) { | 8642 if (call_context()->IsTest()) { |
| 8644 Goto(inlined_test_context()->if_false(), state); | 8643 inlined_test_context()->ReturnValue(graph()->GetConstantFalse()); |
| 8645 } else if (call_context()->IsEffect()) { | 8644 } else if (call_context()->IsEffect()) { |
| 8646 Goto(function_return(), state); | 8645 Goto(function_return(), state); |
| 8647 } else { | 8646 } else { |
| 8648 DCHECK(call_context()->IsValue()); | 8647 DCHECK(call_context()->IsValue()); |
| 8649 AddLeaveInlined(undefined, state); | 8648 AddLeaveInlined(undefined, state); |
| 8650 } | 8649 } |
| 8651 } | 8650 } |
| 8652 } | 8651 } |
| 8653 | 8652 |
| 8654 // Fix up the function exits. | 8653 // Fix up the function exits. |
| (...skipping 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13523 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13522 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13524 } | 13523 } |
| 13525 | 13524 |
| 13526 #ifdef DEBUG | 13525 #ifdef DEBUG |
| 13527 graph_->Verify(false); // No full verify. | 13526 graph_->Verify(false); // No full verify. |
| 13528 #endif | 13527 #endif |
| 13529 } | 13528 } |
| 13530 | 13529 |
| 13531 } // namespace internal | 13530 } // namespace internal |
| 13532 } // namespace v8 | 13531 } // namespace v8 |
| OLD | NEW |