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

Side by Side Diff: src/hydrogen.cc

Issue 7112010: Plumbing changes to merge various element kind implementaions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 6 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
« no previous file with comments | « src/heap.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after
3740 HLoadElements* elements = new(zone()) HLoadElements(object); 3740 HLoadElements* elements = new(zone()) HLoadElements(object);
3741 AddInstruction(elements); 3741 AddInstruction(elements);
3742 HInstruction* length = new(zone()) HExternalArrayLength(elements); 3742 HInstruction* length = new(zone()) HExternalArrayLength(elements);
3743 AddInstruction(length); 3743 AddInstruction(length);
3744 AddInstruction(new(zone()) HBoundsCheck(key, length)); 3744 AddInstruction(new(zone()) HBoundsCheck(key, length));
3745 HLoadExternalArrayPointer* external_elements = 3745 HLoadExternalArrayPointer* external_elements =
3746 new(zone()) HLoadExternalArrayPointer(elements); 3746 new(zone()) HLoadExternalArrayPointer(elements);
3747 AddInstruction(external_elements); 3747 AddInstruction(external_elements);
3748 HLoadKeyedSpecializedArrayElement* pixel_array_value = 3748 HLoadKeyedSpecializedArrayElement* pixel_array_value =
3749 new(zone()) HLoadKeyedSpecializedArrayElement( 3749 new(zone()) HLoadKeyedSpecializedArrayElement(
3750 external_elements, key, expr->external_array_type()); 3750 external_elements, key, map->elements_kind());
3751 return pixel_array_value; 3751 return pixel_array_value;
3752 } 3752 }
3753 3753
3754 3754
3755 HInstruction* HGraphBuilder::BuildLoadKeyed(HValue* obj, 3755 HInstruction* HGraphBuilder::BuildLoadKeyed(HValue* obj,
3756 HValue* key, 3756 HValue* key,
3757 Property* prop) { 3757 Property* prop) {
3758 if (prop->IsMonomorphic()) { 3758 if (prop->IsMonomorphic()) {
3759 Handle<Map> receiver_type(prop->GetMonomorphicReceiverType()); 3759 Handle<Map> receiver_type(prop->GetMonomorphicReceiverType());
3760 // An object has either fast elements or pixel array elements, but never 3760 // An object has either fast elements or pixel array elements, but never
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3819 ASSERT(map->has_external_array_elements()); 3819 ASSERT(map->has_external_array_elements());
3820 AddInstruction(new(zone()) HCheckMap(object, map)); 3820 AddInstruction(new(zone()) HCheckMap(object, map));
3821 HLoadElements* elements = new(zone()) HLoadElements(object); 3821 HLoadElements* elements = new(zone()) HLoadElements(object);
3822 AddInstruction(elements); 3822 AddInstruction(elements);
3823 HInstruction* length = AddInstruction( 3823 HInstruction* length = AddInstruction(
3824 new(zone()) HExternalArrayLength(elements)); 3824 new(zone()) HExternalArrayLength(elements));
3825 AddInstruction(new(zone()) HBoundsCheck(key, length)); 3825 AddInstruction(new(zone()) HBoundsCheck(key, length));
3826 HLoadExternalArrayPointer* external_elements = 3826 HLoadExternalArrayPointer* external_elements =
3827 new(zone()) HLoadExternalArrayPointer(elements); 3827 new(zone()) HLoadExternalArrayPointer(elements);
3828 AddInstruction(external_elements); 3828 AddInstruction(external_elements);
3829 ExternalArrayType array_type = expr->external_array_type(); 3829 JSObject::ElementsKind elements_kind = map->elements_kind();
3830 switch (array_type) { 3830 switch (elements_kind) {
3831 case kExternalPixelArray: { 3831 case JSObject::EXTERNAL_PIXEL_ELEMENTS: {
3832 HClampToUint8* clamp = new(zone()) HClampToUint8(val); 3832 HClampToUint8* clamp = new(zone()) HClampToUint8(val);
3833 AddInstruction(clamp); 3833 AddInstruction(clamp);
3834 val = clamp; 3834 val = clamp;
3835 break; 3835 break;
3836 } 3836 }
3837 case kExternalByteArray: 3837 case JSObject::EXTERNAL_BYTE_ELEMENTS:
3838 case kExternalUnsignedByteArray: 3838 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3839 case kExternalShortArray: 3839 case JSObject::EXTERNAL_SHORT_ELEMENTS:
3840 case kExternalUnsignedShortArray: 3840 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3841 case kExternalIntArray: 3841 case JSObject::EXTERNAL_INT_ELEMENTS:
3842 case kExternalUnsignedIntArray: { 3842 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: {
3843 HToInt32* floor_val = new(zone()) HToInt32(val); 3843 HToInt32* floor_val = new(zone()) HToInt32(val);
3844 AddInstruction(floor_val); 3844 AddInstruction(floor_val);
3845 val = floor_val; 3845 val = floor_val;
3846 break; 3846 break;
3847 } 3847 }
3848 case kExternalFloatArray: 3848 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
3849 case kExternalDoubleArray: 3849 case JSObject::EXTERNAL_DOUBLE_ELEMENTS:
3850 case JSObject::FAST_ELEMENTS:
3851 case JSObject::FAST_DOUBLE_ELEMENTS:
3852 case JSObject::DICTIONARY_ELEMENTS:
3853 UNREACHABLE();
3850 break; 3854 break;
3851 } 3855 }
3852 return new(zone()) HStoreKeyedSpecializedArrayElement( 3856 return new(zone()) HStoreKeyedSpecializedArrayElement(
3853 external_elements, 3857 external_elements,
3854 key, 3858 key,
3855 val, 3859 val,
3856 expr->external_array_type()); 3860 map->elements_kind());
3857 } 3861 }
3858 3862
3859 3863
3860 HInstruction* HGraphBuilder::BuildStoreKeyed(HValue* object, 3864 HInstruction* HGraphBuilder::BuildStoreKeyed(HValue* object,
3861 HValue* key, 3865 HValue* key,
3862 HValue* value, 3866 HValue* value,
3863 Expression* expr) { 3867 Expression* expr) {
3864 if (expr->IsMonomorphic()) { 3868 if (expr->IsMonomorphic()) {
3865 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); 3869 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType());
3866 // An object has either fast elements or external array elements, but 3870 // An object has either fast elements or external array elements, but
(...skipping 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after
6339 } 6343 }
6340 } 6344 }
6341 6345
6342 #ifdef DEBUG 6346 #ifdef DEBUG
6343 if (graph_ != NULL) graph_->Verify(); 6347 if (graph_ != NULL) graph_->Verify();
6344 if (allocator_ != NULL) allocator_->Verify(); 6348 if (allocator_ != NULL) allocator_->Verify();
6345 #endif 6349 #endif
6346 } 6350 }
6347 6351
6348 } } // namespace v8::internal 6352 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698