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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 11588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11599 if_fast_packed.Or(); | 11599 if_fast_packed.Or(); |
11600 if_fast_packed.If<HCompareNumericAndBranch>( | 11600 if_fast_packed.If<HCompareNumericAndBranch>( |
11601 elements_kind, Add<HConstant>(FAST_DOUBLE_ELEMENTS), Token::EQ); | 11601 elements_kind, Add<HConstant>(FAST_DOUBLE_ELEMENTS), Token::EQ); |
11602 if_fast_packed.JoinContinuation(&continuation); | 11602 if_fast_packed.JoinContinuation(&continuation); |
11603 } | 11603 } |
11604 if_not_smi.JoinContinuation(&continuation); | 11604 if_not_smi.JoinContinuation(&continuation); |
11605 return ast_context()->ReturnContinuation(&continuation, call->id()); | 11605 return ast_context()->ReturnContinuation(&continuation, call->id()); |
11606 } | 11606 } |
11607 | 11607 |
11608 | 11608 |
11609 void HOptimizedGraphBuilder::GenerateIsNonNegativeSmi(CallRuntime* call) { | |
11610 return Bailout(kInlinedRuntimeFunctionIsNonNegativeSmi); | |
11611 } | |
11612 | |
11613 | |
11614 void HOptimizedGraphBuilder::GenerateIsUndetectableObject(CallRuntime* call) { | 11609 void HOptimizedGraphBuilder::GenerateIsUndetectableObject(CallRuntime* call) { |
11615 DCHECK(call->arguments()->length() == 1); | 11610 DCHECK(call->arguments()->length() == 1); |
11616 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 11611 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
11617 HValue* value = Pop(); | 11612 HValue* value = Pop(); |
11618 HIsUndetectableAndBranch* result = New<HIsUndetectableAndBranch>(value); | 11613 HIsUndetectableAndBranch* result = New<HIsUndetectableAndBranch>(value); |
11619 return ast_context()->ReturnControl(result, call->id()); | 11614 return ast_context()->ReturnControl(result, call->id()); |
11620 } | 11615 } |
11621 | 11616 |
11622 | 11617 |
11623 void HOptimizedGraphBuilder::GenerateIsStringWrapperSafeForDefaultValueOf( | |
11624 CallRuntime* call) { | |
11625 return Bailout(kInlinedRuntimeFunctionIsStringWrapperSafeForDefaultValueOf); | |
11626 } | |
11627 | |
11628 | |
11629 // Support for construct call checks. | 11618 // Support for construct call checks. |
11630 void HOptimizedGraphBuilder::GenerateIsConstructCall(CallRuntime* call) { | 11619 void HOptimizedGraphBuilder::GenerateIsConstructCall(CallRuntime* call) { |
11631 DCHECK(call->arguments()->length() == 0); | 11620 DCHECK(call->arguments()->length() == 0); |
11632 if (function_state()->outer() != NULL) { | 11621 if (function_state()->outer() != NULL) { |
11633 // We are generating graph for inlined function. | 11622 // We are generating graph for inlined function. |
11634 HValue* value = function_state()->inlining_kind() == CONSTRUCT_CALL_RETURN | 11623 HValue* value = function_state()->inlining_kind() == CONSTRUCT_CALL_RETURN |
11635 ? graph()->GetConstantTrue() | 11624 ? graph()->GetConstantTrue() |
11636 : graph()->GetConstantFalse(); | 11625 : graph()->GetConstantFalse(); |
11637 return ast_context()->ReturnValue(value); | 11626 return ast_context()->ReturnValue(value); |
11638 } else { | 11627 } else { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11677 int argument_count = environment()-> | 11666 int argument_count = environment()-> |
11678 arguments_environment()->parameter_count() - 1; | 11667 arguments_environment()->parameter_count() - 1; |
11679 HInstruction* length = Add<HConstant>(argument_count); | 11668 HInstruction* length = Add<HConstant>(argument_count); |
11680 HInstruction* checked_key = Add<HBoundsCheck>(index, length); | 11669 HInstruction* checked_key = Add<HBoundsCheck>(index, length); |
11681 result = New<HAccessArgumentsAt>(elements, length, checked_key); | 11670 result = New<HAccessArgumentsAt>(elements, length, checked_key); |
11682 } | 11671 } |
11683 return ast_context()->ReturnInstruction(result, call->id()); | 11672 return ast_context()->ReturnInstruction(result, call->id()); |
11684 } | 11673 } |
11685 | 11674 |
11686 | 11675 |
11687 // Support for accessing the class and value fields of an object. | |
11688 void HOptimizedGraphBuilder::GenerateClassOf(CallRuntime* call) { | |
11689 // The special form detected by IsClassOfTest is detected before we get here | |
11690 // and does not cause a bailout. | |
11691 return Bailout(kInlinedRuntimeFunctionClassOf); | |
11692 } | |
11693 | |
11694 | |
11695 void HOptimizedGraphBuilder::GenerateValueOf(CallRuntime* call) { | 11676 void HOptimizedGraphBuilder::GenerateValueOf(CallRuntime* call) { |
11696 DCHECK(call->arguments()->length() == 1); | 11677 DCHECK(call->arguments()->length() == 1); |
11697 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 11678 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
11698 HValue* object = Pop(); | 11679 HValue* object = Pop(); |
11699 | 11680 |
11700 IfBuilder if_objectisvalue(this); | 11681 IfBuilder if_objectisvalue(this); |
11701 HValue* objectisvalue = if_objectisvalue.If<HHasInstanceTypeAndBranch>( | 11682 HValue* objectisvalue = if_objectisvalue.If<HHasInstanceTypeAndBranch>( |
11702 object, JS_VALUE_TYPE); | 11683 object, JS_VALUE_TYPE); |
11703 if_objectisvalue.Then(); | 11684 if_objectisvalue.Then(); |
11704 { | 11685 { |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11989 if (ast_context()->IsEffect()) { | 11970 if (ast_context()->IsEffect()) { |
11990 // EffectContext::ReturnValue ignores the value, so we can just pass | 11971 // EffectContext::ReturnValue ignores the value, so we can just pass |
11991 // 'undefined' (as we do not have the call result anymore). | 11972 // 'undefined' (as we do not have the call result anymore). |
11992 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); | 11973 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
11993 } else { | 11974 } else { |
11994 return ast_context()->ReturnValue(Pop()); | 11975 return ast_context()->ReturnValue(Pop()); |
11995 } | 11976 } |
11996 } | 11977 } |
11997 | 11978 |
11998 | 11979 |
11999 void HOptimizedGraphBuilder::GenerateDefaultConstructorCallSuper( | |
12000 CallRuntime* call) { | |
12001 return Bailout(kSuperReference); | |
12002 } | |
12003 | |
12004 | |
12005 // Fast call to math functions. | 11980 // Fast call to math functions. |
12006 void HOptimizedGraphBuilder::GenerateMathPow(CallRuntime* call) { | 11981 void HOptimizedGraphBuilder::GenerateMathPow(CallRuntime* call) { |
12007 DCHECK_EQ(2, call->arguments()->length()); | 11982 DCHECK_EQ(2, call->arguments()->length()); |
12008 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 11983 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12009 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 11984 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
12010 HValue* right = Pop(); | 11985 HValue* right = Pop(); |
12011 HValue* left = Pop(); | 11986 HValue* left = Pop(); |
12012 HInstruction* result = NewUncasted<HPower>(left, right); | 11987 HInstruction* result = NewUncasted<HPower>(left, right); |
12013 return ast_context()->ReturnInstruction(result, call->id()); | 11988 return ast_context()->ReturnInstruction(result, call->id()); |
12014 } | 11989 } |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12687 | 12662 |
12688 void HOptimizedGraphBuilder::GenerateGetCachedArrayIndex(CallRuntime* call) { | 12663 void HOptimizedGraphBuilder::GenerateGetCachedArrayIndex(CallRuntime* call) { |
12689 DCHECK(call->arguments()->length() == 1); | 12664 DCHECK(call->arguments()->length() == 1); |
12690 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12665 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12691 HValue* value = Pop(); | 12666 HValue* value = Pop(); |
12692 HGetCachedArrayIndex* result = New<HGetCachedArrayIndex>(value); | 12667 HGetCachedArrayIndex* result = New<HGetCachedArrayIndex>(value); |
12693 return ast_context()->ReturnInstruction(result, call->id()); | 12668 return ast_context()->ReturnInstruction(result, call->id()); |
12694 } | 12669 } |
12695 | 12670 |
12696 | 12671 |
12697 void HOptimizedGraphBuilder::GenerateFastOneByteArrayJoin(CallRuntime* call) { | |
12698 return Bailout(kInlinedRuntimeFunctionFastOneByteArrayJoin); | |
12699 } | |
12700 | |
12701 | |
12702 // Support for generators. | |
12703 void HOptimizedGraphBuilder::GenerateGeneratorNext(CallRuntime* call) { | |
Michael Starzinger
2015/03/10 13:52:15
For posterity: These two might cause troubles, as
| |
12704 return Bailout(kInlinedRuntimeFunctionGeneratorNext); | |
12705 } | |
12706 | |
12707 | |
12708 void HOptimizedGraphBuilder::GenerateGeneratorThrow(CallRuntime* call) { | |
12709 return Bailout(kInlinedRuntimeFunctionGeneratorThrow); | |
12710 } | |
12711 | |
12712 | |
12713 void HOptimizedGraphBuilder::GenerateDebugBreakInOptimizedCode( | 12672 void HOptimizedGraphBuilder::GenerateDebugBreakInOptimizedCode( |
12714 CallRuntime* call) { | 12673 CallRuntime* call) { |
12715 Add<HDebugBreak>(); | 12674 Add<HDebugBreak>(); |
12716 return ast_context()->ReturnValue(graph()->GetConstant0()); | 12675 return ast_context()->ReturnValue(graph()->GetConstant0()); |
12717 } | 12676 } |
12718 | 12677 |
12719 | 12678 |
12720 void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) { | 12679 void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) { |
12721 DCHECK(call->arguments()->length() == 0); | 12680 DCHECK(call->arguments()->length() == 0); |
12722 HValue* ref = | 12681 HValue* ref = |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13404 if (ShouldProduceTraceOutput()) { | 13363 if (ShouldProduceTraceOutput()) { |
13405 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13364 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13406 } | 13365 } |
13407 | 13366 |
13408 #ifdef DEBUG | 13367 #ifdef DEBUG |
13409 graph_->Verify(false); // No full verify. | 13368 graph_->Verify(false); // No full verify. |
13410 #endif | 13369 #endif |
13411 } | 13370 } |
13412 | 13371 |
13413 } } // namespace v8::internal | 13372 } } // namespace v8::internal |
OLD | NEW |