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

Side by Side Diff: src/hydrogen.cc

Issue 10735020: Optimize Smi keys for KeyedLoads (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with latest Created 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5828 matching lines...) Expand 10 before | Expand all | Expand 10 after
5839 if (is_store && (fast_elements || fast_smi_only_elements)) { 5839 if (is_store && (fast_elements || fast_smi_only_elements)) {
5840 HCheckMaps* check_cow_map = new(zone()) HCheckMaps( 5840 HCheckMaps* check_cow_map = new(zone()) HCheckMaps(
5841 elements, isolate()->factory()->fixed_array_map(), zone()); 5841 elements, isolate()->factory()->fixed_array_map(), zone());
5842 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); 5842 check_cow_map->ClearGVNFlag(kDependsOnElementsKind);
5843 AddInstruction(check_cow_map); 5843 AddInstruction(check_cow_map);
5844 } 5844 }
5845 HInstruction* length = NULL; 5845 HInstruction* length = NULL;
5846 HInstruction* checked_key = NULL; 5846 HInstruction* checked_key = NULL;
5847 if (map->has_external_array_elements()) { 5847 if (map->has_external_array_elements()) {
5848 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); 5848 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements));
5849 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); 5849 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length,
5850 ALLOW_SMI_KEY));
5850 HLoadExternalArrayPointer* external_elements = 5851 HLoadExternalArrayPointer* external_elements =
5851 new(zone()) HLoadExternalArrayPointer(elements); 5852 new(zone()) HLoadExternalArrayPointer(elements);
5852 AddInstruction(external_elements); 5853 AddInstruction(external_elements);
5853 return BuildExternalArrayElementAccess(external_elements, checked_key, 5854 return BuildExternalArrayElementAccess(external_elements, checked_key,
5854 val, map->elements_kind(), is_store); 5855 val, map->elements_kind(), is_store);
5855 } 5856 }
5856 ASSERT(fast_smi_only_elements || 5857 ASSERT(fast_smi_only_elements ||
5857 fast_elements || 5858 fast_elements ||
5858 map->has_fast_double_elements()); 5859 map->has_fast_double_elements());
5859 if (map->instance_type() == JS_ARRAY_TYPE) { 5860 if (map->instance_type() == JS_ARRAY_TYPE) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
6072 HHasInstanceTypeAndBranch* typecheck = 6073 HHasInstanceTypeAndBranch* typecheck =
6073 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE); 6074 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE);
6074 typecheck->SetSuccessorAt(0, if_jsarray); 6075 typecheck->SetSuccessorAt(0, if_jsarray);
6075 typecheck->SetSuccessorAt(1, if_fastobject); 6076 typecheck->SetSuccessorAt(1, if_fastobject);
6076 current_block()->Finish(typecheck); 6077 current_block()->Finish(typecheck);
6077 6078
6078 set_current_block(if_jsarray); 6079 set_current_block(if_jsarray);
6079 HInstruction* length; 6080 HInstruction* length;
6080 length = AddInstruction(new(zone()) HJSArrayLength(object, typecheck, 6081 length = AddInstruction(new(zone()) HJSArrayLength(object, typecheck,
6081 HType::Smi())); 6082 HType::Smi()));
6082 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); 6083 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length,
6084 ALLOW_SMI_KEY));
6083 access = AddInstruction(BuildFastElementAccess( 6085 access = AddInstruction(BuildFastElementAccess(
6084 elements, checked_key, val, elements_kind, is_store)); 6086 elements, checked_key, val, elements_kind, is_store));
6085 if (!is_store) { 6087 if (!is_store) {
6086 Push(access); 6088 Push(access);
6087 } 6089 }
6088 6090
6089 *has_side_effects |= access->HasObservableSideEffects(); 6091 *has_side_effects |= access->HasObservableSideEffects();
6090 if (position != -1) { 6092 if (position != -1) {
6091 access->set_position(position); 6093 access->set_position(position);
6092 } 6094 }
6093 if_jsarray->Goto(join); 6095 if_jsarray->Goto(join);
6094 6096
6095 set_current_block(if_fastobject); 6097 set_current_block(if_fastobject);
6096 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); 6098 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements));
6097 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); 6099 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length,
6100 ALLOW_SMI_KEY));
6098 access = AddInstruction(BuildFastElementAccess( 6101 access = AddInstruction(BuildFastElementAccess(
6099 elements, checked_key, val, elements_kind, is_store)); 6102 elements, checked_key, val, elements_kind, is_store));
6100 } else if (elements_kind == DICTIONARY_ELEMENTS) { 6103 } else if (elements_kind == DICTIONARY_ELEMENTS) {
6101 if (is_store) { 6104 if (is_store) {
6102 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); 6105 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val));
6103 } else { 6106 } else {
6104 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); 6107 access = AddInstruction(BuildLoadKeyedGeneric(object, key));
6105 } 6108 }
6106 } else { // External array elements. 6109 } else { // External array elements.
6107 access = AddInstruction(BuildExternalArrayElementAccess( 6110 access = AddInstruction(BuildExternalArrayElementAccess(
(...skipping 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after
9575 } 9578 }
9576 } 9579 }
9577 9580
9578 #ifdef DEBUG 9581 #ifdef DEBUG
9579 if (graph_ != NULL) graph_->Verify(false); // No full verify. 9582 if (graph_ != NULL) graph_->Verify(false); // No full verify.
9580 if (allocator_ != NULL) allocator_->Verify(); 9583 if (allocator_ != NULL) allocator_->Verify();
9581 #endif 9584 #endif
9582 } 9585 }
9583 9586
9584 } } // namespace v8::internal 9587 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698