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

Side by Side Diff: test/cctest/test-migrations.cc

Issue 1018283002: Reland "Fix memory leak caused by field type in descriptor array." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 9 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
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 <stdlib.h> 5 #include <stdlib.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } 227 }
228 228
229 229
230 bool Check(DescriptorArray* descriptors, int descriptor) const { 230 bool Check(DescriptorArray* descriptors, int descriptor) const {
231 PropertyType type = types_[descriptor]; 231 PropertyType type = types_[descriptor];
232 if (!EqualDetails(descriptors, descriptor, type, attributes_[descriptor], 232 if (!EqualDetails(descriptors, descriptor, type, attributes_[descriptor],
233 representations_[descriptor])) { 233 representations_[descriptor])) {
234 return false; 234 return false;
235 } 235 }
236 Object* value = descriptors->GetValue(descriptor);
236 Object* expected_value = *values_[descriptor]; 237 Object* expected_value = *values_[descriptor];
237 Object* value = descriptors->GetValue(descriptor);
238 switch (type) { 238 switch (type) {
239 case DATA: 239 case DATA:
240 case ACCESSOR: 240 case ACCESSOR: {
241 return HeapType::cast(expected_value)->Equals(HeapType::cast(value)); 241 HeapType* type = descriptors->GetFieldType(descriptor);
242 return HeapType::cast(expected_value)->Equals(type);
243 }
242 244
243 case DATA_CONSTANT: 245 case DATA_CONSTANT:
244 return value == expected_value; 246 return value == expected_value;
245 247
246 case ACCESSOR_CONSTANT: { 248 case ACCESSOR_CONSTANT: {
247 if (value == expected_value) return true; 249 if (value == expected_value) return true;
248 if (!value->IsAccessorPair()) return false; 250 if (!value->IsAccessorPair()) return false;
249 AccessorPair* pair = AccessorPair::cast(value); 251 AccessorPair* pair = AccessorPair::cast(value);
250 return pair->Equals(expected_value, *setter_values_[descriptor]); 252 return pair->Equals(expected_value, *setter_values_[descriptor]);
251 } 253 }
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 Handle<AccessorPair> pair = CreateAccessorPair(true, true); 2079 Handle<AccessorPair> pair = CreateAccessorPair(true, true);
2078 TransitionToAccessorConstantOperator transition_op(pair); 2080 TransitionToAccessorConstantOperator transition_op(pair);
2079 2081
2080 SameMapChecker checker; 2082 SameMapChecker checker;
2081 TestTransitionTo(transition_op, transition_op, checker); 2083 TestTransitionTo(transition_op, transition_op, checker);
2082 } 2084 }
2083 2085
2084 2086
2085 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. 2087 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported.
2086 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) 2088 // TEST(TransitionAccessorConstantToAnotherAccessorConstant)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698