OLD | NEW |
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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 if (left_unary != NULL && left_unary->op() == Token::VOID && | 373 if (left_unary != NULL && left_unary->op() == Token::VOID && |
374 left_unary->expression()->AsLiteral() != NULL) { | 374 left_unary->expression()->AsLiteral() != NULL) { |
375 *expr = right_; | 375 *expr = right_; |
376 return true; | 376 return true; |
377 } | 377 } |
378 | 378 |
379 return false; | 379 return false; |
380 } | 380 } |
381 | 381 |
382 | 382 |
| 383 bool CompareOperation::IsLiteralCompareNull(Expression** expr) { |
| 384 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return false; |
| 385 |
| 386 // Check for the pattern: <expression> equals null. |
| 387 Literal* right_literal = right_->AsLiteral(); |
| 388 if (right_literal != NULL && right_literal->handle()->IsNull()) { |
| 389 *expr = left_; |
| 390 return true; |
| 391 } |
| 392 |
| 393 // Check for the pattern: null equals <expression>. |
| 394 Literal* left_literal = left_->AsLiteral(); |
| 395 if (left_literal != NULL && left_literal->handle()->IsNull()) { |
| 396 *expr = right_; |
| 397 return true; |
| 398 } |
| 399 |
| 400 return false; |
| 401 } |
| 402 |
| 403 |
383 // ---------------------------------------------------------------------------- | 404 // ---------------------------------------------------------------------------- |
384 // Inlining support | 405 // Inlining support |
385 | 406 |
386 bool Declaration::IsInlineable() const { | 407 bool Declaration::IsInlineable() const { |
387 return proxy()->var()->IsStackAllocated() && fun() == NULL; | 408 return proxy()->var()->IsStackAllocated() && fun() == NULL; |
388 } | 409 } |
389 | 410 |
390 | 411 |
391 bool TargetCollector::IsInlineable() const { | 412 bool TargetCollector::IsInlineable() const { |
392 UNREACHABLE(); | 413 UNREACHABLE(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 bool BinaryOperation::IsInlineable() const { | 612 bool BinaryOperation::IsInlineable() const { |
592 return left()->IsInlineable() && right()->IsInlineable(); | 613 return left()->IsInlineable() && right()->IsInlineable(); |
593 } | 614 } |
594 | 615 |
595 | 616 |
596 bool CompareOperation::IsInlineable() const { | 617 bool CompareOperation::IsInlineable() const { |
597 return left()->IsInlineable() && right()->IsInlineable(); | 618 return left()->IsInlineable() && right()->IsInlineable(); |
598 } | 619 } |
599 | 620 |
600 | 621 |
601 bool CompareToNull::IsInlineable() const { | |
602 return expression()->IsInlineable(); | |
603 } | |
604 | |
605 | |
606 bool CountOperation::IsInlineable() const { | 622 bool CountOperation::IsInlineable() const { |
607 return expression()->IsInlineable(); | 623 return expression()->IsInlineable(); |
608 } | 624 } |
609 | 625 |
610 | 626 |
611 // ---------------------------------------------------------------------------- | 627 // ---------------------------------------------------------------------------- |
612 // Recording of type feedback | 628 // Recording of type feedback |
613 | 629 |
614 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 630 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
615 // Record type feedback from the oracle in the AST. | 631 // Record type feedback from the oracle in the AST. |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 int pos) | 1185 int pos) |
1170 : label_(label), | 1186 : label_(label), |
1171 statements_(statements), | 1187 statements_(statements), |
1172 position_(pos), | 1188 position_(pos), |
1173 compare_type_(NONE), | 1189 compare_type_(NONE), |
1174 compare_id_(AstNode::GetNextId(isolate)), | 1190 compare_id_(AstNode::GetNextId(isolate)), |
1175 entry_id_(AstNode::GetNextId(isolate)) { | 1191 entry_id_(AstNode::GetNextId(isolate)) { |
1176 } | 1192 } |
1177 | 1193 |
1178 } } // namespace v8::internal | 1194 } } // namespace v8::internal |
OLD | NEW |