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

Side by Side Diff: src/hydrogen.cc

Issue 6366006: Use typefeedback for bitwise operations.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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 | src/hydrogen-instructions.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 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 4802 matching lines...) Expand 10 before | Expand all | Expand 10 after
4813 // for a smi operation. If one of the operands is a constant string 4813 // for a smi operation. If one of the operands is a constant string
4814 // do not generate code assuming it is a smi operation. 4814 // do not generate code assuming it is a smi operation.
4815 if (info.IsSmi() && 4815 if (info.IsSmi() &&
4816 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || 4816 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) ||
4817 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { 4817 (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) {
4818 return instr; 4818 return instr;
4819 } 4819 }
4820 if (FLAG_trace_representation) { 4820 if (FLAG_trace_representation) {
4821 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic()); 4821 PrintF("Info: %s/%s\n", info.ToString(), ToRepresentation(info).Mnemonic());
4822 } 4822 }
4823 AssumeRepresentation(instr, ToRepresentation(info)); 4823 Representation rep = ToRepresentation(info);
4824 // We only generate either int32 or generic tagged bitwise operations.
4825 if (instr->IsBitwiseBinaryOperation() && rep.IsDouble()) {
4826 rep = Representation::Integer32();
4827 }
4828 AssumeRepresentation(instr, rep);
4824 return instr; 4829 return instr;
4825 } 4830 }
4826 4831
4827 4832
4828 // Check for the form (%_ClassOf(foo) === 'BarClass'). 4833 // Check for the form (%_ClassOf(foo) === 'BarClass').
4829 static bool IsClassOfTest(CompareOperation* expr) { 4834 static bool IsClassOfTest(CompareOperation* expr) {
4830 if (expr->op() != Token::EQ_STRICT) return false; 4835 if (expr->op() != Token::EQ_STRICT) return false;
4831 CallRuntime* call = expr->left()->AsCallRuntime(); 4836 CallRuntime* call = expr->left()->AsCallRuntime();
4832 if (call == NULL) return false; 4837 if (call == NULL) return false;
4833 Literal* literal = expr->right()->AsLiteral(); 4838 Literal* literal = expr->right()->AsLiteral();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4894 4899
4895 void HGraphBuilder::AssumeRepresentation(HValue* value, Representation r) { 4900 void HGraphBuilder::AssumeRepresentation(HValue* value, Representation r) {
4896 if (value->CheckFlag(HValue::kFlexibleRepresentation)) { 4901 if (value->CheckFlag(HValue::kFlexibleRepresentation)) {
4897 if (FLAG_trace_representation) { 4902 if (FLAG_trace_representation) {
4898 PrintF("Assume representation for %s to be %s (%d)\n", 4903 PrintF("Assume representation for %s to be %s (%d)\n",
4899 value->Mnemonic(), 4904 value->Mnemonic(),
4900 r.Mnemonic(), 4905 r.Mnemonic(),
4901 graph_->GetMaximumValueID()); 4906 graph_->GetMaximumValueID());
4902 } 4907 }
4903 value->ChangeRepresentation(r); 4908 value->ChangeRepresentation(r);
4904 // The representation of the value is dictated by type feedback. 4909 // The representation of the value is dictated by type feedback and
4910 // will not be changed later.
4905 value->ClearFlag(HValue::kFlexibleRepresentation); 4911 value->ClearFlag(HValue::kFlexibleRepresentation);
4906 } else if (FLAG_trace_representation) { 4912 } else if (FLAG_trace_representation) {
4907 PrintF("No representation assumed\n"); 4913 PrintF("No representation assumed\n");
4908 } 4914 }
4909 } 4915 }
4910 4916
4911 4917
4912 Representation HGraphBuilder::ToRepresentation(TypeInfo info) { 4918 Representation HGraphBuilder::ToRepresentation(TypeInfo info) {
4913 if (info.IsSmi()) return Representation::Integer32(); 4919 if (info.IsSmi()) return Representation::Integer32();
4914 if (info.IsInteger32()) return Representation::Integer32(); 4920 if (info.IsInteger32()) return Representation::Integer32();
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
5867 } 5873 }
5868 } 5874 }
5869 5875
5870 #ifdef DEBUG 5876 #ifdef DEBUG
5871 if (graph_ != NULL) graph_->Verify(); 5877 if (graph_ != NULL) graph_->Verify();
5872 if (allocator_ != NULL) allocator_->Verify(); 5878 if (allocator_ != NULL) allocator_->Verify();
5873 #endif 5879 #endif
5874 } 5880 }
5875 5881
5876 } } // namespace v8::internal 5882 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698