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

Side by Side Diff: src/hydrogen.cc

Issue 6546036: Combine typed and pixel arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with latest Created 9 years, 9 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 3264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3275 } else { 3275 } else {
3276 // Keyed store. 3276 // Keyed store.
3277 VISIT_FOR_VALUE(prop->key()); 3277 VISIT_FOR_VALUE(prop->key());
3278 VISIT_FOR_VALUE(expr->value()); 3278 VISIT_FOR_VALUE(expr->value());
3279 value = Pop(); 3279 value = Pop();
3280 HValue* key = Pop(); 3280 HValue* key = Pop();
3281 HValue* object = Pop(); 3281 HValue* object = Pop();
3282 3282
3283 if (expr->IsMonomorphic()) { 3283 if (expr->IsMonomorphic()) {
3284 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); 3284 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType());
3285 // An object has either fast elements or pixel array elements, but never 3285 // An object has either fast elements or external array elements, but
3286 // both. Pixel array maps that are assigned to pixel array elements are 3286 // never both. Pixel array maps that are assigned to pixel array elements
3287 // always created with the fast elements flag cleared. 3287 // are always created with the fast elements flag cleared.
3288 if (receiver_type->has_pixel_array_elements()) { 3288 if (receiver_type->has_external_array_elements()) {
3289 instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr); 3289 if (expr->GetExternalArrayType() == kExternalPixelArray) {
3290 instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr);
3291 }
3290 } else if (receiver_type->has_fast_elements()) { 3292 } else if (receiver_type->has_fast_elements()) {
3291 instr = BuildStoreKeyedFastElement(object, key, value, expr); 3293 instr = BuildStoreKeyedFastElement(object, key, value, expr);
3292 } 3294 }
3293 } 3295 }
3294 if (instr == NULL) { 3296 if (instr == NULL) {
3295 instr = BuildStoreKeyedGeneric(object, key, value); 3297 instr = BuildStoreKeyedGeneric(object, key, value);
3296 } 3298 }
3297 } 3299 }
3298 3300
3299 Push(value); 3301 Push(value);
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 } 3664 }
3663 3665
3664 3666
3665 HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object, 3667 HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object,
3666 HValue* key, 3668 HValue* key,
3667 Property* expr) { 3669 Property* expr) {
3668 ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic()); 3670 ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic());
3669 AddInstruction(new HCheckNonSmi(object)); 3671 AddInstruction(new HCheckNonSmi(object));
3670 Handle<Map> map = expr->GetMonomorphicReceiverType(); 3672 Handle<Map> map = expr->GetMonomorphicReceiverType();
3671 ASSERT(!map->has_fast_elements()); 3673 ASSERT(!map->has_fast_elements());
3672 ASSERT(map->has_pixel_array_elements()); 3674 ASSERT(map->has_external_array_elements());
3673 AddInstruction(new HCheckMap(object, map)); 3675 AddInstruction(new HCheckMap(object, map));
3674 HLoadElements* elements = new HLoadElements(object); 3676 HLoadElements* elements = new HLoadElements(object);
3675 AddInstruction(elements); 3677 AddInstruction(elements);
3676 HInstruction* length = new HPixelArrayLength(elements); 3678 HInstruction* length = new HExternalArrayLength(elements);
3677 AddInstruction(length); 3679 AddInstruction(length);
3678 AddInstruction(new HBoundsCheck(key, length)); 3680 AddInstruction(new HBoundsCheck(key, length));
3679 HLoadPixelArrayExternalPointer* external_elements = 3681 HLoadExternalArrayPointer* external_elements =
3680 new HLoadPixelArrayExternalPointer(elements); 3682 new HLoadExternalArrayPointer(elements);
3681 AddInstruction(external_elements); 3683 AddInstruction(external_elements);
3682 HLoadPixelArrayElement* pixel_array_value = 3684 HLoadPixelArrayElement* pixel_array_value =
3683 new HLoadPixelArrayElement(external_elements, key); 3685 new HLoadPixelArrayElement(external_elements, key);
3684 return pixel_array_value; 3686 return pixel_array_value;
3685 } 3687 }
3686 3688
3687 3689
3688 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, 3690 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object,
3689 HValue* key, 3691 HValue* key,
3690 HValue* value) { 3692 HValue* value) {
(...skipping 28 matching lines...) Expand all
3719 3721
3720 HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement( 3722 HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement(
3721 HValue* object, 3723 HValue* object,
3722 HValue* key, 3724 HValue* key,
3723 HValue* val, 3725 HValue* val,
3724 Expression* expr) { 3726 Expression* expr) {
3725 ASSERT(expr->IsMonomorphic()); 3727 ASSERT(expr->IsMonomorphic());
3726 AddInstruction(new HCheckNonSmi(object)); 3728 AddInstruction(new HCheckNonSmi(object));
3727 Handle<Map> map = expr->GetMonomorphicReceiverType(); 3729 Handle<Map> map = expr->GetMonomorphicReceiverType();
3728 ASSERT(!map->has_fast_elements()); 3730 ASSERT(!map->has_fast_elements());
3729 ASSERT(map->has_pixel_array_elements()); 3731 ASSERT(map->has_external_array_elements());
3730 AddInstruction(new HCheckMap(object, map)); 3732 AddInstruction(new HCheckMap(object, map));
3731 HLoadElements* elements = new HLoadElements(object); 3733 HLoadElements* elements = new HLoadElements(object);
3732 AddInstruction(elements); 3734 AddInstruction(elements);
3733 HInstruction* length = AddInstruction(new HPixelArrayLength(elements)); 3735 HInstruction* length = AddInstruction(new HExternalArrayLength(elements));
3734 AddInstruction(new HBoundsCheck(key, length)); 3736 AddInstruction(new HBoundsCheck(key, length));
3735 HLoadPixelArrayExternalPointer* external_elements = 3737 HLoadExternalArrayPointer* external_elements =
3736 new HLoadPixelArrayExternalPointer(elements); 3738 new HLoadExternalArrayPointer(elements);
3737 AddInstruction(external_elements); 3739 AddInstruction(external_elements);
3738 return new HStorePixelArrayElement(external_elements, key, val); 3740 return new HStorePixelArrayElement(external_elements, key, val);
3739 } 3741 }
3740 3742
3741 3743
3742 bool HGraphBuilder::TryArgumentsAccess(Property* expr) { 3744 bool HGraphBuilder::TryArgumentsAccess(Property* expr) {
3743 VariableProxy* proxy = expr->obj()->AsVariableProxy(); 3745 VariableProxy* proxy = expr->obj()->AsVariableProxy();
3744 if (proxy == NULL) return false; 3746 if (proxy == NULL) return false;
3745 if (!proxy->var()->IsStackAllocated()) return false; 3747 if (!proxy->var()->IsStackAllocated()) return false;
3746 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { 3748 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3816 VISIT_FOR_VALUE(expr->key()); 3818 VISIT_FOR_VALUE(expr->key());
3817 3819
3818 HValue* key = Pop(); 3820 HValue* key = Pop();
3819 HValue* obj = Pop(); 3821 HValue* obj = Pop();
3820 3822
3821 if (expr->IsMonomorphic()) { 3823 if (expr->IsMonomorphic()) {
3822 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); 3824 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType());
3823 // An object has either fast elements or pixel array elements, but never 3825 // An object has either fast elements or pixel array elements, but never
3824 // both. Pixel array maps that are assigned to pixel array elements are 3826 // both. Pixel array maps that are assigned to pixel array elements are
3825 // always created with the fast elements flag cleared. 3827 // always created with the fast elements flag cleared.
3826 if (receiver_type->has_pixel_array_elements()) { 3828 if (receiver_type->has_external_array_elements()) {
3827 instr = BuildLoadKeyedPixelArrayElement(obj, key, expr); 3829 if (expr->GetExternalArrayType() == kExternalPixelArray) {
3830 instr = BuildLoadKeyedPixelArrayElement(obj, key, expr);
3831 }
3828 } else if (receiver_type->has_fast_elements()) { 3832 } else if (receiver_type->has_fast_elements()) {
3829 instr = BuildLoadKeyedFastElement(obj, key, expr); 3833 instr = BuildLoadKeyedFastElement(obj, key, expr);
3830 } 3834 }
3831 } 3835 }
3832 if (instr == NULL) { 3836 if (instr == NULL) {
3833 instr = BuildLoadKeyedGeneric(obj, key); 3837 instr = BuildLoadKeyedGeneric(obj, key);
3834 } 3838 }
3835 } 3839 }
3836 instr->set_position(expr->position()); 3840 instr->set_position(expr->position());
3837 ast_context()->ReturnInstruction(instr, expr->id()); 3841 ast_context()->ReturnInstruction(instr, expr->id());
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after
5984 } 5988 }
5985 } 5989 }
5986 5990
5987 #ifdef DEBUG 5991 #ifdef DEBUG
5988 if (graph_ != NULL) graph_->Verify(); 5992 if (graph_ != NULL) graph_->Verify();
5989 if (allocator_ != NULL) allocator_->Verify(); 5993 if (allocator_ != NULL) allocator_->Verify();
5990 #endif 5994 #endif
5991 } 5995 }
5992 5996
5993 } } // namespace v8::internal 5997 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/hydrogen-instructions.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698