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

Side by Side Diff: runtime/vm/code_generator.cc

Issue 50243004: Fix bug with guarded fields and deserialization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 if (right < 0) { 1674 if (right < 0) {
1675 remainder -= right; 1675 remainder -= right;
1676 } else { 1676 } else {
1677 remainder += right; 1677 remainder += right;
1678 } 1678 }
1679 } 1679 }
1680 return remainder; 1680 return remainder;
1681 } 1681 }
1682 1682
1683 1683
1684 static intptr_t GetListLength(const Object& value) {
1685 const intptr_t cid = value.GetClassId();
1686 ASSERT(RawObject::IsBuiltinListClassId(cid));
1687 // Extract list length.
1688 if (value.IsTypedData()) {
1689 const TypedData& list = TypedData::Cast(value);
1690 return list.Length();
1691 } else if (value.IsArray()) {
1692 const Array& list = Array::Cast(value);
1693 return list.Length();
1694 } else if (value.IsGrowableObjectArray()) {
1695 // List length is variable.
1696 return Field::kNoFixedLength;
1697 } else if (value.IsExternalTypedData()) {
1698 // TODO(johnmccutchan): Enable for external typed data.
1699 return Field::kNoFixedLength;
1700 } else if (RawObject::IsTypedDataViewClassId(cid)) {
1701 // TODO(johnmccutchan): Enable for typed data views.
1702 return Field::kNoFixedLength;
1703 }
1704 UNIMPLEMENTED();
1705 return Field::kNoFixedLength;
1706 }
1707
1708
1709 // Update global type feedback recorded for a field recording the assignment 1684 // Update global type feedback recorded for a field recording the assignment
1710 // of the given value. 1685 // of the given value.
1711 // Arg0: Field object; 1686 // Arg0: Field object;
1712 // Arg1: Value that is being stored. 1687 // Arg1: Value that is being stored.
1713 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { 1688 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
1714 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); 1689 const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
1715 const Object& value = Object::Handle(arguments.ArgAt(1)); 1690 const Object& value = Object::Handle(arguments.ArgAt(1));
1716 const intptr_t cid = value.GetClassId(); 1691 field.UpdateGuardedCidAndLength(value);
1717 field.UpdateCid(cid);
1718 intptr_t list_length = Field::kNoFixedLength;
1719 if ((field.guarded_cid() != kDynamicCid) &&
1720 field.is_final() && RawObject::IsBuiltinListClassId(cid)) {
1721 list_length = GetListLength(value);
1722 }
1723 field.UpdateLength(list_length);
1724 } 1692 }
1725 1693
1726 } // namespace dart 1694 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698