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 4937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4948 if (context == NULL) { | 4948 if (context == NULL) { |
4949 // Not an inlined return, so an actual one. | 4949 // Not an inlined return, so an actual one. |
4950 CHECK_ALIVE(VisitForValue(stmt->expression())); | 4950 CHECK_ALIVE(VisitForValue(stmt->expression())); |
4951 HValue* result = environment()->Pop(); | 4951 HValue* result = environment()->Pop(); |
4952 Add<HReturn>(result); | 4952 Add<HReturn>(result); |
4953 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { | 4953 } else if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { |
4954 // Return from an inlined construct call. In a test context the return value | 4954 // Return from an inlined construct call. In a test context the return value |
4955 // will always evaluate to true, in a value context the return value needs | 4955 // will always evaluate to true, in a value context the return value needs |
4956 // to be a JSObject. | 4956 // to be a JSObject. |
4957 if (context->IsTest()) { | 4957 if (context->IsTest()) { |
4958 TestContext* test = TestContext::cast(context); | |
4959 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4958 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
4960 Goto(test->if_true(), state); | 4959 context->ReturnValue(graph()->GetConstantTrue()); |
4961 } else if (context->IsEffect()) { | 4960 } else if (context->IsEffect()) { |
4962 CHECK_ALIVE(VisitForEffect(stmt->expression())); | 4961 CHECK_ALIVE(VisitForEffect(stmt->expression())); |
4963 Goto(function_return(), state); | 4962 Goto(function_return(), state); |
4964 } else { | 4963 } else { |
4965 DCHECK(context->IsValue()); | 4964 DCHECK(context->IsValue()); |
4966 CHECK_ALIVE(VisitForValue(stmt->expression())); | 4965 CHECK_ALIVE(VisitForValue(stmt->expression())); |
4967 HValue* return_value = Pop(); | 4966 HValue* return_value = Pop(); |
4968 HValue* receiver = environment()->arguments_environment()->Lookup(0); | 4967 HValue* receiver = environment()->arguments_environment()->Lookup(0); |
4969 HHasInstanceTypeAndBranch* typecheck = | 4968 HHasInstanceTypeAndBranch* typecheck = |
4970 New<HHasInstanceTypeAndBranch>(return_value, | 4969 New<HHasInstanceTypeAndBranch>(return_value, |
(...skipping 3553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8524 | 8523 |
8525 TraceInline(target, caller, NULL); | 8524 TraceInline(target, caller, NULL); |
8526 | 8525 |
8527 if (current_block() != NULL) { | 8526 if (current_block() != NULL) { |
8528 FunctionState* state = function_state(); | 8527 FunctionState* state = function_state(); |
8529 if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { | 8528 if (state->inlining_kind() == CONSTRUCT_CALL_RETURN) { |
8530 // Falling off the end of an inlined construct call. In a test context the | 8529 // Falling off the end of an inlined construct call. In a test context the |
8531 // return value will always evaluate to true, in a value context the | 8530 // return value will always evaluate to true, in a value context the |
8532 // return value is the newly allocated receiver. | 8531 // return value is the newly allocated receiver. |
8533 if (call_context()->IsTest()) { | 8532 if (call_context()->IsTest()) { |
8534 Goto(inlined_test_context()->if_true(), state); | 8533 inlined_test_context()->ReturnValue(graph()->GetConstantTrue()); |
8535 } else if (call_context()->IsEffect()) { | 8534 } else if (call_context()->IsEffect()) { |
8536 Goto(function_return(), state); | 8535 Goto(function_return(), state); |
8537 } else { | 8536 } else { |
8538 DCHECK(call_context()->IsValue()); | 8537 DCHECK(call_context()->IsValue()); |
8539 AddLeaveInlined(implicit_return_value, state); | 8538 AddLeaveInlined(implicit_return_value, state); |
8540 } | 8539 } |
8541 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { | 8540 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { |
8542 // Falling off the end of an inlined setter call. The returned value is | 8541 // Falling off the end of an inlined setter call. The returned value is |
8543 // never used, the value of an assignment is always the value of the RHS | 8542 // never used, the value of an assignment is always the value of the RHS |
8544 // of the assignment. | 8543 // of the assignment. |
8545 if (call_context()->IsTest()) { | 8544 if (call_context()->IsTest()) { |
8546 inlined_test_context()->ReturnValue(implicit_return_value); | 8545 inlined_test_context()->ReturnValue(implicit_return_value); |
8547 } else if (call_context()->IsEffect()) { | 8546 } else if (call_context()->IsEffect()) { |
8548 Goto(function_return(), state); | 8547 Goto(function_return(), state); |
8549 } else { | 8548 } else { |
8550 DCHECK(call_context()->IsValue()); | 8549 DCHECK(call_context()->IsValue()); |
8551 AddLeaveInlined(implicit_return_value, state); | 8550 AddLeaveInlined(implicit_return_value, state); |
8552 } | 8551 } |
8553 } else { | 8552 } else { |
8554 // Falling off the end of a normal inlined function. This basically means | 8553 // Falling off the end of a normal inlined function. This basically means |
8555 // returning undefined. | 8554 // returning undefined. |
8556 if (call_context()->IsTest()) { | 8555 if (call_context()->IsTest()) { |
8557 Goto(inlined_test_context()->if_false(), state); | 8556 inlined_test_context()->ReturnValue(graph()->GetConstantFalse()); |
8558 } else if (call_context()->IsEffect()) { | 8557 } else if (call_context()->IsEffect()) { |
8559 Goto(function_return(), state); | 8558 Goto(function_return(), state); |
8560 } else { | 8559 } else { |
8561 DCHECK(call_context()->IsValue()); | 8560 DCHECK(call_context()->IsValue()); |
8562 AddLeaveInlined(undefined, state); | 8561 AddLeaveInlined(undefined, state); |
8563 } | 8562 } |
8564 } | 8563 } |
8565 } | 8564 } |
8566 | 8565 |
8567 // Fix up the function exits. | 8566 // Fix up the function exits. |
(...skipping 5021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13589 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13588 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13590 } | 13589 } |
13591 | 13590 |
13592 #ifdef DEBUG | 13591 #ifdef DEBUG |
13593 graph_->Verify(false); // No full verify. | 13592 graph_->Verify(false); // No full verify. |
13594 #endif | 13593 #endif |
13595 } | 13594 } |
13596 | 13595 |
13597 } // namespace internal | 13596 } // namespace internal |
13598 } // namespace v8 | 13597 } // namespace v8 |
OLD | NEW |