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

Side by Side Diff: src/hydrogen.cc

Issue 18465003: Fix default type feedback returned from the oracle (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added comments Created 7 years, 5 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/type-info.cc » ('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 9226 matching lines...) Expand 10 before | Expand all | Expand 10 after
9237 instr->set_position(expr->position()); 9237 instr->set_position(expr->position());
9238 return ast_context()->ReturnControl(instr, expr->id()); 9238 return ast_context()->ReturnControl(instr, expr->id());
9239 } 9239 }
9240 9240
9241 Handle<Type> left_type = expr->left()->lower_type(); 9241 Handle<Type> left_type = expr->left()->lower_type();
9242 Handle<Type> right_type = expr->right()->lower_type(); 9242 Handle<Type> right_type = expr->right()->lower_type();
9243 Handle<Type> combined_type = expr->combined_type(); 9243 Handle<Type> combined_type = expr->combined_type();
9244 Representation combined_rep = ToRepresentation(combined_type); 9244 Representation combined_rep = ToRepresentation(combined_type);
9245 Representation left_rep = ToRepresentation(left_type); 9245 Representation left_rep = ToRepresentation(left_type);
9246 Representation right_rep = ToRepresentation(right_type); 9246 Representation right_rep = ToRepresentation(right_type);
9247 // Check if this expression was ever executed according to type feedback.
9248 // Note that for the special typeof/null/undefined cases we get unknown here.
9249 if (combined_type->Is(Type::None())) {
9250 AddSoftDeoptimize();
9251 combined_type = left_type = right_type = handle(Type::Any(), isolate());
9252 }
9253 9247
9254 CHECK_ALIVE(VisitForValue(expr->left())); 9248 CHECK_ALIVE(VisitForValue(expr->left()));
9255 CHECK_ALIVE(VisitForValue(expr->right())); 9249 CHECK_ALIVE(VisitForValue(expr->right()));
9256 9250
9257 HValue* context = environment()->LookupContext(); 9251 HValue* context = environment()->LookupContext();
9258 HValue* right = Pop(); 9252 HValue* right = Pop();
9259 HValue* left = Pop(); 9253 HValue* left = Pop();
9260 Token::Value op = expr->op(); 9254 Token::Value op = expr->op();
9261 9255
9262 HTypeof* typeof_expr = NULL; 9256 HTypeof* typeof_expr = NULL;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
9309 HInstanceOf* result = new(zone()) HInstanceOf(context, left, right); 9303 HInstanceOf* result = new(zone()) HInstanceOf(context, left, right);
9310 result->set_position(expr->position()); 9304 result->set_position(expr->position());
9311 return ast_context()->ReturnInstruction(result, expr->id()); 9305 return ast_context()->ReturnInstruction(result, expr->id());
9312 } else { 9306 } else {
9313 Add<HCheckFunction>(right, target); 9307 Add<HCheckFunction>(right, target);
9314 HInstanceOfKnownGlobal* result = 9308 HInstanceOfKnownGlobal* result =
9315 new(zone()) HInstanceOfKnownGlobal(context, left, target); 9309 new(zone()) HInstanceOfKnownGlobal(context, left, target);
9316 result->set_position(expr->position()); 9310 result->set_position(expr->position());
9317 return ast_context()->ReturnInstruction(result, expr->id()); 9311 return ast_context()->ReturnInstruction(result, expr->id());
9318 } 9312 }
9313
9314 // Code below assumes that we don't fall through.
9315 UNREACHABLE();
9319 } else if (op == Token::IN) { 9316 } else if (op == Token::IN) {
9320 HIn* result = new(zone()) HIn(context, left, right); 9317 HIn* result = new(zone()) HIn(context, left, right);
9321 result->set_position(expr->position()); 9318 result->set_position(expr->position());
9322 return ast_context()->ReturnInstruction(result, expr->id()); 9319 return ast_context()->ReturnInstruction(result, expr->id());
9323 } else if (combined_type->Is(Type::Receiver())) { 9320 }
9321
9322 // Cases handled below depend on collected type feedback. They should
9323 // soft deoptimize when there is no type feedback.
9324 if (combined_type->Is(Type::None())) {
9325 AddSoftDeoptimize();
9326 combined_type = left_type = right_type = handle(Type::Any(), isolate());
9327 }
9328
9329 if (combined_type->Is(Type::Receiver())) {
9324 switch (op) { 9330 switch (op) {
9325 case Token::EQ: 9331 case Token::EQ:
9326 case Token::EQ_STRICT: { 9332 case Token::EQ_STRICT: {
9327 // Can we get away with map check and not instance type check? 9333 // Can we get away with map check and not instance type check?
9328 if (combined_type->IsClass()) { 9334 if (combined_type->IsClass()) {
9329 Handle<Map> map = combined_type->AsClass(); 9335 Handle<Map> map = combined_type->AsClass();
9330 AddCheckMapsWithTransitions(left, map); 9336 AddCheckMapsWithTransitions(left, map);
9331 AddCheckMapsWithTransitions(right, map); 9337 AddCheckMapsWithTransitions(right, map);
9332 HCompareObjectEqAndBranch* result = 9338 HCompareObjectEqAndBranch* result =
9333 new(zone()) HCompareObjectEqAndBranch(left, right); 9339 new(zone()) HCompareObjectEqAndBranch(left, right);
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
11020 if (ShouldProduceTraceOutput()) { 11026 if (ShouldProduceTraceOutput()) {
11021 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11027 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11022 } 11028 }
11023 11029
11024 #ifdef DEBUG 11030 #ifdef DEBUG
11025 graph_->Verify(false); // No full verify. 11031 graph_->Verify(false); // No full verify.
11026 #endif 11032 #endif
11027 } 11033 }
11028 11034
11029 } } // namespace v8::internal 11035 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698