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

Side by Side Diff: src/objects.cc

Issue 1145213005: [strong] cache strong object literal maps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix map comparison Created 5 years, 7 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
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 9716 matching lines...) Expand 10 before | Expand all | Expand 10 after
9727 return hash ^ (hash >> 16) ^ bit_field2(); 9727 return hash ^ (hash >> 16) ^ bit_field2();
9728 } 9728 }
9729 9729
9730 9730
9731 static bool CheckEquivalent(Map* first, Map* second) { 9731 static bool CheckEquivalent(Map* first, Map* second) {
9732 return first->GetConstructor() == second->GetConstructor() && 9732 return first->GetConstructor() == second->GetConstructor() &&
9733 first->prototype() == second->prototype() && 9733 first->prototype() == second->prototype() &&
9734 first->instance_type() == second->instance_type() && 9734 first->instance_type() == second->instance_type() &&
9735 first->bit_field() == second->bit_field() && 9735 first->bit_field() == second->bit_field() &&
9736 first->is_extensible() == second->is_extensible() && 9736 first->is_extensible() == second->is_extensible() &&
9737 first->is_strong() == second->is_strong() &&
9737 first->has_instance_call_handler() == 9738 first->has_instance_call_handler() ==
9738 second->has_instance_call_handler(); 9739 second->has_instance_call_handler();
9739 } 9740 }
9740 9741
9741 9742
9742 bool Map::EquivalentToForTransition(Map* other) { 9743 bool Map::EquivalentToForTransition(Map* other) {
9743 return CheckEquivalent(this, other); 9744 return CheckEquivalent(this, other);
9744 } 9745 }
9745 9746
9746 9747
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
10362 // updated initial maps (and transitioned versions) in the native context. 10363 // updated initial maps (and transitioned versions) in the native context.
10363 Handle<Context> native_context(function->context()->native_context(), 10364 Handle<Context> native_context(function->context()->native_context(),
10364 isolate); 10365 isolate);
10365 Handle<Object> array_function( 10366 Handle<Object> array_function(
10366 native_context->get(Context::ARRAY_FUNCTION_INDEX), isolate); 10367 native_context->get(Context::ARRAY_FUNCTION_INDEX), isolate);
10367 if (array_function->IsJSFunction() && 10368 if (array_function->IsJSFunction() &&
10368 *function == JSFunction::cast(*array_function)) { 10369 *function == JSFunction::cast(*array_function)) {
10369 CacheInitialJSArrayMaps(native_context, new_map); 10370 CacheInitialJSArrayMaps(native_context, new_map);
10370 Handle<Map> new_strong_map = 10371 Handle<Map> new_strong_map =
10371 Map::Copy(initial_map, "SetInstancePrototype"); 10372 Map::Copy(initial_map, "SetInstancePrototype");
10372 new_strong_map->set_is_strong(true); 10373 new_strong_map->set_is_strong();
10373 CacheInitialJSArrayMaps(native_context, new_strong_map); 10374 CacheInitialJSArrayMaps(native_context, new_strong_map);
10374 } 10375 }
10375 } 10376 }
10376 10377
10377 // Deoptimize all code that embeds the previous initial map. 10378 // Deoptimize all code that embeds the previous initial map.
10378 initial_map->dependent_code()->DeoptimizeDependentCodeGroup( 10379 initial_map->dependent_code()->DeoptimizeDependentCodeGroup(
10379 isolate, DependentCode::kInitialMapChangedGroup); 10380 isolate, DependentCode::kInitialMapChangedGroup);
10380 } else { 10381 } else {
10381 // Put the value in the initial map field until an initial map is 10382 // Put the value in the initial map field until an initial map is
10382 // needed. At that point, a new initial map is created and the 10383 // needed. At that point, a new initial map is created and the
(...skipping 6870 matching lines...) Expand 10 before | Expand all | Expand 10 after
17253 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, 17254 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell,
17254 Handle<Object> new_value) { 17255 Handle<Object> new_value) {
17255 if (cell->value() != *new_value) { 17256 if (cell->value() != *new_value) {
17256 cell->set_value(*new_value); 17257 cell->set_value(*new_value);
17257 Isolate* isolate = cell->GetIsolate(); 17258 Isolate* isolate = cell->GetIsolate();
17258 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17259 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17259 isolate, DependentCode::kPropertyCellChangedGroup); 17260 isolate, DependentCode::kPropertyCellChangedGroup);
17260 } 17261 }
17261 } 17262 }
17262 } } // namespace v8::internal 17263 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698