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

Side by Side Diff: src/hydrogen.cc

Issue 18986003: Don't fast-store to observed objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | no next file » | 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 4756 matching lines...) Expand 10 before | Expand all | Expand 10 after
4767 Drop(1); // array literal index 4767 Drop(1); // array literal index
4768 return ast_context()->ReturnValue(Pop()); 4768 return ast_context()->ReturnValue(Pop());
4769 } 4769 }
4770 4770
4771 4771
4772 // Sets the lookup result and returns true if the load/store can be inlined. 4772 // Sets the lookup result and returns true if the load/store can be inlined.
4773 static bool ComputeLoadStoreField(Handle<Map> type, 4773 static bool ComputeLoadStoreField(Handle<Map> type,
4774 Handle<String> name, 4774 Handle<String> name,
4775 LookupResult* lookup, 4775 LookupResult* lookup,
4776 bool is_store) { 4776 bool is_store) {
4777 if (is_store && type->is_observed()) return false;
4777 if (type->has_named_interceptor()) { 4778 if (type->has_named_interceptor()) {
4778 lookup->InterceptorResult(NULL); 4779 lookup->InterceptorResult(NULL);
4779 return false; 4780 return false;
4780 } 4781 }
4781 // If we directly find a field, the access can be inlined. 4782 // If we directly find a field, the access can be inlined.
4782 type->LookupDescriptor(NULL, *name, lookup); 4783 type->LookupDescriptor(NULL, *name, lookup);
4783 if (lookup->IsField()) return true; 4784 if (lookup->IsField()) return true;
4784 4785
4785 // For a load, we are out of luck if there is no such field. 4786 // For a load, we are out of luck if there is no such field.
4786 if (!is_store) return false; 4787 if (!is_store) return false;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
5054 // TODO(verwaest): Merge the checking logic with the code in 5055 // TODO(verwaest): Merge the checking logic with the code in
5055 // TryLoadPolymorphicAsMonomorphic. 5056 // TryLoadPolymorphicAsMonomorphic.
5056 LookupResult lookup(isolate()); 5057 LookupResult lookup(isolate());
5057 int count; 5058 int count;
5058 Representation representation = Representation::None(); 5059 Representation representation = Representation::None();
5059 HObjectAccess access = HObjectAccess::ForMap(); // initial value unused. 5060 HObjectAccess access = HObjectAccess::ForMap(); // initial value unused.
5060 for (count = 0; count < types->length(); ++count) { 5061 for (count = 0; count < types->length(); ++count) {
5061 Handle<Map> map = types->at(count); 5062 Handle<Map> map = types->at(count);
5062 // Pass false to ignore transitions. 5063 // Pass false to ignore transitions.
5063 if (!ComputeLoadStoreField(map, name, &lookup, false)) break; 5064 if (!ComputeLoadStoreField(map, name, &lookup, false)) break;
5065 if (map->is_observed()) return false;
5064 5066
5065 HObjectAccess new_access = HObjectAccess::ForField(map, &lookup, name); 5067 HObjectAccess new_access = HObjectAccess::ForField(map, &lookup, name);
5066 Representation new_representation = 5068 Representation new_representation =
5067 ComputeLoadStoreRepresentation(map, &lookup); 5069 ComputeLoadStoreRepresentation(map, &lookup);
5068 5070
5069 if (count == 0) { 5071 if (count == 0) {
5070 // First time through the loop; set access and representation. 5072 // First time through the loop; set access and representation.
5071 access = new_access; 5073 access = new_access;
5072 representation = new_representation; 5074 representation = new_representation;
5073 } else if (!representation.IsCompatibleForStore(new_representation)) { 5075 } else if (!representation.IsCompatibleForStore(new_representation)) {
(...skipping 5113 matching lines...) Expand 10 before | Expand all | Expand 10 after
10187 if (ShouldProduceTraceOutput()) { 10189 if (ShouldProduceTraceOutput()) {
10188 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10190 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10189 } 10191 }
10190 10192
10191 #ifdef DEBUG 10193 #ifdef DEBUG
10192 graph_->Verify(false); // No full verify. 10194 graph_->Verify(false); // No full verify.
10193 #endif 10195 #endif
10194 } 10196 }
10195 10197
10196 } } // namespace v8::internal 10198 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698