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 4551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4562 break; | 4562 break; |
4563 case Token::SUB: | 4563 case Token::SUB: |
4564 instr = new HMul(graph_->GetConstantMinus1(), value); | 4564 instr = new HMul(graph_->GetConstantMinus1(), value); |
4565 break; | 4565 break; |
4566 default: | 4566 default: |
4567 UNREACHABLE(); | 4567 UNREACHABLE(); |
4568 break; | 4568 break; |
4569 } | 4569 } |
4570 ast_context()->ReturnInstruction(instr, expr->id()); | 4570 ast_context()->ReturnInstruction(instr, expr->id()); |
4571 } else if (op == Token::TYPEOF) { | 4571 } else if (op == Token::TYPEOF) { |
4572 VisitForTypeOf(expr); | 4572 VisitForTypeOf(expr->expression()); |
4573 if (HasStackOverflow()) return; | 4573 if (HasStackOverflow()) return; |
4574 HValue* value = Pop(); | 4574 HValue* value = Pop(); |
4575 ast_context()->ReturnInstruction(new HTypeof(value), expr->id()); | 4575 ast_context()->ReturnInstruction(new HTypeof(value), expr->id()); |
4576 } else { | 4576 } else { |
4577 BAILOUT("Value: unsupported unary operation"); | 4577 BAILOUT("Value: unsupported unary operation"); |
4578 } | 4578 } |
4579 } | 4579 } |
4580 | 4580 |
4581 | 4581 |
4582 void HGraphBuilder::VisitIncrementOperation(IncrementOperation* expr) { | 4582 void HGraphBuilder::VisitIncrementOperation(IncrementOperation* expr) { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4948 ast_context()->ReturnInstruction(instr, expr->id()); | 4948 ast_context()->ReturnInstruction(instr, expr->id()); |
4949 return; | 4949 return; |
4950 } | 4950 } |
4951 | 4951 |
4952 // Check for the pattern: typeof <expression> == <string literal>. | 4952 // Check for the pattern: typeof <expression> == <string literal>. |
4953 UnaryOperation* left_unary = expr->left()->AsUnaryOperation(); | 4953 UnaryOperation* left_unary = expr->left()->AsUnaryOperation(); |
4954 Literal* right_literal = expr->right()->AsLiteral(); | 4954 Literal* right_literal = expr->right()->AsLiteral(); |
4955 if ((expr->op() == Token::EQ || expr->op() == Token::EQ_STRICT) && | 4955 if ((expr->op() == Token::EQ || expr->op() == Token::EQ_STRICT) && |
4956 left_unary != NULL && left_unary->op() == Token::TYPEOF && | 4956 left_unary != NULL && left_unary->op() == Token::TYPEOF && |
4957 right_literal != NULL && right_literal->handle()->IsString()) { | 4957 right_literal != NULL && right_literal->handle()->IsString()) { |
4958 VisitForTypeOf(expr); | 4958 VisitForTypeOf(left_unary->expression()); |
4959 if (HasStackOverflow()) return; | 4959 if (HasStackOverflow()) return; |
4960 HValue* left = Pop(); | 4960 HValue* left = Pop(); |
4961 HInstruction* instr = new HTypeofIs(left, | 4961 HInstruction* instr = new HTypeofIs(left, |
4962 Handle<String>::cast(right_literal->handle())); | 4962 Handle<String>::cast(right_literal->handle())); |
4963 instr->set_position(expr->position()); | 4963 instr->set_position(expr->position()); |
4964 ast_context()->ReturnInstruction(instr, expr->id()); | 4964 ast_context()->ReturnInstruction(instr, expr->id()); |
4965 return; | 4965 return; |
4966 } | 4966 } |
4967 | 4967 |
4968 VISIT_FOR_VALUE(expr->left()); | 4968 VISIT_FOR_VALUE(expr->left()); |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5946 } | 5946 } |
5947 } | 5947 } |
5948 | 5948 |
5949 #ifdef DEBUG | 5949 #ifdef DEBUG |
5950 if (graph_ != NULL) graph_->Verify(); | 5950 if (graph_ != NULL) graph_->Verify(); |
5951 if (allocator_ != NULL) allocator_->Verify(); | 5951 if (allocator_ != NULL) allocator_->Verify(); |
5952 #endif | 5952 #endif |
5953 } | 5953 } |
5954 | 5954 |
5955 } } // namespace v8::internal | 5955 } } // namespace v8::internal |
OLD | NEW |