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

Side by Side Diff: src/ast.cc

Issue 17444011: Fix to_boolean type feedback for unary and binary ops (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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
« src/ast.h ('K') | « src/ast.h ('k') | no next file » | 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 void TargetCollector::AddTarget(Label* target, Zone* zone) { 281 void TargetCollector::AddTarget(Label* target, Zone* zone) {
282 // Add the label to the collector, but discard duplicates. 282 // Add the label to the collector, but discard duplicates.
283 int length = targets_.length(); 283 int length = targets_.length();
284 for (int i = 0; i < length; i++) { 284 for (int i = 0; i < length; i++) {
285 if (targets_[i] == target) return; 285 if (targets_[i] == target) return;
286 } 286 }
287 targets_.Add(target, zone); 287 targets_.Add(target, zone);
288 } 288 }
289 289
290 290
291 void UnaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
292 // TODO(oli) If this Operation is used in a test context, then the expression
Jakob Kummerow 2013/06/24 15:06:35 nit: the identifier in the parentheses should be t
293 // has a ToBool stub and we want to collect this information. However the
Jakob Kummerow 2013/06/24 15:06:35 nit: s/ToBool/ToBoolean/
294 // GraphBuilder expects it to be on the instruction corresponding to the
295 // TestContext, therefore we have to store it here and not on the operand.
296 to_boolean_types_ = oracle->ToBooleanTypes(expression()->test_id());
297 }
298
299
291 bool UnaryOperation::ResultOverwriteAllowed() { 300 bool UnaryOperation::ResultOverwriteAllowed() {
292 switch (op_) { 301 switch (op_) {
293 case Token::BIT_NOT: 302 case Token::BIT_NOT:
294 case Token::SUB: 303 case Token::SUB:
295 return true; 304 return true;
296 default: 305 default:
297 return false; 306 return false;
298 } 307 }
299 } 308 }
300 309
301 310
311 void BinaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
312 // TODO(oli) If this Operation is used in a test context, then the right
313 // hand side has a ToBool stub and we want to collect this information.
314 // However the GraphBuilder expects it to be on the instruction corresponding
315 // to the TestContext, therefore we have to store it here and not on the
316 // right hand operand.
317 to_boolean_types_ = oracle->ToBooleanTypes(right()->test_id());
318 }
319
320
302 bool BinaryOperation::ResultOverwriteAllowed() { 321 bool BinaryOperation::ResultOverwriteAllowed() {
303 switch (op_) { 322 switch (op_) {
304 case Token::COMMA: 323 case Token::COMMA:
305 case Token::OR: 324 case Token::OR:
306 case Token::AND: 325 case Token::AND:
307 return false; 326 return false;
308 case Token::BIT_OR: 327 case Token::BIT_OR:
309 case Token::BIT_XOR: 328 case Token::BIT_XOR:
310 case Token::BIT_AND: 329 case Token::BIT_AND:
311 case Token::SHL: 330 case Token::SHL:
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); 1182 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value());
1164 str = arr; 1183 str = arr;
1165 } else { 1184 } else {
1166 str = DoubleToCString(handle_->Number(), buffer); 1185 str = DoubleToCString(handle_->Number(), buffer);
1167 } 1186 }
1168 return factory->NewStringFromAscii(CStrVector(str)); 1187 return factory->NewStringFromAscii(CStrVector(str));
1169 } 1188 }
1170 1189
1171 1190
1172 } } // namespace v8::internal 1191 } } // namespace v8::internal
OLDNEW
« src/ast.h ('K') | « src/ast.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698