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

Side by Side Diff: src/hydrogen.cc

Issue 14862009: Encapsulating Type information in the CompareICStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « src/code-stubs.cc ('k') | src/ic.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 1800
1801 void HGraphBuilder::BuildCompareNil( 1801 void HGraphBuilder::BuildCompareNil(
1802 HValue* value, 1802 HValue* value,
1803 EqualityKind kind, 1803 EqualityKind kind,
1804 CompareNilICStub::Types types, 1804 CompareNilICStub::Types types,
1805 Handle<Map> map, 1805 Handle<Map> map,
1806 int position, 1806 int position,
1807 HIfContinuation* continuation) { 1807 HIfContinuation* continuation) {
1808 IfBuilder if_nil(this, position); 1808 IfBuilder if_nil(this, position);
1809 bool needs_or = false; 1809 bool needs_or = false;
1810 if ((types & CompareNilICStub::kCompareAgainstNull) != 0) { 1810 if (types.Contains(CompareNilICStub::NULL_TYPE)) {
1811 if (needs_or) if_nil.Or(); 1811 if (needs_or) if_nil.Or();
1812 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); 1812 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull());
1813 needs_or = true; 1813 needs_or = true;
1814 } 1814 }
1815 if ((types & CompareNilICStub::kCompareAgainstUndefined) != 0) { 1815 if (types.Contains(CompareNilICStub::UNDEFINED)) {
1816 if (needs_or) if_nil.Or(); 1816 if (needs_or) if_nil.Or();
1817 if_nil.If<HCompareObjectEqAndBranch>(value, 1817 if_nil.If<HCompareObjectEqAndBranch>(value,
1818 graph()->GetConstantUndefined()); 1818 graph()->GetConstantUndefined());
1819 needs_or = true; 1819 needs_or = true;
1820 } 1820 }
1821 // Handle either undetectable or monomorphic, not both. 1821 // Handle either undetectable or monomorphic, not both.
1822 ASSERT(((types & CompareNilICStub::kCompareAgainstUndetectable) == 0) || 1822 ASSERT(!types.Contains(CompareNilICStub::UNDETECTABLE) ||
1823 ((types & CompareNilICStub::kCompareAgainstMonomorphicMap) == 0)); 1823 !types.Contains(CompareNilICStub::MONOMORPHIC_MAP));
1824 if ((types & CompareNilICStub::kCompareAgainstUndetectable) != 0) { 1824 if (types.Contains(CompareNilICStub::UNDETECTABLE)) {
1825 if (needs_or) if_nil.Or(); 1825 if (needs_or) if_nil.Or();
1826 if_nil.If<HIsUndetectableAndBranch>(value); 1826 if_nil.If<HIsUndetectableAndBranch>(value);
1827 } else { 1827 } else {
1828 if_nil.Then(); 1828 if_nil.Then();
1829 if_nil.Else(); 1829 if_nil.Else();
1830 if ((types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0) { 1830 if (types.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
1831 BuildCheckNonSmi(value); 1831 BuildCheckNonSmi(value);
1832 // For ICs, the map checked below is a sentinel map that gets replaced by 1832 // For ICs, the map checked below is a sentinel map that gets replaced by
1833 // the monomorphic map when the code is used as a template to generate a 1833 // the monomorphic map when the code is used as a template to generate a
1834 // new IC. For optimized functions, there is no sentinel map, the map 1834 // new IC. For optimized functions, there is no sentinel map, the map
1835 // emitted below is the actual monomorphic map. 1835 // emitted below is the actual monomorphic map.
1836 BuildCheckMap(value, map); 1836 BuildCheckMap(value, map);
1837 } else { 1837 } else {
1838 if (kind == kNonStrictEquality) { 1838 if (kind == kNonStrictEquality) {
1839 if_nil.Deopt(); 1839 if_nil.Deopt();
1840 } 1840 }
(...skipping 8882 matching lines...) Expand 10 before | Expand all | Expand 10 after
10723 NilValue nil) { 10723 NilValue nil) {
10724 ASSERT(!HasStackOverflow()); 10724 ASSERT(!HasStackOverflow());
10725 ASSERT(current_block() != NULL); 10725 ASSERT(current_block() != NULL);
10726 ASSERT(current_block()->HasPredecessor()); 10726 ASSERT(current_block()->HasPredecessor());
10727 EqualityKind kind = 10727 EqualityKind kind =
10728 expr->op() == Token::EQ_STRICT ? kStrictEquality : kNonStrictEquality; 10728 expr->op() == Token::EQ_STRICT ? kStrictEquality : kNonStrictEquality;
10729 HIfContinuation continuation; 10729 HIfContinuation continuation;
10730 TypeFeedbackId id = expr->CompareOperationFeedbackId(); 10730 TypeFeedbackId id = expr->CompareOperationFeedbackId();
10731 CompareNilICStub::Types types; 10731 CompareNilICStub::Types types;
10732 if (kind == kStrictEquality) { 10732 if (kind == kStrictEquality) {
10733 if (nil == kNullValue) { 10733 types.Add((nil == kNullValue) ? CompareNilICStub::NULL_TYPE :
10734 types = CompareNilICStub::kCompareAgainstNull; 10734 CompareNilICStub::UNDEFINED);
10735 } else { 10735 } else {
10736 types = CompareNilICStub::kCompareAgainstUndefined; 10736 types = CompareNilICStub::Types(oracle()->CompareNilTypes(id));
10737 if (types.IsEmpty()) {
10738 types = CompareNilICStub::Types::FullCompare();
10737 } 10739 }
10738 } else {
10739 types = static_cast<CompareNilICStub::Types>(
10740 oracle()->CompareNilTypes(id));
10741 if (types == 0) types = CompareNilICStub::kFullCompare;
10742 } 10740 }
10743 Handle<Map> map_handle(oracle()->CompareNilMonomorphicReceiverType(id)); 10741 Handle<Map> map_handle(oracle()->CompareNilMonomorphicReceiverType(id));
10744 BuildCompareNil(value, kind, types, map_handle, 10742 BuildCompareNil(value, kind, types, map_handle,
10745 expr->position(), &continuation); 10743 expr->position(), &continuation);
10746 return ast_context()->ReturnContinuation(&continuation, expr->id()); 10744 return ast_context()->ReturnContinuation(&continuation, expr->id());
10747 } 10745 }
10748 10746
10749 10747
10750 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() { 10748 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() {
10751 // If we share optimized code between different closures, the 10749 // If we share optimized code between different closures, the
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
12366 } 12364 }
12367 } 12365 }
12368 12366
12369 #ifdef DEBUG 12367 #ifdef DEBUG
12370 if (graph_ != NULL) graph_->Verify(false); // No full verify. 12368 if (graph_ != NULL) graph_->Verify(false); // No full verify.
12371 if (allocator_ != NULL) allocator_->Verify(); 12369 if (allocator_ != NULL) allocator_->Verify();
12372 #endif 12370 #endif
12373 } 12371 }
12374 12372
12375 } } // namespace v8::internal 12373 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698