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

Side by Side Diff: src/hydrogen.cc

Issue 10697015: Separating transitions from descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Using WhitenessWitness in TransitionArray code. 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
« no previous file with comments | « src/handles.cc ('k') | src/hydrogen-instructions.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 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 4900 matching lines...) Expand 10 before | Expand all | Expand 10 after
4911 } 4911 }
4912 return ast_context()->ReturnValue(Pop()); 4912 return ast_context()->ReturnValue(Pop());
4913 } 4913 }
4914 4914
4915 4915
4916 // Sets the lookup result and returns true if the load/store can be inlined. 4916 // Sets the lookup result and returns true if the load/store can be inlined.
4917 static bool ComputeLoadStoreField(Handle<Map> type, 4917 static bool ComputeLoadStoreField(Handle<Map> type,
4918 Handle<String> name, 4918 Handle<String> name,
4919 LookupResult* lookup, 4919 LookupResult* lookup,
4920 bool is_store) { 4920 bool is_store) {
4921 type->LookupInDescriptors(NULL, *name, lookup); 4921 type->LookupTransitionOrDescriptor(NULL, *name, lookup);
4922 if (lookup->IsField()) return true; 4922 if (lookup->IsField()) return true;
4923 return is_store && lookup->IsMapTransition() && 4923 return is_store &&
4924 (type->unused_property_fields() > 0); 4924 lookup->IsTransitionToField(*type) &&
4925 (type->unused_property_fields() > 0);
4925 } 4926 }
4926 4927
4927 4928
4928 static int ComputeLoadStoreFieldIndex(Handle<Map> type, 4929 static int ComputeLoadStoreFieldIndex(Handle<Map> type,
4929 Handle<String> name, 4930 Handle<String> name,
4930 LookupResult* lookup) { 4931 LookupResult* lookup) {
4931 ASSERT(lookup->IsField() || lookup->type() == MAP_TRANSITION); 4932 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*type));
4932 if (lookup->IsField()) { 4933 if (lookup->IsField()) {
4933 return lookup->GetLocalFieldIndexFromMap(*type); 4934 return lookup->GetLocalFieldIndexFromMap(*type);
4934 } else { 4935 } else {
4935 Map* transition = lookup->GetTransitionMapFromMap(*type); 4936 Map* transition = lookup->GetTransitionMapFromMap(*type);
4936 return transition->PropertyIndexFor(*name) - type->inobject_properties(); 4937 return transition->PropertyIndexFor(*name) - type->inobject_properties();
4937 } 4938 }
4938 } 4939 }
4939 4940
4940 4941
4941 HInstruction* HGraphBuilder::BuildStoreNamedField(HValue* object, 4942 HInstruction* HGraphBuilder::BuildStoreNamedField(HValue* object,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4982 int offset = index * kPointerSize; 4983 int offset = index * kPointerSize;
4983 if (index < 0) { 4984 if (index < 0) {
4984 // Negative property indices are in-object properties, indexed 4985 // Negative property indices are in-object properties, indexed
4985 // from the end of the fixed part of the object. 4986 // from the end of the fixed part of the object.
4986 offset += type->instance_size(); 4987 offset += type->instance_size();
4987 } else { 4988 } else {
4988 offset += FixedArray::kHeaderSize; 4989 offset += FixedArray::kHeaderSize;
4989 } 4990 }
4990 HStoreNamedField* instr = 4991 HStoreNamedField* instr =
4991 new(zone()) HStoreNamedField(object, name, value, is_in_object, offset); 4992 new(zone()) HStoreNamedField(object, name, value, is_in_object, offset);
4992 if (lookup->type() == MAP_TRANSITION) { 4993 if (lookup->IsTransitionToField(*type)) {
4993 Handle<Map> transition(lookup->GetTransitionMapFromMap(*type)); 4994 Handle<Map> transition(lookup->GetTransitionMapFromMap(*type));
4994 instr->set_transition(transition); 4995 instr->set_transition(transition);
4995 // TODO(fschneider): Record the new map type of the object in the IR to 4996 // TODO(fschneider): Record the new map type of the object in the IR to
4996 // enable elimination of redundant checks after the transition store. 4997 // enable elimination of redundant checks after the transition store.
4997 instr->SetGVNFlag(kChangesMaps); 4998 instr->SetGVNFlag(kChangesMaps);
4998 } 4999 }
4999 return instr; 5000 return instr;
5000 } 5001 }
5001 5002
5002 5003
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
5620 HValue* context = environment()->LookupContext(); 5621 HValue* context = environment()->LookupContext();
5621 return new(zone()) HLoadNamedGeneric(context, obj, name); 5622 return new(zone()) HLoadNamedGeneric(context, obj, name);
5622 } 5623 }
5623 5624
5624 5625
5625 HInstruction* HGraphBuilder::BuildLoadNamed(HValue* obj, 5626 HInstruction* HGraphBuilder::BuildLoadNamed(HValue* obj,
5626 Property* expr, 5627 Property* expr,
5627 Handle<Map> map, 5628 Handle<Map> map,
5628 Handle<String> name) { 5629 Handle<String> name) {
5629 LookupResult lookup(isolate()); 5630 LookupResult lookup(isolate());
5630 map->LookupInDescriptors(NULL, *name, &lookup); 5631 map->LookupDescriptor(NULL, *name, &lookup);
5631 if (lookup.IsField()) { 5632 if (lookup.IsField()) {
5632 return BuildLoadNamedField(obj, 5633 return BuildLoadNamedField(obj,
5633 expr, 5634 expr,
5634 map, 5635 map,
5635 &lookup, 5636 &lookup,
5636 true); 5637 true);
5637 } else if (lookup.IsConstantFunction()) { 5638 } else if (lookup.IsConstantFunction()) {
5638 AddInstruction(new(zone()) HCheckNonSmi(obj)); 5639 AddInstruction(new(zone()) HCheckNonSmi(obj));
5639 AddInstruction(HCheckMaps::NewWithTransitions(obj, map, zone())); 5640 AddInstruction(HCheckMaps::NewWithTransitions(obj, map, zone()));
5640 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); 5641 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map));
(...skipping 3799 matching lines...) Expand 10 before | Expand all | Expand 10 after
9440 } 9441 }
9441 } 9442 }
9442 9443
9443 #ifdef DEBUG 9444 #ifdef DEBUG
9444 if (graph_ != NULL) graph_->Verify(false); // No full verify. 9445 if (graph_ != NULL) graph_->Verify(false); // No full verify.
9445 if (allocator_ != NULL) allocator_->Verify(); 9446 if (allocator_ != NULL) allocator_->Verify();
9446 #endif 9447 #endif
9447 } 9448 }
9448 9449
9449 } } // namespace v8::internal 9450 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698