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

Unified Diff: runtime/vm/object.cc

Issue 1256763004: Fix issue #23914: do not attempt to make an already immutable array immutable (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: test Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/issue_23914_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 6a7d34c8099cea7543dd4b53a67f142d9cf8e2ee..cbc1d59d5c7584683c601dda2e3e210b2ef8b7b7 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -635,7 +635,7 @@ void Object::InitOnce(Isolate* isolate) {
// Allocate and initialize the empty_array instance.
{
uword address = heap->Allocate(Array::InstanceSize(0), Heap::kOld);
- InitializeObject(address, kArrayCid, Array::InstanceSize(0));
+ InitializeObject(address, kImmutableArrayCid, Array::InstanceSize(0));
Array::initializeHandle(
empty_array_,
reinterpret_cast<RawArray*>(address + kHeapObjectTag));
@@ -646,7 +646,7 @@ void Object::InitOnce(Isolate* isolate) {
// Allocate and initialize the zero_array instance.
{
uword address = heap->Allocate(Array::InstanceSize(1), Heap::kOld);
- InitializeObject(address, kArrayCid, Array::InstanceSize(1));
+ InitializeObject(address, kImmutableArrayCid, Array::InstanceSize(1));
Array::initializeHandle(
zero_array_,
reinterpret_cast<RawArray*>(address + kHeapObjectTag));
@@ -19733,6 +19733,7 @@ RawArray* Array::Slice(intptr_t start,
void Array::MakeImmutable() const {
+ if (IsImmutable()) return;
NoSafepointScope no_safepoint;
uword tags = raw_ptr()->tags_;
uword old_tags;
« no previous file with comments | « no previous file | tests/language/issue_23914_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698