| 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 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 expr->flags(), | 3011 expr->flags(), |
| 3012 expr->literal_index()); | 3012 expr->literal_index()); |
| 3013 ast_context()->ReturnInstruction(instr, expr->id()); | 3013 ast_context()->ReturnInstruction(instr, expr->id()); |
| 3014 } | 3014 } |
| 3015 | 3015 |
| 3016 | 3016 |
| 3017 void HGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 3017 void HGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
| 3018 HObjectLiteral* literal = (new HObjectLiteral(expr->constant_properties(), | 3018 HObjectLiteral* literal = (new HObjectLiteral(expr->constant_properties(), |
| 3019 expr->fast_elements(), | 3019 expr->fast_elements(), |
| 3020 expr->literal_index(), | 3020 expr->literal_index(), |
| 3021 expr->depth())); | 3021 expr->depth(), |
| 3022 expr->has_function())); |
| 3022 // The object is expected in the bailout environment during computation | 3023 // The object is expected in the bailout environment during computation |
| 3023 // of the property values and is the value of the entire expression. | 3024 // of the property values and is the value of the entire expression. |
| 3024 PushAndAdd(literal); | 3025 PushAndAdd(literal); |
| 3025 | 3026 |
| 3026 expr->CalculateEmitStore(); | 3027 expr->CalculateEmitStore(); |
| 3027 | 3028 |
| 3028 for (int i = 0; i < expr->properties()->length(); i++) { | 3029 for (int i = 0; i < expr->properties()->length(); i++) { |
| 3029 ObjectLiteral::Property* property = expr->properties()->at(i); | 3030 ObjectLiteral::Property* property = expr->properties()->at(i); |
| 3030 if (property->IsCompileTimeValue()) continue; | 3031 if (property->IsCompileTimeValue()) continue; |
| 3031 | 3032 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3050 break; | 3051 break; |
| 3051 } | 3052 } |
| 3052 // Fall through. | 3053 // Fall through. |
| 3053 case ObjectLiteral::Property::PROTOTYPE: | 3054 case ObjectLiteral::Property::PROTOTYPE: |
| 3054 case ObjectLiteral::Property::SETTER: | 3055 case ObjectLiteral::Property::SETTER: |
| 3055 case ObjectLiteral::Property::GETTER: | 3056 case ObjectLiteral::Property::GETTER: |
| 3056 BAILOUT("Object literal with complex property"); | 3057 BAILOUT("Object literal with complex property"); |
| 3057 default: UNREACHABLE(); | 3058 default: UNREACHABLE(); |
| 3058 } | 3059 } |
| 3059 } | 3060 } |
| 3061 |
| 3062 if (expr->has_function()) { |
| 3063 AddInstruction(new HToFastProperties(Top())); |
| 3064 } |
| 3065 |
| 3060 ast_context()->ReturnValue(Pop()); | 3066 ast_context()->ReturnValue(Pop()); |
| 3061 } | 3067 } |
| 3062 | 3068 |
| 3063 | 3069 |
| 3064 void HGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 3070 void HGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
| 3065 ZoneList<Expression*>* subexprs = expr->values(); | 3071 ZoneList<Expression*>* subexprs = expr->values(); |
| 3066 int length = subexprs->length(); | 3072 int length = subexprs->length(); |
| 3067 | 3073 |
| 3068 HArrayLiteral* literal = new HArrayLiteral(expr->constant_elements(), | 3074 HArrayLiteral* literal = new HArrayLiteral(expr->constant_elements(), |
| 3069 length, | 3075 length, |
| (...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5894 } | 5900 } |
| 5895 } | 5901 } |
| 5896 | 5902 |
| 5897 #ifdef DEBUG | 5903 #ifdef DEBUG |
| 5898 if (graph_ != NULL) graph_->Verify(); | 5904 if (graph_ != NULL) graph_->Verify(); |
| 5899 if (allocator_ != NULL) allocator_->Verify(); | 5905 if (allocator_ != NULL) allocator_->Verify(); |
| 5900 #endif | 5906 #endif |
| 5901 } | 5907 } |
| 5902 | 5908 |
| 5903 } } // namespace v8::internal | 5909 } } // namespace v8::internal |
| OLD | NEW |