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

Unified Diff: test/cctest/test-array-list.cc

Issue 980523004: Retain maps embedded in optimized code for several garbage collections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Check constructor. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-array-list.cc
diff --git a/test/cctest/test-array-list.cc b/test/cctest/test-array-list.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2852043b2f0229a4a6f014ebbceb936255ca3ad3
--- /dev/null
+++ b/test/cctest/test-array-list.cc
@@ -0,0 +1,41 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdlib.h>
+
+#include "src/v8.h"
+
+#include "src/factory.h"
+#include "test/cctest/cctest.h"
+
+namespace {
+
+using namespace v8::internal;
+
+
+TEST(ArrayList) {
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+ Handle<ArrayList> array(
+ ArrayList::cast(isolate->heap()->empty_fixed_array()));
+ CHECK_EQ(0, array->Length());
+ array = ArrayList::Add(array, handle(Smi::FromInt(100), isolate));
+ CHECK_EQ(1, array->Length());
+ CHECK_EQ(100, Smi::cast(array->Get(0))->value());
+ array = ArrayList::Add(array, handle(Smi::FromInt(200), isolate),
+ handle(Smi::FromInt(300), isolate));
+ CHECK_EQ(3, array->Length());
+ CHECK_EQ(100, Smi::cast(array->Get(0))->value());
+ CHECK_EQ(200, Smi::cast(array->Get(1))->value());
+ CHECK_EQ(300, Smi::cast(array->Get(2))->value());
+ array->Set(2, Smi::FromInt(400));
+ CHECK_EQ(400, Smi::cast(array->Get(2))->value());
+ array->Clear(2, isolate->heap()->undefined_value());
+ array->SetLength(2);
+ CHECK_EQ(2, array->Length());
+ CHECK_EQ(100, Smi::cast(array->Get(0))->value());
+ CHECK_EQ(200, Smi::cast(array->Get(1))->value());
+}
+}
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698