OLD | NEW |
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 Loading... |
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(olivf) If this Operation is used in a test context, then the |
| 293 // expression has a ToBoolean stub and we want to collect the type |
| 294 // information. However the GraphBuilder expects it to be on the instruction |
| 295 // corresponding to the TestContext, therefore we have to store it here and |
| 296 // not on the operand. |
| 297 set_to_boolean_types(oracle->ToBooleanTypes(expression()->test_id())); |
| 298 } |
| 299 |
| 300 |
291 bool UnaryOperation::ResultOverwriteAllowed() { | 301 bool UnaryOperation::ResultOverwriteAllowed() { |
292 switch (op_) { | 302 switch (op_) { |
293 case Token::BIT_NOT: | 303 case Token::BIT_NOT: |
294 case Token::SUB: | 304 case Token::SUB: |
295 return true; | 305 return true; |
296 default: | 306 default: |
297 return false; | 307 return false; |
298 } | 308 } |
299 } | 309 } |
300 | 310 |
301 | 311 |
| 312 void BinaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { |
| 313 // TODO(olivf) If this Operation is used in a test context, then the right |
| 314 // hand side has a ToBoolean stub and we want to collect the type information. |
| 315 // However the GraphBuilder expects it to be on the instruction corresponding |
| 316 // to the TestContext, therefore we have to store it here and not on the |
| 317 // right hand operand. |
| 318 set_to_boolean_types(oracle->ToBooleanTypes(right()->test_id())); |
| 319 } |
| 320 |
| 321 |
302 bool BinaryOperation::ResultOverwriteAllowed() { | 322 bool BinaryOperation::ResultOverwriteAllowed() { |
303 switch (op_) { | 323 switch (op_) { |
304 case Token::COMMA: | 324 case Token::COMMA: |
305 case Token::OR: | 325 case Token::OR: |
306 case Token::AND: | 326 case Token::AND: |
307 return false; | 327 return false; |
308 case Token::BIT_OR: | 328 case Token::BIT_OR: |
309 case Token::BIT_XOR: | 329 case Token::BIT_XOR: |
310 case Token::BIT_AND: | 330 case Token::BIT_AND: |
311 case Token::SHL: | 331 case Token::SHL: |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1183 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
1164 str = arr; | 1184 str = arr; |
1165 } else { | 1185 } else { |
1166 str = DoubleToCString(value_->Number(), buffer); | 1186 str = DoubleToCString(value_->Number(), buffer); |
1167 } | 1187 } |
1168 return factory->NewStringFromAscii(CStrVector(str)); | 1188 return factory->NewStringFromAscii(CStrVector(str)); |
1169 } | 1189 } |
1170 | 1190 |
1171 | 1191 |
1172 } } // namespace v8::internal | 1192 } } // namespace v8::internal |
OLD | NEW |