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

Side by Side Diff: src/objects.cc

Issue 246523004: Avoid setting transitions in-place for cached maps when observed (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | test/mjsunit/regress/regress-observe-map-cache.js » ('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 5798 matching lines...) Expand 10 before | Expand all | Expand 10 after
5809 void JSObject::SetObserved(Handle<JSObject> object) { 5809 void JSObject::SetObserved(Handle<JSObject> object) {
5810 Isolate* isolate = object->GetIsolate(); 5810 Isolate* isolate = object->GetIsolate();
5811 Handle<Map> new_map; 5811 Handle<Map> new_map;
5812 Handle<Map> old_map(object->map(), isolate); 5812 Handle<Map> old_map(object->map(), isolate);
5813 ASSERT(!old_map->is_observed()); 5813 ASSERT(!old_map->is_observed());
5814 int transition_index = old_map->SearchTransition( 5814 int transition_index = old_map->SearchTransition(
5815 isolate->heap()->observed_symbol()); 5815 isolate->heap()->observed_symbol());
5816 if (transition_index != TransitionArray::kNotFound) { 5816 if (transition_index != TransitionArray::kNotFound) {
5817 new_map = handle(old_map->GetTransition(transition_index), isolate); 5817 new_map = handle(old_map->GetTransition(transition_index), isolate);
5818 ASSERT(new_map->is_observed()); 5818 ASSERT(new_map->is_observed());
5819 } else if (old_map->CanHaveMoreTransitions()) { 5819 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) {
5820 new_map = Map::CopyForObserved(old_map); 5820 new_map = Map::CopyForObserved(old_map);
5821 } else { 5821 } else {
5822 new_map = Map::Copy(old_map); 5822 new_map = Map::Copy(old_map);
5823 new_map->set_is_observed(); 5823 new_map->set_is_observed();
5824 } 5824 }
5825 JSObject::MigrateToMap(object, new_map); 5825 JSObject::MigrateToMap(object, new_map);
5826 } 5826 }
5827 5827
5828 5828
5829 Handle<JSObject> JSObject::Copy(Handle<JSObject> object, 5829 Handle<JSObject> JSObject::Copy(Handle<JSObject> object,
(...skipping 11592 matching lines...) Expand 10 before | Expand all | Expand 10 after
17422 #define ERROR_MESSAGES_TEXTS(C, T) T, 17422 #define ERROR_MESSAGES_TEXTS(C, T) T,
17423 static const char* error_messages_[] = { 17423 static const char* error_messages_[] = {
17424 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17424 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17425 }; 17425 };
17426 #undef ERROR_MESSAGES_TEXTS 17426 #undef ERROR_MESSAGES_TEXTS
17427 return error_messages_[reason]; 17427 return error_messages_[reason];
17428 } 17428 }
17429 17429
17430 17430
17431 } } // namespace v8::internal 17431 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-observe-map-cache.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698