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

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
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 8836 matching lines...) Expand 10 before | Expand all | Expand 10 after
10677 NilValue nil) { 10677 NilValue nil) {
10678 ASSERT(!HasStackOverflow()); 10678 ASSERT(!HasStackOverflow());
10679 ASSERT(current_block() != NULL); 10679 ASSERT(current_block() != NULL);
10680 ASSERT(current_block()->HasPredecessor()); 10680 ASSERT(current_block()->HasPredecessor());
10681 EqualityKind kind = 10681 EqualityKind kind =
10682 expr->op() == Token::EQ_STRICT ? kStrictEquality : kNonStrictEquality; 10682 expr->op() == Token::EQ_STRICT ? kStrictEquality : kNonStrictEquality;
10683 HIfContinuation continuation; 10683 HIfContinuation continuation;
10684 TypeFeedbackId id = expr->CompareOperationFeedbackId(); 10684 TypeFeedbackId id = expr->CompareOperationFeedbackId();
10685 CompareNilICStub::Types types; 10685 CompareNilICStub::Types types;
10686 if (kind == kStrictEquality) { 10686 if (kind == kStrictEquality) {
10687 if (nil == kNullValue) { 10687 if (nil == kNullValue) {
Sven Panne 2013/05/13 14:24:50 Using a ternary ?: is clearer here.
oliv 2013/05/13 18:03:58 ok
10688 types = CompareNilICStub::kCompareAgainstNull; 10688 types.Add(CompareNilICStub::NULL_TYPE);
10689 } else { 10689 } else {
10690 types = CompareNilICStub::kCompareAgainstUndefined; 10690 types.Add(CompareNilICStub::UNDEFINED);
10691 } 10691 }
10692 } else { 10692 } else {
10693 types = static_cast<CompareNilICStub::Types>( 10693 types = CompareNilICStub::Types(oracle()->CompareNilTypes(id));
10694 oracle()->CompareNilTypes(id)); 10694 if (types.IsEmpty()) {
10695 if (types == 0) types = CompareNilICStub::kFullCompare; 10695 types.BeFullCompare();
10696 }
10696 } 10697 }
10697 Handle<Map> map_handle(oracle()->CompareNilMonomorphicReceiverType(id)); 10698 Handle<Map> map_handle(oracle()->CompareNilMonomorphicReceiverType(id));
10698 BuildCompareNil(value, kind, types, map_handle, 10699 BuildCompareNil(value, kind, types, map_handle,
10699 expr->position(), &continuation); 10700 expr->position(), &continuation);
10700 return ast_context()->ReturnContinuation(&continuation, expr->id()); 10701 return ast_context()->ReturnContinuation(&continuation, expr->id());
10701 } 10702 }
10702 10703
10703 10704
10704 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() { 10705 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() {
10705 // If we share optimized code between different closures, the 10706 // If we share optimized code between different closures, the
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
12304 } 12305 }
12305 } 12306 }
12306 12307
12307 #ifdef DEBUG 12308 #ifdef DEBUG
12308 if (graph_ != NULL) graph_->Verify(false); // No full verify. 12309 if (graph_ != NULL) graph_->Verify(false); // No full verify.
12309 if (allocator_ != NULL) allocator_->Verify(); 12310 if (allocator_ != NULL) allocator_->Verify();
12310 #endif 12311 #endif
12311 } 12312 }
12312 12313
12313 } } // namespace v8::internal 12314 } } // namespace v8::internal
OLDNEW
« src/code-stubs.cc ('K') | « src/code-stubs.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698