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

Side by Side Diff: src/value-serializer.cc

Issue 2624903003: [runtime] Use PropertyKind/PropertyLocation instead of PropertyType. (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/value-serializer.h" 5 #include "src/value-serializer.h"
6 6
7 #include <type_traits> 7 #include <type_traits>
8 8
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 uint32_t properties_written = 0; 468 uint32_t properties_written = 0;
469 bool map_changed = false; 469 bool map_changed = false;
470 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { 470 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
471 Handle<Name> key(map->instance_descriptors()->GetKey(i), isolate_); 471 Handle<Name> key(map->instance_descriptors()->GetKey(i), isolate_);
472 if (!key->IsString()) continue; 472 if (!key->IsString()) continue;
473 PropertyDetails details = map->instance_descriptors()->GetDetails(i); 473 PropertyDetails details = map->instance_descriptors()->GetDetails(i);
474 if (details.IsDontEnum()) continue; 474 if (details.IsDontEnum()) continue;
475 475
476 Handle<Object> value; 476 Handle<Object> value;
477 if (V8_LIKELY(!map_changed)) map_changed = *map == object->map(); 477 if (V8_LIKELY(!map_changed)) map_changed = *map == object->map();
478 if (V8_LIKELY(!map_changed && details.type() == DATA)) { 478 if (V8_LIKELY(!map_changed && details.location() == kField)) {
479 FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); 479 FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
480 value = JSObject::FastPropertyAt(object, details.representation(), 480 value = JSObject::FastPropertyAt(object, details.representation(),
481 field_index); 481 field_index);
482 } else { 482 } else {
483 // This logic should essentially match WriteJSObjectPropertiesSlow. 483 // This logic should essentially match WriteJSObjectPropertiesSlow.
484 // If the property is no longer found, do not serialize it. 484 // If the property is no longer found, do not serialize it.
485 // This could happen if a getter deleted the property. 485 // This could happen if a getter deleted the property.
486 LookupIterator it(isolate_, object, key, LookupIterator::OWN); 486 LookupIterator it(isolate_, object, key, LookupIterator::OWN);
487 if (!it.IsFound()) continue; 487 if (!it.IsFound()) continue;
488 if (!Object::GetProperty(&it).ToHandle(&value)) return Nothing<bool>(); 488 if (!Object::GetProperty(&it).ToHandle(&value)) return Nothing<bool>();
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 if (stack.size() != 1) { 1875 if (stack.size() != 1) {
1876 isolate_->Throw(*isolate_->factory()->NewError( 1876 isolate_->Throw(*isolate_->factory()->NewError(
1877 MessageTemplate::kDataCloneDeserializationError)); 1877 MessageTemplate::kDataCloneDeserializationError));
1878 return MaybeHandle<Object>(); 1878 return MaybeHandle<Object>();
1879 } 1879 }
1880 return scope.CloseAndEscape(stack[0]); 1880 return scope.CloseAndEscape(stack[0]);
1881 } 1881 }
1882 1882
1883 } // namespace internal 1883 } // namespace internal
1884 } // namespace v8 1884 } // namespace v8
OLDNEW
« src/lookup.cc ('K') | « src/transitions.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698