Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: src/hydrogen.cc

Issue 23198002: Fix Crankshafted CompareNil of constant values (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/constant-compare-nil-value.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 } 1741 }
1742 1742
1743 1743
1744 void HGraphBuilder::BuildCompareNil( 1744 void HGraphBuilder::BuildCompareNil(
1745 HValue* value, 1745 HValue* value,
1746 Handle<Type> type, 1746 Handle<Type> type,
1747 int position, 1747 int position,
1748 HIfContinuation* continuation) { 1748 HIfContinuation* continuation) {
1749 IfBuilder if_nil(this, position); 1749 IfBuilder if_nil(this, position);
1750 bool needs_or = false; 1750 bool needs_or = false;
1751 if (type->Maybe(Type::Null())) { 1751 if (value->IsConstant()) {
1752 if (needs_or) if_nil.Or(); 1752 bool is_null = false;
1753 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); 1753 HConstant* constant_value = HConstant::cast(value);
1754 needs_or = true; 1754 if (!constant_value->HasNumberValue()) {
1755 } 1755 Object* constant_object = *(constant_value->handle());
Jakob Kummerow 2013/08/14 15:45:20 nit: let's just keep this handlified, i.e.: Handle
1756 if (type->Maybe(Type::Undefined())) { 1756 is_null = constant_object->IsNull() ||
1757 if (needs_or) if_nil.Or(); 1757 constant_object->IsUndefined() ||
1758 if_nil.If<HCompareObjectEqAndBranch>(value, 1758 constant_object->IsUndetectableObject();
1759 graph()->GetConstantUndefined()); 1759 }
1760 needs_or = true; 1760 constant_value = is_null
1761 } 1761 ? graph()->GetConstantTrue()
1762 if (type->Maybe(Type::Undetectable())) { 1762 : graph()->GetConstantFalse();
1763 if (needs_or) if_nil.Or(); 1763 if_nil.If<HCompareObjectEqAndBranch>(constant_value,
1764 if_nil.If<HIsUndetectableAndBranch>(value); 1764 graph()->GetConstantTrue());
1765 } else { 1765 } else {
1766 if_nil.Then(); 1766 if (type->Maybe(Type::Null())) {
1767 if_nil.Else(); 1767 if (needs_or) if_nil.Or();
1768 if (type->NumClasses() == 1) { 1768 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull());
1769 BuildCheckHeapObject(value); 1769 needs_or = true;
1770 // For ICs, the map checked below is a sentinel map that gets replaced by 1770 }
1771 // the monomorphic map when the code is used as a template to generate a 1771 if (type->Maybe(Type::Undefined())) {
1772 // new IC. For optimized functions, there is no sentinel map, the map 1772 if (needs_or) if_nil.Or();
1773 // emitted below is the actual monomorphic map. 1773 if_nil.If<HCompareObjectEqAndBranch>(value,
1774 BuildCheckMap(value, type->Classes().Current()); 1774 graph()->GetConstantUndefined());
1775 needs_or = true;
1776 }
1777 if (type->Maybe(Type::Undetectable())) {
1778 if (needs_or) if_nil.Or();
1779 if_nil.If<HIsUndetectableAndBranch>(value);
1775 } else { 1780 } else {
1776 if_nil.Deopt("Too many undetectable types"); 1781 if_nil.Then();
1782 if_nil.Else();
1783 if (type->NumClasses() == 1) {
1784 BuildCheckHeapObject(value);
1785 // For ICs, the map checked below is a sentinel map that gets replaced
1786 // by the monomorphic map when the code is used as a template to
1787 // generate a new IC. For optimized functions, there is no sentinel map,
1788 // the map emitted below is the actual monomorphic map.
1789 BuildCheckMap(value, type->Classes().Current());
1790 } else {
1791 if_nil.Deopt("Too many undetectable types");
1792 }
1777 } 1793 }
1778 } 1794 }
1779 1795
1780 if_nil.CaptureContinuation(continuation); 1796 if_nil.CaptureContinuation(continuation);
1781 } 1797 }
1782 1798
1783 1799
1784 HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object, 1800 HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object,
1785 int previous_object_size, 1801 int previous_object_size,
1786 HValue* alloc_site) { 1802 HValue* alloc_site) {
(...skipping 8056 matching lines...) Expand 10 before | Expand all | Expand 10 after
9843 if (ShouldProduceTraceOutput()) { 9859 if (ShouldProduceTraceOutput()) {
9844 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9860 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9845 } 9861 }
9846 9862
9847 #ifdef DEBUG 9863 #ifdef DEBUG
9848 graph_->Verify(false); // No full verify. 9864 graph_->Verify(false); // No full verify.
9849 #endif 9865 #endif
9850 } 9866 }
9851 9867
9852 } } // namespace v8::internal 9868 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/constant-compare-nil-value.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698