| OLD | NEW | 
|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1738   return object; | 1738   return object; | 
| 1739 } | 1739 } | 
| 1740 | 1740 | 
| 1741 | 1741 | 
| 1742 void HGraphBuilder::BuildCompareNil( | 1742 void HGraphBuilder::BuildCompareNil( | 
| 1743     HValue* value, | 1743     HValue* value, | 
| 1744     Handle<Type> type, | 1744     Handle<Type> type, | 
| 1745     int position, | 1745     int position, | 
| 1746     HIfContinuation* continuation) { | 1746     HIfContinuation* continuation) { | 
| 1747   IfBuilder if_nil(this, position); | 1747   IfBuilder if_nil(this, position); | 
| 1748   bool needs_or = false; | 1748   bool some_case_handled = false; | 
|  | 1749   bool some_case_missing = false; | 
|  | 1750 | 
| 1749   if (type->Maybe(Type::Null())) { | 1751   if (type->Maybe(Type::Null())) { | 
| 1750     if (needs_or) if_nil.Or(); | 1752     if (some_case_handled) if_nil.Or(); | 
| 1751     if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); | 1753     if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); | 
| 1752     needs_or = true; | 1754     some_case_handled = true; | 
|  | 1755   } else { | 
|  | 1756     some_case_missing = true; | 
| 1753   } | 1757   } | 
|  | 1758 | 
| 1754   if (type->Maybe(Type::Undefined())) { | 1759   if (type->Maybe(Type::Undefined())) { | 
| 1755     if (needs_or) if_nil.Or(); | 1760     if (some_case_handled) if_nil.Or(); | 
| 1756     if_nil.If<HCompareObjectEqAndBranch>(value, | 1761     if_nil.If<HCompareObjectEqAndBranch>(value, | 
| 1757                                          graph()->GetConstantUndefined()); | 1762                                          graph()->GetConstantUndefined()); | 
| 1758     needs_or = true; | 1763     some_case_handled = true; | 
|  | 1764   } else { | 
|  | 1765     some_case_missing = true; | 
| 1759   } | 1766   } | 
|  | 1767 | 
| 1760   if (type->Maybe(Type::Undetectable())) { | 1768   if (type->Maybe(Type::Undetectable())) { | 
| 1761     if (needs_or) if_nil.Or(); | 1769     if (some_case_handled) if_nil.Or(); | 
| 1762     if_nil.If<HIsUndetectableAndBranch>(value); | 1770     if_nil.If<HIsUndetectableAndBranch>(value); | 
|  | 1771     some_case_handled = true; | 
| 1763   } else { | 1772   } else { | 
|  | 1773     some_case_missing = true; | 
|  | 1774   } | 
|  | 1775 | 
|  | 1776   if (some_case_missing) { | 
| 1764     if_nil.Then(); | 1777     if_nil.Then(); | 
| 1765     if_nil.Else(); | 1778     if_nil.Else(); | 
| 1766     if (type->NumClasses() == 1) { | 1779     if (type->NumClasses() == 1) { | 
| 1767       BuildCheckHeapObject(value); | 1780       BuildCheckHeapObject(value); | 
| 1768       // For ICs, the map checked below is a sentinel map that gets replaced by | 1781       // For ICs, the map checked below is a sentinel map that gets replaced by | 
| 1769       // the monomorphic map when the code is used as a template to generate a | 1782       // the monomorphic map when the code is used as a template to generate a | 
| 1770       // new IC. For optimized functions, there is no sentinel map, the map | 1783       // new IC. For optimized functions, there is no sentinel map, the map | 
| 1771       // emitted below is the actual monomorphic map. | 1784       // emitted below is the actual monomorphic map. | 
| 1772       BuildCheckMap(value, type->Classes().Current()); | 1785       BuildCheckMap(value, type->Classes().Current()); | 
| 1773     } else { | 1786     } else { | 
| (...skipping 6428 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8202 | 8215 | 
| 8203 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, | 8216 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, | 
| 8204                                                      Expression* sub_expr, | 8217                                                      Expression* sub_expr, | 
| 8205                                                      NilValue nil) { | 8218                                                      NilValue nil) { | 
| 8206   ASSERT(!HasStackOverflow()); | 8219   ASSERT(!HasStackOverflow()); | 
| 8207   ASSERT(current_block() != NULL); | 8220   ASSERT(current_block() != NULL); | 
| 8208   ASSERT(current_block()->HasPredecessor()); | 8221   ASSERT(current_block()->HasPredecessor()); | 
| 8209   ASSERT(expr->op() == Token::EQ || expr->op() == Token::EQ_STRICT); | 8222   ASSERT(expr->op() == Token::EQ || expr->op() == Token::EQ_STRICT); | 
| 8210   CHECK_ALIVE(VisitForValue(sub_expr)); | 8223   CHECK_ALIVE(VisitForValue(sub_expr)); | 
| 8211   HValue* value = Pop(); | 8224   HValue* value = Pop(); | 
| 8212   HIfContinuation continuation; |  | 
| 8213   if (expr->op() == Token::EQ_STRICT) { | 8225   if (expr->op() == Token::EQ_STRICT) { | 
| 8214     IfBuilder if_nil(this); | 8226     HConstant* nil_constant = nil == kNullValue | 
| 8215     if_nil.If<HCompareObjectEqAndBranch>( | 8227         ? graph()->GetConstantNull() | 
| 8216         value, (nil == kNullValue) ? graph()->GetConstantNull() | 8228         : graph()->GetConstantUndefined(); | 
| 8217                                    : graph()->GetConstantUndefined()); | 8229     HCompareObjectEqAndBranch* instr = | 
| 8218     if_nil.Then(); | 8230         New<HCompareObjectEqAndBranch>(value, nil_constant); | 
| 8219     if_nil.Else(); | 8231     instr->set_position(expr->position()); | 
| 8220     if_nil.CaptureContinuation(&continuation); | 8232     return ast_context()->ReturnControl(instr, expr->id()); | 
|  | 8233   } else { | 
|  | 8234     ASSERT_EQ(Token::EQ, expr->op()); | 
|  | 8235     Handle<Type> type = expr->combined_type()->Is(Type::None()) | 
|  | 8236         ? handle(Type::Any(), isolate_) | 
|  | 8237         : expr->combined_type(); | 
|  | 8238     HIfContinuation continuation; | 
|  | 8239     BuildCompareNil(value, type, expr->position(), &continuation); | 
| 8221     return ast_context()->ReturnContinuation(&continuation, expr->id()); | 8240     return ast_context()->ReturnContinuation(&continuation, expr->id()); | 
| 8222   } | 8241   } | 
| 8223   Handle<Type> type = expr->combined_type()->Is(Type::None()) |  | 
| 8224       ? handle(Type::Any(), isolate_) : expr->combined_type(); |  | 
| 8225   BuildCompareNil(value, type, expr->position(), &continuation); |  | 
| 8226   return ast_context()->ReturnContinuation(&continuation, expr->id()); |  | 
| 8227 } | 8242 } | 
| 8228 | 8243 | 
| 8229 | 8244 | 
| 8230 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() { | 8245 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() { | 
| 8231   // If we share optimized code between different closures, the | 8246   // If we share optimized code between different closures, the | 
| 8232   // this-function is not a constant, except inside an inlined body. | 8247   // this-function is not a constant, except inside an inlined body. | 
| 8233   if (function_state()->outer() != NULL) { | 8248   if (function_state()->outer() != NULL) { | 
| 8234       return New<HConstant>( | 8249       return New<HConstant>( | 
| 8235           function_state()->compilation_info()->closure()); | 8250           function_state()->compilation_info()->closure()); | 
| 8236   } else { | 8251   } else { | 
| (...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9850   if (ShouldProduceTraceOutput()) { | 9865   if (ShouldProduceTraceOutput()) { | 
| 9851     isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9866     isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 
| 9852   } | 9867   } | 
| 9853 | 9868 | 
| 9854 #ifdef DEBUG | 9869 #ifdef DEBUG | 
| 9855   graph_->Verify(false);  // No full verify. | 9870   graph_->Verify(false);  // No full verify. | 
| 9856 #endif | 9871 #endif | 
| 9857 } | 9872 } | 
| 9858 | 9873 | 
| 9859 } }  // namespace v8::internal | 9874 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|