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

Side by Side Diff: src/hydrogen.cc

Issue 6410112: Implement crankshaft support for pixel array loads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ia32 working 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 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 AddInstruction(elements); 3727 AddInstruction(elements);
3728 } else { 3728 } else {
3729 AddInstruction(elements); 3729 AddInstruction(elements);
3730 length = AddInstruction(new HFixedArrayLength(elements)); 3730 length = AddInstruction(new HFixedArrayLength(elements));
3731 AddInstruction(new HBoundsCheck(key, length)); 3731 AddInstruction(new HBoundsCheck(key, length));
3732 } 3732 }
3733 return new HLoadKeyedFastElement(elements, key); 3733 return new HLoadKeyedFastElement(elements, key);
3734 } 3734 }
3735 3735
3736 3736
3737 HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object,
3738 HValue* key,
3739 Property* expr) {
3740 ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic());
3741 AddInstruction(new HCheckNonSmi(object));
3742 Handle<Map> map = expr->GetMonomorphicReceiverType();
3743 ASSERT(!map->has_fast_elements());
3744 ASSERT(map->has_pixel_array_elements());
3745 AddInstruction(new HCheckMap(object, map));
3746 HLoadElements* elements = new HLoadElements(object);
3747 AddInstruction(elements);
3748 HInstruction* length = AddInstruction(new HPixelArrayLength(elements));
3749 AddInstruction(new HBoundsCheck(key, length));
3750 HLoadPixelArrayExternalPointer* external_elements =
3751 new HLoadPixelArrayExternalPointer(elements);
3752 AddInstruction(external_elements);
3753 HLoadPixelArrayElement* pixel_array_value = new HLoadPixelArrayElement(
Mads Ager (chromium) 2011/02/07 11:36:06 Move everything to a new line?
danno 2011/02/08 09:25:57 Done.
3754 external_elements,
3755 key);
3756 return pixel_array_value;
3757 }
3758
3759
3737 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, 3760 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object,
3738 HValue* key, 3761 HValue* key,
3739 HValue* value) { 3762 HValue* value) {
3740 return new HStoreKeyedGeneric(object, key, value); 3763 return new HStoreKeyedGeneric(object, key, value);
3741 } 3764 }
3742 3765
3743 3766
3744 HInstruction* HGraphBuilder::BuildStoreKeyedFastElement(HValue* object, 3767 HInstruction* HGraphBuilder::BuildStoreKeyedFastElement(HValue* object,
3745 HValue* key, 3768 HValue* key,
3746 HValue* val, 3769 HValue* val,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3834 } else { 3857 } else {
3835 instr = BuildLoadNamedGeneric(obj, expr); 3858 instr = BuildLoadNamedGeneric(obj, expr);
3836 } 3859 }
3837 3860
3838 } else { 3861 } else {
3839 VISIT_FOR_VALUE(expr->key()); 3862 VISIT_FOR_VALUE(expr->key());
3840 3863
3841 HValue* key = Pop(); 3864 HValue* key = Pop();
3842 HValue* obj = Pop(); 3865 HValue* obj = Pop();
3843 3866
3844 bool is_fast_elements = expr->IsMonomorphic() && 3867 if (expr->IsMonomorphic()) {
3845 expr->GetMonomorphicReceiverType()->has_fast_elements(); 3868 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType());
3846 3869 if (receiver_type->has_pixel_array_elements()) {
Kevin Millikin (Chromium) 2011/02/07 12:39:08 I guess from the assert above that it's the case t
danno 2011/02/08 09:25:57 Done.
3847 instr = is_fast_elements 3870 instr = BuildLoadKeyedPixelArrayElement(obj, key, expr);
3848 ? BuildLoadKeyedFastElement(obj, key, expr) 3871 } else if (receiver_type->has_fast_elements()) {
3849 : BuildLoadKeyedGeneric(obj, key); 3872 instr = BuildLoadKeyedFastElement(obj, key, expr);
3873 }
3874 }
3875 if (instr == NULL) {
3876 instr = BuildLoadKeyedGeneric(obj, key);
3877 }
3850 } 3878 }
3851 instr->set_position(expr->position()); 3879 instr->set_position(expr->position());
3852 ast_context()->ReturnInstruction(instr, expr->id()); 3880 ast_context()->ReturnInstruction(instr, expr->id());
3853 } 3881 }
3854 3882
3855 3883
3856 void HGraphBuilder::AddCheckConstantFunction(Call* expr, 3884 void HGraphBuilder::AddCheckConstantFunction(Call* expr,
3857 HValue* receiver, 3885 HValue* receiver,
3858 Handle<Map> receiver_map, 3886 Handle<Map> receiver_map,
3859 bool smi_and_map_check) { 3887 bool smi_and_map_check) {
(...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after
5924 } 5952 }
5925 } 5953 }
5926 5954
5927 #ifdef DEBUG 5955 #ifdef DEBUG
5928 if (graph_ != NULL) graph_->Verify(); 5956 if (graph_ != NULL) graph_->Verify();
5929 if (allocator_ != NULL) allocator_->Verify(); 5957 if (allocator_ != NULL) allocator_->Verify();
5930 #endif 5958 #endif
5931 } 5959 }
5932 5960
5933 } } // namespace v8::internal 5961 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698