| 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 3778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3789 expr->RecordTypeFeedback(oracle()); | 3789 expr->RecordTypeFeedback(oracle()); |
| 3790 | 3790 |
| 3791 if (TryArgumentsAccess(expr)) return; | 3791 if (TryArgumentsAccess(expr)) return; |
| 3792 | 3792 |
| 3793 CHECK_ALIVE(VisitForValue(expr->obj())); | 3793 CHECK_ALIVE(VisitForValue(expr->obj())); |
| 3794 | 3794 |
| 3795 HInstruction* instr = NULL; | 3795 HInstruction* instr = NULL; |
| 3796 if (expr->IsArrayLength()) { | 3796 if (expr->IsArrayLength()) { |
| 3797 HValue* array = Pop(); | 3797 HValue* array = Pop(); |
| 3798 AddInstruction(new(zone()) HCheckNonSmi(array)); | 3798 AddInstruction(new(zone()) HCheckNonSmi(array)); |
| 3799 AddInstruction(new(zone()) HCheckInstanceType(array, | 3799 AddInstruction(HCheckInstanceType::NewIsJSArray(array)); |
| 3800 JS_ARRAY_TYPE, | |
| 3801 JS_ARRAY_TYPE)); | |
| 3802 instr = new(zone()) HJSArrayLength(array); | 3800 instr = new(zone()) HJSArrayLength(array); |
| 3803 | 3801 |
| 3804 } else if (expr->IsStringLength()) { | 3802 } else if (expr->IsStringLength()) { |
| 3805 HValue* string = Pop(); | 3803 HValue* string = Pop(); |
| 3806 AddInstruction(new(zone()) HCheckNonSmi(string)); | 3804 AddInstruction(new(zone()) HCheckNonSmi(string)); |
| 3807 AddInstruction(new(zone()) HCheckInstanceType(string, | 3805 AddInstruction(HCheckInstanceType::NewIsString(string)); |
| 3808 FIRST_STRING_TYPE, | |
| 3809 LAST_STRING_TYPE)); | |
| 3810 instr = new(zone()) HStringLength(string); | 3806 instr = new(zone()) HStringLength(string); |
| 3811 } else if (expr->IsStringAccess()) { | 3807 } else if (expr->IsStringAccess()) { |
| 3812 CHECK_ALIVE(VisitForValue(expr->key())); | 3808 CHECK_ALIVE(VisitForValue(expr->key())); |
| 3813 HValue* index = Pop(); | 3809 HValue* index = Pop(); |
| 3814 HValue* string = Pop(); | 3810 HValue* string = Pop(); |
| 3815 HStringCharCodeAt* char_code = BuildStringCharCodeAt(string, index); | 3811 HStringCharCodeAt* char_code = BuildStringCharCodeAt(string, index); |
| 3816 AddInstruction(char_code); | 3812 AddInstruction(char_code); |
| 3817 instr = new(zone()) HStringCharFromCode(char_code); | 3813 instr = new(zone()) HStringCharFromCode(char_code); |
| 3818 | 3814 |
| 3819 } else if (expr->IsFunctionPrototype()) { | 3815 } else if (expr->IsFunctionPrototype()) { |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4814 | 4810 |
| 4815 } else { | 4811 } else { |
| 4816 return Bailout("invalid lhs in count operation"); | 4812 return Bailout("invalid lhs in count operation"); |
| 4817 } | 4813 } |
| 4818 } | 4814 } |
| 4819 | 4815 |
| 4820 | 4816 |
| 4821 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string, | 4817 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string, |
| 4822 HValue* index) { | 4818 HValue* index) { |
| 4823 AddInstruction(new(zone()) HCheckNonSmi(string)); | 4819 AddInstruction(new(zone()) HCheckNonSmi(string)); |
| 4824 AddInstruction(new(zone()) HCheckInstanceType( | 4820 AddInstruction(HCheckInstanceType::NewIsString(string)); |
| 4825 string, FIRST_STRING_TYPE, LAST_STRING_TYPE)); | |
| 4826 HStringLength* length = new(zone()) HStringLength(string); | 4821 HStringLength* length = new(zone()) HStringLength(string); |
| 4827 AddInstruction(length); | 4822 AddInstruction(length); |
| 4828 AddInstruction(new(zone()) HBoundsCheck(index, length)); | 4823 AddInstruction(new(zone()) HBoundsCheck(index, length)); |
| 4829 return new(zone()) HStringCharCodeAt(string, index); | 4824 return new(zone()) HStringCharCodeAt(string, index); |
| 4830 } | 4825 } |
| 4831 | 4826 |
| 4832 | 4827 |
| 4833 HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr, | 4828 HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr, |
| 4834 HValue* left, | 4829 HValue* left, |
| 4835 HValue* right) { | 4830 HValue* right) { |
| 4836 TypeInfo info = oracle()->BinaryType(expr); | 4831 TypeInfo info = oracle()->BinaryType(expr); |
| 4837 HInstruction* instr = NULL; | 4832 HInstruction* instr = NULL; |
| 4838 switch (expr->op()) { | 4833 switch (expr->op()) { |
| 4839 case Token::ADD: | 4834 case Token::ADD: |
| 4840 if (info.IsString()) { | 4835 if (info.IsString()) { |
| 4841 AddInstruction(new(zone()) HCheckNonSmi(left)); | 4836 AddInstruction(new(zone()) HCheckNonSmi(left)); |
| 4842 AddInstruction(new(zone()) HCheckInstanceType( | 4837 AddInstruction(HCheckInstanceType::NewIsString(left)); |
| 4843 left, FIRST_STRING_TYPE, LAST_STRING_TYPE)); | |
| 4844 AddInstruction(new(zone()) HCheckNonSmi(right)); | 4838 AddInstruction(new(zone()) HCheckNonSmi(right)); |
| 4845 AddInstruction(new(zone()) HCheckInstanceType( | 4839 AddInstruction(HCheckInstanceType::NewIsString(right)); |
| 4846 right, FIRST_STRING_TYPE, LAST_STRING_TYPE)); | |
| 4847 instr = new(zone()) HStringAdd(left, right); | 4840 instr = new(zone()) HStringAdd(left, right); |
| 4848 } else { | 4841 } else { |
| 4849 instr = new(zone()) HAdd(left, right); | 4842 instr = new(zone()) HAdd(left, right); |
| 4850 } | 4843 } |
| 4851 break; | 4844 break; |
| 4852 case Token::SUB: | 4845 case Token::SUB: |
| 4853 instr = new(zone()) HSub(left, right); | 4846 instr = new(zone()) HSub(left, right); |
| 4854 break; | 4847 break; |
| 4855 case Token::MUL: | 4848 case Token::MUL: |
| 4856 instr = new(zone()) HMul(left, right); | 4849 instr = new(zone()) HMul(left, right); |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6097 } | 6090 } |
| 6098 } | 6091 } |
| 6099 | 6092 |
| 6100 #ifdef DEBUG | 6093 #ifdef DEBUG |
| 6101 if (graph_ != NULL) graph_->Verify(); | 6094 if (graph_ != NULL) graph_->Verify(); |
| 6102 if (allocator_ != NULL) allocator_->Verify(); | 6095 if (allocator_ != NULL) allocator_->Verify(); |
| 6103 #endif | 6096 #endif |
| 6104 } | 6097 } |
| 6105 | 6098 |
| 6106 } } // namespace v8::internal | 6099 } } // namespace v8::internal |
| OLD | NEW |