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

Side by Side Diff: src/hydrogen.cc

Issue 23761002: Merged r16205, r16220, r16237, r16249, r16262, r16269, r16273 into 3.20 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.20
Patch Set: Created 7 years, 3 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.cc ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 5518 matching lines...) Expand 10 before | Expand all | Expand 10 after
5529 HValue* val, 5529 HValue* val,
5530 SmallMapList* maps) { 5530 SmallMapList* maps) {
5531 // For polymorphic loads of similar elements kinds (i.e. all tagged or all 5531 // For polymorphic loads of similar elements kinds (i.e. all tagged or all
5532 // double), always use the "worst case" code without a transition. This is 5532 // double), always use the "worst case" code without a transition. This is
5533 // much faster than transitioning the elements to the worst case, trading a 5533 // much faster than transitioning the elements to the worst case, trading a
5534 // HTransitionElements for a HCheckMaps, and avoiding mutation of the array. 5534 // HTransitionElements for a HCheckMaps, and avoiding mutation of the array.
5535 bool has_double_maps = false; 5535 bool has_double_maps = false;
5536 bool has_smi_or_object_maps = false; 5536 bool has_smi_or_object_maps = false;
5537 bool has_js_array_access = false; 5537 bool has_js_array_access = false;
5538 bool has_non_js_array_access = false; 5538 bool has_non_js_array_access = false;
5539 bool has_seen_holey_elements = false;
5539 Handle<Map> most_general_consolidated_map; 5540 Handle<Map> most_general_consolidated_map;
5540 for (int i = 0; i < maps->length(); ++i) { 5541 for (int i = 0; i < maps->length(); ++i) {
5541 Handle<Map> map = maps->at(i); 5542 Handle<Map> map = maps->at(i);
5542 // Don't allow mixing of JSArrays with JSObjects. 5543 // Don't allow mixing of JSArrays with JSObjects.
5543 if (map->instance_type() == JS_ARRAY_TYPE) { 5544 if (map->instance_type() == JS_ARRAY_TYPE) {
5544 if (has_non_js_array_access) return NULL; 5545 if (has_non_js_array_access) return NULL;
5545 has_js_array_access = true; 5546 has_js_array_access = true;
5546 } else if (has_js_array_access) { 5547 } else if (has_js_array_access) {
5547 return NULL; 5548 return NULL;
5548 } else { 5549 } else {
5549 has_non_js_array_access = true; 5550 has_non_js_array_access = true;
5550 } 5551 }
5551 // Don't allow mixed, incompatible elements kinds. 5552 // Don't allow mixed, incompatible elements kinds.
5552 if (map->has_fast_double_elements()) { 5553 if (map->has_fast_double_elements()) {
5553 if (has_smi_or_object_maps) return NULL; 5554 if (has_smi_or_object_maps) return NULL;
5554 has_double_maps = true; 5555 has_double_maps = true;
5555 } else if (map->has_fast_smi_or_object_elements()) { 5556 } else if (map->has_fast_smi_or_object_elements()) {
5556 if (has_double_maps) return NULL; 5557 if (has_double_maps) return NULL;
5557 has_smi_or_object_maps = true; 5558 has_smi_or_object_maps = true;
5558 } else { 5559 } else {
5559 return NULL; 5560 return NULL;
5560 } 5561 }
5562 // Remember if we've ever seen holey elements.
5563 if (IsHoleyElementsKind(map->elements_kind())) {
5564 has_seen_holey_elements = true;
5565 }
5561 // Remember the most general elements kind, the code for its load will 5566 // Remember the most general elements kind, the code for its load will
5562 // properly handle all of the more specific cases. 5567 // properly handle all of the more specific cases.
5563 if ((i == 0) || IsMoreGeneralElementsKindTransition( 5568 if ((i == 0) || IsMoreGeneralElementsKindTransition(
5564 most_general_consolidated_map->elements_kind(), 5569 most_general_consolidated_map->elements_kind(),
5565 map->elements_kind())) { 5570 map->elements_kind())) {
5566 most_general_consolidated_map = map; 5571 most_general_consolidated_map = map;
5567 } 5572 }
5568 } 5573 }
5569 if (!has_double_maps && !has_smi_or_object_maps) return NULL; 5574 if (!has_double_maps && !has_smi_or_object_maps) return NULL;
5570 5575
5571 HCheckMaps* check_maps = Add<HCheckMaps>(object, maps); 5576 HCheckMaps* check_maps = Add<HCheckMaps>(object, maps);
5577 // FAST_ELEMENTS is considered more general than FAST_HOLEY_SMI_ELEMENTS.
5578 // If we've seen both, the consolidated load must use FAST_HOLEY_ELEMENTS.
5579 ElementsKind consolidated_elements_kind = has_seen_holey_elements
5580 ? GetHoleyElementsKind(most_general_consolidated_map->elements_kind())
5581 : most_general_consolidated_map->elements_kind();
5572 HInstruction* instr = BuildUncheckedMonomorphicElementAccess( 5582 HInstruction* instr = BuildUncheckedMonomorphicElementAccess(
5573 object, key, val, check_maps, 5583 object, key, val, check_maps,
5574 most_general_consolidated_map->instance_type() == JS_ARRAY_TYPE, 5584 most_general_consolidated_map->instance_type() == JS_ARRAY_TYPE,
5575 most_general_consolidated_map->elements_kind(), 5585 consolidated_elements_kind,
5576 false, NEVER_RETURN_HOLE, STANDARD_STORE); 5586 false, NEVER_RETURN_HOLE, STANDARD_STORE);
5577 return instr; 5587 return instr;
5578 } 5588 }
5579 5589
5580 5590
5581 HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( 5591 HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
5582 HValue* object, 5592 HValue* object,
5583 HValue* key, 5593 HValue* key,
5584 HValue* val, 5594 HValue* val,
5585 Expression* prop, 5595 Expression* prop,
(...skipping 4257 matching lines...) Expand 10 before | Expand all | Expand 10 after
9843 if (ShouldProduceTraceOutput()) { 9853 if (ShouldProduceTraceOutput()) {
9844 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9854 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9845 } 9855 }
9846 9856
9847 #ifdef DEBUG 9857 #ifdef DEBUG
9848 graph_->Verify(false); // No full verify. 9858 graph_->Verify(false); // No full verify.
9849 #endif 9859 #endif
9850 } 9860 }
9851 9861
9852 } } // namespace v8::internal 9862 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698