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

Side by Side Diff: src/hydrogen.cc

Issue 98643010: Fix switch statements with non-Smi integer labels and no type feedback (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-329709.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 9152 matching lines...) Expand 10 before | Expand all | Expand 10 after
9163 } else if (op == Token::IN) { 9163 } else if (op == Token::IN) {
9164 HValue* function = AddLoadJSBuiltin(Builtins::IN); 9164 HValue* function = AddLoadJSBuiltin(Builtins::IN);
9165 Add<HPushArgument>(left); 9165 Add<HPushArgument>(left);
9166 Add<HPushArgument>(right); 9166 Add<HPushArgument>(right);
9167 // TODO(olivf) InvokeFunction produces a check for the parameter count, 9167 // TODO(olivf) InvokeFunction produces a check for the parameter count,
9168 // even though we are certain to pass the correct number of arguments here. 9168 // even though we are certain to pass the correct number of arguments here.
9169 HInstruction* result = New<HInvokeFunction>(function, 2); 9169 HInstruction* result = New<HInvokeFunction>(function, 2);
9170 return ast_context()->ReturnInstruction(result, expr->id()); 9170 return ast_context()->ReturnInstruction(result, expr->id());
9171 } 9171 }
9172 9172
9173 // Cases handled below depend on collected type feedback. They should
9174 // soft deoptimize when there is no type feedback.
9175 if (combined_type->Is(Type::None())) {
9176 Add<HDeoptimize>("Insufficient type feedback for combined type "
9177 "of binary operation",
9178 Deoptimizer::SOFT);
9179 combined_type = left_type = right_type = handle(Type::Any(), isolate());
9180 }
9181
9182 HControlInstruction* compare = BuildCompareInstruction( 9173 HControlInstruction* compare = BuildCompareInstruction(
9183 op, left, right, left_type, right_type, combined_type, 9174 op, left, right, left_type, right_type, combined_type,
9184 expr->left()->position(), expr->right()->position(), expr->id()); 9175 expr->left()->position(), expr->right()->position(), expr->id());
9185 if (compare == NULL) return; // Bailed out. 9176 if (compare == NULL) return; // Bailed out.
9186 return ast_context()->ReturnControl(compare, expr->id()); 9177 return ast_context()->ReturnControl(compare, expr->id());
9187 } 9178 }
9188 9179
9189 9180
9190 HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction( 9181 HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
9191 Token::Value op, 9182 Token::Value op,
9192 HValue* left, 9183 HValue* left,
9193 HValue* right, 9184 HValue* right,
9194 Handle<Type> left_type, 9185 Handle<Type> left_type,
9195 Handle<Type> right_type, 9186 Handle<Type> right_type,
9196 Handle<Type> combined_type, 9187 Handle<Type> combined_type,
9197 int left_position, 9188 int left_position,
9198 int right_position, 9189 int right_position,
9199 BailoutId bailout_id) { 9190 BailoutId bailout_id) {
9191 // Cases handled below depend on collected type feedback. They should
9192 // soft deoptimize when there is no type feedback.
9193 if (combined_type->Is(Type::None())) {
9194 Add<HDeoptimize>("Insufficient type feedback for combined type "
9195 "of binary operation",
9196 Deoptimizer::SOFT);
9197 combined_type = left_type = right_type = handle(Type::Any(), isolate());
9198 }
9199
9200 Representation left_rep = Representation::FromType(left_type); 9200 Representation left_rep = Representation::FromType(left_type);
9201 Representation right_rep = Representation::FromType(right_type); 9201 Representation right_rep = Representation::FromType(right_type);
9202 Representation combined_rep = Representation::FromType(combined_type); 9202 Representation combined_rep = Representation::FromType(combined_type);
9203 9203
9204 if (combined_type->Is(Type::Receiver())) { 9204 if (combined_type->Is(Type::Receiver())) {
9205 if (Token::IsEqualityOp(op)) { 9205 if (Token::IsEqualityOp(op)) {
9206 // Can we get away with map check and not instance type check? 9206 // Can we get away with map check and not instance type check?
9207 HValue* operand_to_check = 9207 HValue* operand_to_check =
9208 left->block()->block_id() < right->block()->block_id() ? left : right; 9208 left->block()->block_id() < right->block()->block_id() ? left : right;
9209 if (combined_type->IsClass()) { 9209 if (combined_type->IsClass()) {
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
10792 if (ShouldProduceTraceOutput()) { 10792 if (ShouldProduceTraceOutput()) {
10793 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10793 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10794 } 10794 }
10795 10795
10796 #ifdef DEBUG 10796 #ifdef DEBUG
10797 graph_->Verify(false); // No full verify. 10797 graph_->Verify(false); // No full verify.
10798 #endif 10798 #endif
10799 } 10799 }
10800 10800
10801 } } // namespace v8::internal 10801 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-329709.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698