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

Side by Side Diff: src/hydrogen.cc

Issue 6528013: Implement crankshaft support for pixel array stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: tweaks Created 9 years, 10 months 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
OLDNEW
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 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after
3319 } 3319 }
3320 3320
3321 } else { 3321 } else {
3322 // Keyed store. 3322 // Keyed store.
3323 VISIT_FOR_VALUE(prop->key()); 3323 VISIT_FOR_VALUE(prop->key());
3324 VISIT_FOR_VALUE(expr->value()); 3324 VISIT_FOR_VALUE(expr->value());
3325 value = Pop(); 3325 value = Pop();
3326 HValue* key = Pop(); 3326 HValue* key = Pop();
3327 HValue* object = Pop(); 3327 HValue* object = Pop();
3328 3328
3329 bool is_fast_elements = expr->IsMonomorphic() && 3329 if (expr->IsMonomorphic()) {
3330 expr->GetMonomorphicReceiverType()->has_fast_elements(); 3330 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType());
3331 3331 // An object has either fast elements or pixel array elements, but never
3332 instr = is_fast_elements 3332 // both. Pixel array maps that are assigned to pixel array elements are
3333 ? BuildStoreKeyedFastElement(object, key, value, expr) 3333 // always created with the fast elements flag cleared.
3334 : BuildStoreKeyedGeneric(object, key, value); 3334 if (receiver_type->has_pixel_array_elements()) {
3335 instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr);
3336 } else if (receiver_type->has_fast_elements()) {
3337 instr = BuildStoreKeyedFastElement(object, key, value, expr);
3338 }
3339 }
3340 if (instr == NULL) {
3341 instr = BuildStoreKeyedGeneric(object, key, value);
3342 }
3335 } 3343 }
3336 3344
3337 Push(value); 3345 Push(value);
3338 instr->set_position(expr->position()); 3346 instr->set_position(expr->position());
3339 AddInstruction(instr); 3347 AddInstruction(instr);
3340 if (instr->HasSideEffects()) AddSimulate(expr->AssignmentId()); 3348 if (instr->HasSideEffects()) AddSimulate(expr->AssignmentId());
3341 ast_context()->ReturnValue(Pop()); 3349 ast_context()->ReturnValue(Pop());
3342 } 3350 }
3343 3351
3344 3352
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
3743 if (is_array) { 3751 if (is_array) {
3744 length = AddInstruction(new HJSArrayLength(object)); 3752 length = AddInstruction(new HJSArrayLength(object));
3745 } else { 3753 } else {
3746 length = AddInstruction(new HFixedArrayLength(elements)); 3754 length = AddInstruction(new HFixedArrayLength(elements));
3747 } 3755 }
3748 AddInstruction(new HBoundsCheck(key, length)); 3756 AddInstruction(new HBoundsCheck(key, length));
3749 return new HStoreKeyedFastElement(elements, key, val); 3757 return new HStoreKeyedFastElement(elements, key, val);
3750 } 3758 }
3751 3759
3752 3760
3761 HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement(HValue* object,
3762 HValue* key,
3763 HValue* val,
3764 Expression* expr) {
3765 ASSERT(expr->IsMonomorphic());
3766 AddInstruction(new HCheckNonSmi(object));
3767 Handle<Map> map = expr->GetMonomorphicReceiverType();
3768 ASSERT(!map->has_fast_elements());
3769 ASSERT(map->has_pixel_array_elements());
3770 AddInstruction(new HCheckMap(object, map));
3771 HLoadElements* elements = new HLoadElements(object);
3772 AddInstruction(elements);
3773 HInstruction* length = AddInstruction(new HPixelArrayLength(elements));
Kevin Millikin (Chromium) 2011/02/16 08:51:25 Wow, AddInstruction returns a value and we usually
danno 2011/02/16 13:54:22 Done.
3774 AddInstruction(new HBoundsCheck(key, length));
3775 HLoadPixelArrayExternalPointer* external_elements =
3776 new HLoadPixelArrayExternalPointer(elements);
3777 AddInstruction(external_elements);
3778 return new HStorePixelArrayElement(external_elements, key, val);
3779 }
3780
3781
3753 bool HGraphBuilder::TryArgumentsAccess(Property* expr) { 3782 bool HGraphBuilder::TryArgumentsAccess(Property* expr) {
3754 VariableProxy* proxy = expr->obj()->AsVariableProxy(); 3783 VariableProxy* proxy = expr->obj()->AsVariableProxy();
3755 if (proxy == NULL) return false; 3784 if (proxy == NULL) return false;
3756 if (!proxy->var()->IsStackAllocated()) return false; 3785 if (!proxy->var()->IsStackAllocated()) return false;
3757 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { 3786 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) {
3758 return false; 3787 return false;
3759 } 3788 }
3760 3789
3761 HInstruction* result = NULL; 3790 HInstruction* result = NULL;
3762 if (expr->key()->IsPropertyName()) { 3791 if (expr->key()->IsPropertyName()) {
(...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after
5972 } 6001 }
5973 } 6002 }
5974 6003
5975 #ifdef DEBUG 6004 #ifdef DEBUG
5976 if (graph_ != NULL) graph_->Verify(); 6005 if (graph_ != NULL) graph_->Verify();
5977 if (allocator_ != NULL) allocator_->Verify(); 6006 if (allocator_ != NULL) allocator_->Verify();
5978 #endif 6007 #endif
5979 } 6008 }
5980 6009
5981 } } // namespace v8::internal 6010 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698