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

Side by Side Diff: src/hydrogen.cc

Issue 7285001: Add support for dictionary elements to polymorphic crankshaft code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 | « no previous file | src/ic.cc » ('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 3899 matching lines...) Expand 10 before | Expand all | Expand 10 after
3910 } 3910 }
3911 3911
3912 for (int i = 0; i < maps->length(); ++i) { 3912 for (int i = 0; i < maps->length(); ++i) {
3913 ASSERT(maps->at(i)->IsMap()); 3913 ASSERT(maps->at(i)->IsMap());
3914 type_todo[maps->at(i)->elements_kind()] = true; 3914 type_todo[maps->at(i)->elements_kind()] = true;
3915 if (maps->at(i)->elements_kind() 3915 if (maps->at(i)->elements_kind()
3916 >= JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) { 3916 >= JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND) {
3917 todo_external_array = true; 3917 todo_external_array = true;
3918 } 3918 }
3919 } 3919 }
3920 // We can't treat dictionary elements here (need to deopt instead).
3921 type_todo[JSObject::DICTIONARY_ELEMENTS] = false;
3922 // Support for FAST_DOUBLE_ELEMENTS isn't implemented yet, so we deopt. 3920 // Support for FAST_DOUBLE_ELEMENTS isn't implemented yet, so we deopt.
3923 type_todo[JSObject::FAST_DOUBLE_ELEMENTS] = false; 3921 type_todo[JSObject::FAST_DOUBLE_ELEMENTS] = false;
3924 3922
3925 HBasicBlock* join = graph()->CreateBasicBlock(); 3923 HBasicBlock* join = graph()->CreateBasicBlock();
3926 3924
3927 HInstruction* elements_kind_instr = 3925 HInstruction* elements_kind_instr =
3928 AddInstruction(new(zone()) HElementsKind(object)); 3926 AddInstruction(new(zone()) HElementsKind(object));
3929 HInstruction* elements = NULL; 3927 HInstruction* elements = NULL;
3930 HLoadExternalArrayPointer* external_elements = NULL; 3928 HLoadExternalArrayPointer* external_elements = NULL;
3931 HInstruction* checked_key = NULL; 3929 HInstruction* checked_key = NULL;
3932 3930
3933 // FAST_ELEMENTS is assumed to be the first case. 3931 // FAST_ELEMENTS is assumed to be the first case.
3934 STATIC_ASSERT(JSObject::FAST_ELEMENTS == 0); 3932 STATIC_ASSERT(JSObject::FAST_ELEMENTS == 0);
3935 3933
3936 for (JSObject::ElementsKind elements_kind = JSObject::FAST_ELEMENTS; 3934 for (JSObject::ElementsKind elements_kind = JSObject::FAST_ELEMENTS;
3937 elements_kind <= JSObject::LAST_ELEMENTS_KIND; 3935 elements_kind <= JSObject::LAST_ELEMENTS_KIND;
3938 elements_kind = JSObject::ElementsKind(elements_kind + 1)) { 3936 elements_kind = JSObject::ElementsKind(elements_kind + 1)) {
3939 // After having handled FAST_ELEMENTS in the first run of the loop, we 3937 // After having handled FAST_ELEMENTS and DICTIONARY_ELEMENTS, we
3940 // need to add some code that's executed for all other cases. 3938 // need to add some code that's executed for all other cases.
3941 if (elements_kind == 1 && todo_external_array) { 3939 if (elements_kind == JSObject::DICTIONARY_ELEMENTS + 1
danno 2011/06/29 14:16:35 How about a static assert that verifies that DICTI
3940 && todo_external_array) {
3942 elements = AddInstruction(new(zone()) HLoadElements(object)); 3941 elements = AddInstruction(new(zone()) HLoadElements(object));
3943 // We need to forcibly prevent some ElementsKind-dependent instructions 3942 // We need to forcibly prevent some ElementsKind-dependent instructions
3944 // from being hoisted out of any loops they might occur in, because 3943 // from being hoisted out of any loops they might occur in, because
3945 // the current loop-invariant-code-motion algorithm isn't clever enough 3944 // the current loop-invariant-code-motion algorithm isn't clever enough
3946 // to deal with them properly. 3945 // to deal with them properly.
3947 // There's some performance to be gained by developing a smarter 3946 // There's some performance to be gained by developing a smarter
3948 // solution for this. 3947 // solution for this.
3949 elements->ClearFlag(HValue::kUseGVN); 3948 elements->ClearFlag(HValue::kUseGVN);
3950 HInstruction* length = 3949 HInstruction* length =
3951 AddInstruction(new(zone()) HExternalArrayLength(elements)); 3950 AddInstruction(new(zone()) HExternalArrayLength(elements));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4000 elements->ClearFlag(HValue::kUseGVN); 3999 elements->ClearFlag(HValue::kUseGVN);
4001 length = AddInstruction(new(zone()) HFixedArrayLength(elements)); 4000 length = AddInstruction(new(zone()) HFixedArrayLength(elements));
4002 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); 4001 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length));
4003 if (is_store) { 4002 if (is_store) {
4004 access = AddInstruction( 4003 access = AddInstruction(
4005 new(zone()) HStoreKeyedFastElement(elements, checked_key, val)); 4004 new(zone()) HStoreKeyedFastElement(elements, checked_key, val));
4006 } else { 4005 } else {
4007 access = AddInstruction( 4006 access = AddInstruction(
4008 new(zone()) HLoadKeyedFastElement(elements, checked_key)); 4007 new(zone()) HLoadKeyedFastElement(elements, checked_key));
4009 } 4008 }
4009 } else if (elements_kind == JSObject::DICTIONARY_ELEMENTS) {
4010 if (is_store) {
4011 access = BuildStoreKeyedGeneric(object, key, val);
4012 } else {
4013 access = BuildLoadKeyedGeneric(object, key);
4014 }
4010 } else { // External array elements. 4015 } else { // External array elements.
4011 access = AddInstruction(BuildExternalArrayElementAccess( 4016 access = AddInstruction(BuildExternalArrayElementAccess(
4012 external_elements, checked_key, val, elements_kind, is_store)); 4017 external_elements, checked_key, val, elements_kind, is_store));
4013 } 4018 }
4014 *has_side_effects |= access->HasSideEffects(); 4019 *has_side_effects |= access->HasSideEffects();
4015 access->set_position(position); 4020 access->set_position(position);
4016 if (!is_store) { 4021 if (!is_store) {
4017 Push(access); 4022 Push(access);
4018 } 4023 }
4019 current_block()->Goto(join); 4024 current_block()->Goto(join);
(...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after
6585 } 6590 }
6586 } 6591 }
6587 6592
6588 #ifdef DEBUG 6593 #ifdef DEBUG
6589 if (graph_ != NULL) graph_->Verify(); 6594 if (graph_ != NULL) graph_->Verify();
6590 if (allocator_ != NULL) allocator_->Verify(); 6595 if (allocator_ != NULL) allocator_->Verify();
6591 #endif 6596 #endif
6592 } 6597 }
6593 6598
6594 } } // namespace v8::internal 6599 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698