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

Side by Side Diff: src/hydrogen.cc

Issue 8520006: Optimize the equality check case of ICCompare stubs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5980 matching lines...) Expand 10 before | Expand all | Expand 10 after
5991 return ast_context()->ReturnInstruction(result, expr->id()); 5991 return ast_context()->ReturnInstruction(result, expr->id());
5992 } 5992 }
5993 } else if (op == Token::IN) { 5993 } else if (op == Token::IN) {
5994 HIn* result = new(zone()) HIn(context, left, right); 5994 HIn* result = new(zone()) HIn(context, left, right);
5995 result->set_position(expr->position()); 5995 result->set_position(expr->position());
5996 return ast_context()->ReturnInstruction(result, expr->id()); 5996 return ast_context()->ReturnInstruction(result, expr->id());
5997 } else if (type_info.IsNonPrimitive()) { 5997 } else if (type_info.IsNonPrimitive()) {
5998 switch (op) { 5998 switch (op) {
5999 case Token::EQ: 5999 case Token::EQ:
6000 case Token::EQ_STRICT: { 6000 case Token::EQ_STRICT: {
6001 AddInstruction(new(zone()) HCheckNonSmi(left)); 6001 // Can we get away with map check and not instance type check?
6002 AddInstruction(HCheckInstanceType::NewIsSpecObject(left)); 6002 Handle<Map> map = oracle()->GetCompareMap(expr);
6003 AddInstruction(new(zone()) HCheckNonSmi(right)); 6003 if (!map.is_null()) {
6004 AddInstruction(HCheckInstanceType::NewIsSpecObject(right)); 6004 AddInstruction(new(zone()) HCheckNonSmi(left));
6005 HCompareObjectEqAndBranch* result = 6005 AddInstruction(new(zone()) HCheckMap(left, map));
6006 new(zone()) HCompareObjectEqAndBranch(left, right); 6006 AddInstruction(new(zone()) HCheckNonSmi(right));
6007 result->set_position(expr->position()); 6007 AddInstruction(new(zone()) HCheckMap(right, map));
6008 return ast_context()->ReturnControl(result, expr->id()); 6008 HCompareObjectEqAndBranch* result =
6009 new(zone()) HCompareObjectEqAndBranch(left, right);
6010 result->set_position(expr->position());
6011 return ast_context()->ReturnControl(result, expr->id());
6012 } else {
6013 AddInstruction(new(zone()) HCheckNonSmi(left));
6014 AddInstruction(HCheckInstanceType::NewIsSpecObject(left));
6015 AddInstruction(new(zone()) HCheckNonSmi(right));
6016 AddInstruction(HCheckInstanceType::NewIsSpecObject(right));
6017 HCompareObjectEqAndBranch* result =
6018 new(zone()) HCompareObjectEqAndBranch(left, right);
6019 result->set_position(expr->position());
6020 return ast_context()->ReturnControl(result, expr->id());
6021 }
6009 } 6022 }
6010 default: 6023 default:
6011 return Bailout("Unsupported non-primitive compare"); 6024 return Bailout("Unsupported non-primitive compare");
6012 } 6025 }
6013 } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) && 6026 } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) &&
6014 (op == Token::EQ || op == Token::EQ_STRICT)) { 6027 (op == Token::EQ || op == Token::EQ_STRICT)) {
6015 AddInstruction(new(zone()) HCheckNonSmi(left)); 6028 AddInstruction(new(zone()) HCheckNonSmi(left));
6016 AddInstruction(HCheckInstanceType::NewIsSymbol(left)); 6029 AddInstruction(HCheckInstanceType::NewIsSymbol(left));
6017 AddInstruction(new(zone()) HCheckNonSmi(right)); 6030 AddInstruction(new(zone()) HCheckNonSmi(right));
6018 AddInstruction(HCheckInstanceType::NewIsSymbol(right)); 6031 AddInstruction(HCheckInstanceType::NewIsSymbol(right));
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
7094 } 7107 }
7095 } 7108 }
7096 7109
7097 #ifdef DEBUG 7110 #ifdef DEBUG
7098 if (graph_ != NULL) graph_->Verify(false); // No full verify. 7111 if (graph_ != NULL) graph_->Verify(false); // No full verify.
7099 if (allocator_ != NULL) allocator_->Verify(); 7112 if (allocator_ != NULL) allocator_->Verify();
7100 #endif 7113 #endif
7101 } 7114 }
7102 7115
7103 } } // namespace v8::internal 7116 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/heap.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698