| 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 12618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12629 if_fast_packed.Or(); | 12629 if_fast_packed.Or(); |
| 12630 if_fast_packed.If<HCompareNumericAndBranch>( | 12630 if_fast_packed.If<HCompareNumericAndBranch>( |
| 12631 elements_kind, Add<HConstant>(FAST_DOUBLE_ELEMENTS), Token::EQ); | 12631 elements_kind, Add<HConstant>(FAST_DOUBLE_ELEMENTS), Token::EQ); |
| 12632 if_fast_packed.JoinContinuation(&continuation); | 12632 if_fast_packed.JoinContinuation(&continuation); |
| 12633 } | 12633 } |
| 12634 if_not_smi.JoinContinuation(&continuation); | 12634 if_not_smi.JoinContinuation(&continuation); |
| 12635 return ast_context()->ReturnContinuation(&continuation, call->id()); | 12635 return ast_context()->ReturnContinuation(&continuation, call->id()); |
| 12636 } | 12636 } |
| 12637 | 12637 |
| 12638 | 12638 |
| 12639 void HOptimizedGraphBuilder::GenerateValueOf(CallRuntime* call) { | |
| 12640 DCHECK(call->arguments()->length() == 1); | |
| 12641 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
| 12642 HValue* object = Pop(); | |
| 12643 | |
| 12644 IfBuilder if_objectisvalue(this); | |
| 12645 HValue* objectisvalue = if_objectisvalue.If<HHasInstanceTypeAndBranch>( | |
| 12646 object, JS_VALUE_TYPE); | |
| 12647 if_objectisvalue.Then(); | |
| 12648 { | |
| 12649 // Return the actual value. | |
| 12650 Push(Add<HLoadNamedField>( | |
| 12651 object, objectisvalue, | |
| 12652 HObjectAccess::ForObservableJSObjectOffset( | |
| 12653 JSValue::kValueOffset))); | |
| 12654 Add<HSimulate>(call->id(), FIXED_SIMULATE); | |
| 12655 } | |
| 12656 if_objectisvalue.Else(); | |
| 12657 { | |
| 12658 // If the object is not a value return the object. | |
| 12659 Push(object); | |
| 12660 Add<HSimulate>(call->id(), FIXED_SIMULATE); | |
| 12661 } | |
| 12662 if_objectisvalue.End(); | |
| 12663 return ast_context()->ReturnValue(Pop()); | |
| 12664 } | |
| 12665 | |
| 12666 | |
| 12667 // Fast support for charCodeAt(n). | 12639 // Fast support for charCodeAt(n). |
| 12668 void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { | 12640 void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { |
| 12669 DCHECK(call->arguments()->length() == 2); | 12641 DCHECK(call->arguments()->length() == 2); |
| 12670 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12642 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12671 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 12643 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
| 12672 HValue* index = Pop(); | 12644 HValue* index = Pop(); |
| 12673 HValue* string = Pop(); | 12645 HValue* string = Pop(); |
| 12674 HInstruction* result = BuildStringCharCodeAt(string, index); | 12646 HInstruction* result = BuildStringCharCodeAt(string, index); |
| 12675 return ast_context()->ReturnInstruction(result, call->id()); | 12647 return ast_context()->ReturnInstruction(result, call->id()); |
| 12676 } | 12648 } |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13655 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13627 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13656 } | 13628 } |
| 13657 | 13629 |
| 13658 #ifdef DEBUG | 13630 #ifdef DEBUG |
| 13659 graph_->Verify(false); // No full verify. | 13631 graph_->Verify(false); // No full verify. |
| 13660 #endif | 13632 #endif |
| 13661 } | 13633 } |
| 13662 | 13634 |
| 13663 } // namespace internal | 13635 } // namespace internal |
| 13664 } // namespace v8 | 13636 } // namespace v8 |
| OLD | NEW |