Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: src/hydrogen.cc

Issue 5697006: Emit a load of the elements array only before the first store.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 ZoneList<Expression*>* subexprs = expr->values(); 3016 ZoneList<Expression*>* subexprs = expr->values();
3017 int length = subexprs->length(); 3017 int length = subexprs->length();
3018 3018
3019 HArrayLiteral* literal = new HArrayLiteral(expr->constant_elements(), 3019 HArrayLiteral* literal = new HArrayLiteral(expr->constant_elements(),
3020 length, 3020 length,
3021 expr->literal_index(), 3021 expr->literal_index(),
3022 expr->depth()); 3022 expr->depth());
3023 // The array is expected in the bailout environment during computation 3023 // The array is expected in the bailout environment during computation
3024 // 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.
3025 PushAndAdd(literal); 3025 PushAndAdd(literal);
3026 HValue* elements = AddInstruction(new HLoadElements(literal)); 3026
3027 HLoadElements* elements = NULL;
3027 3028
3028 for (int i = 0; i < length; i++) { 3029 for (int i = 0; i < length; i++) {
3029 Expression* subexpr = subexprs->at(i); 3030 Expression* subexpr = subexprs->at(i);
3030 // If the subexpression is a literal or a simple materialized literal it 3031 // If the subexpression is a literal or a simple materialized literal it
3031 // is already set in the cloned array. 3032 // is already set in the cloned array.
3032 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 3033 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
3033 3034
3034 VISIT_FOR_VALUE(subexpr); 3035 VISIT_FOR_VALUE(subexpr);
3035 HValue* value = Pop(); 3036 HValue* value = Pop();
3036 if (!Smi::IsValid(i)) BAILOUT("Non-smi key in array literal"); 3037 if (!Smi::IsValid(i)) BAILOUT("Non-smi key in array literal");
3038
3039 // Load the elements array before the first store.
3040 if (elements == NULL) {
3041 elements = new HLoadElements(literal);
3042 AddInstruction(elements);
3043 }
3044
3037 HValue* key = AddInstruction(new HConstant(Handle<Object>(Smi::FromInt(i)), 3045 HValue* key = AddInstruction(new HConstant(Handle<Object>(Smi::FromInt(i)),
3038 Representation::Integer32())); 3046 Representation::Integer32()));
3039 AddInstruction(new HStoreKeyedFastElement(elements, key, value)); 3047 AddInstruction(new HStoreKeyedFastElement(elements, key, value));
3040 AddSimulate(expr->GetIdForElement(i)); 3048 AddSimulate(expr->GetIdForElement(i));
3041 } 3049 }
3042 ast_context()->ReturnValue(Pop()); 3050 ast_context()->ReturnValue(Pop());
3043 } 3051 }
3044 3052
3045 3053
3046 void HGraphBuilder::VisitCatchExtensionObject(CatchExtensionObject* expr) { 3054 void HGraphBuilder::VisitCatchExtensionObject(CatchExtensionObject* expr) {
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
5671 } 5679 }
5672 5680
5673 #ifdef DEBUG 5681 #ifdef DEBUG
5674 if (graph_ != NULL) graph_->Verify(); 5682 if (graph_ != NULL) graph_->Verify();
5675 if (chunk_ != NULL) chunk_->Verify(); 5683 if (chunk_ != NULL) chunk_->Verify();
5676 if (allocator_ != NULL) allocator_->Verify(); 5684 if (allocator_ != NULL) allocator_->Verify();
5677 #endif 5685 #endif
5678 } 5686 }
5679 5687
5680 } } // namespace v8::internal 5688 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698