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

Side by Side Diff: src/objects.cc

Issue 1579603002: Generalize all representations when reconfiguring a property of a strict Function subclass. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments, skipping new test for interpreter Created 4 years, 11 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') | test/mjsunit/mjsunit.status » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 9986 matching lines...) Expand 10 before | Expand all | Expand 10 after
9997 descriptors->CopyFrom(i, *desc); 9997 descriptors->CopyFrom(i, *desc);
9998 } 9998 }
9999 } 9999 }
10000 10000
10001 if (desc->number_of_descriptors() != enumeration_index) descriptors->Sort(); 10001 if (desc->number_of_descriptors() != enumeration_index) descriptors->Sort();
10002 10002
10003 return descriptors; 10003 return descriptors;
10004 } 10004 }
10005 10005
10006 10006
10007 bool DescriptorArray::IsEqualUpTo(DescriptorArray* desc, int nof_descriptors) {
10008 for (int i = 0; i < nof_descriptors; i++) {
10009 if (GetKey(i) != desc->GetKey(i) || GetValue(i) != desc->GetValue(i)) {
10010 return false;
10011 }
10012 PropertyDetails details = GetDetails(i);
10013 PropertyDetails other_details = desc->GetDetails(i);
10014 if (details.type() != other_details.type() ||
10015 !details.representation().Equals(other_details.representation())) {
10016 return false;
10017 }
10018 }
10019 return true;
10020 }
10021
10022
10007 Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map, 10023 Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map,
10008 Handle<DescriptorArray> descriptors, 10024 Handle<DescriptorArray> descriptors,
10009 Descriptor* descriptor, 10025 Descriptor* descriptor,
10010 int insertion_index, 10026 int insertion_index,
10011 TransitionFlag flag) { 10027 TransitionFlag flag) {
10012 // Ensure the key is unique. 10028 // Ensure the key is unique.
10013 descriptor->KeyToUniqueName(); 10029 descriptor->KeyToUniqueName();
10014 10030
10015 Handle<Name> key = descriptor->GetKey(); 10031 Handle<Name> key = descriptor->GetKey();
10016 DCHECK(*key == descriptors->GetKey(insertion_index)); 10032 DCHECK(*key == descriptors->GetKey(insertion_index));
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
12173 first->bit_field() == second->bit_field() && 12189 first->bit_field() == second->bit_field() &&
12174 first->is_extensible() == second->is_extensible() && 12190 first->is_extensible() == second->is_extensible() &&
12175 first->is_strong() == second->is_strong() && 12191 first->is_strong() == second->is_strong() &&
12176 first->is_hidden_prototype() == second->is_hidden_prototype(); 12192 first->is_hidden_prototype() == second->is_hidden_prototype();
12177 } 12193 }
12178 12194
12179 } // namespace 12195 } // namespace
12180 12196
12181 12197
12182 bool Map::EquivalentToForTransition(Map* other) { 12198 bool Map::EquivalentToForTransition(Map* other) {
12183 return CheckEquivalent(this, other); 12199 if (!CheckEquivalent(this, other)) return false;
12200 if (instance_type() == JS_FUNCTION_TYPE) {
12201 // JSFunctions require more checks to ensure that sloppy function is
12202 // not equvalent to strict function.
12203 int nof = Min(NumberOfOwnDescriptors(), other->NumberOfOwnDescriptors());
12204 return instance_descriptors()->IsEqualUpTo(other->instance_descriptors(),
12205 nof);
12206 }
12207 return true;
12184 } 12208 }
12185 12209
12186 12210
12187 bool Map::EquivalentToForNormalization(Map* other, 12211 bool Map::EquivalentToForNormalization(Map* other,
12188 PropertyNormalizationMode mode) { 12212 PropertyNormalizationMode mode) {
12189 int properties = 12213 int properties =
12190 mode == CLEAR_INOBJECT_PROPERTIES ? 0 : other->GetInObjectProperties(); 12214 mode == CLEAR_INOBJECT_PROPERTIES ? 0 : other->GetInObjectProperties();
12191 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() && 12215 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() &&
12192 GetInObjectProperties() == properties; 12216 GetInObjectProperties() == properties;
12193 } 12217 }
(...skipping 7414 matching lines...) Expand 10 before | Expand all | Expand 10 after
19608 if (cell->value() != *new_value) { 19632 if (cell->value() != *new_value) {
19609 cell->set_value(*new_value); 19633 cell->set_value(*new_value);
19610 Isolate* isolate = cell->GetIsolate(); 19634 Isolate* isolate = cell->GetIsolate();
19611 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19635 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19612 isolate, DependentCode::kPropertyCellChangedGroup); 19636 isolate, DependentCode::kPropertyCellChangedGroup);
19613 } 19637 }
19614 } 19638 }
19615 19639
19616 } // namespace internal 19640 } // namespace internal
19617 } // namespace v8 19641 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698