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

Unified Diff: test/cctest/test-code-stub-assembler.cc

Issue 2430273007: [runtime] Object.create(null) creates a slow object (Closed)
Patch Set: adding tests Created 4 years, 2 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
Index: test/cctest/test-code-stub-assembler.cc
diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc
index d55c82e8eac28bcdb761c714f59db24f9823b5d1..4af399e4f6dc43dc929e38c3bfe97789233315f7 100644
--- a/test/cctest/test-code-stub-assembler.cc
+++ b/test/cctest/test-code-stub-assembler.cc
@@ -1626,7 +1626,7 @@ TEST(AllocateJSObjectFromMap) {
FunctionTester ft(code, kNumParams);
Handle<Map> maps[] = {
- isolate->object_with_null_prototype_map(),
+ isolate->slow_object_with_null_prototype_map(),
handle(isolate->object_function()->initial_map(), isolate),
handle(isolate->array_function()->initial_map(), isolate),
};
@@ -1661,11 +1661,42 @@ TEST(AllocateJSObjectFromMap) {
handle(object->elements()))
.ToHandleChecked());
VERIFY(result, object->map(), object->properties(), object->elements());
+ CHECK(!result->HasFastProperties());
#ifdef VERIFY_HEAP
isolate->heap()->Verify();
#endif
}
}
+TEST(AllocateNameDictionary) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+ Factory* factory = isolate->factory();
+
+ const int kNumParams = 1;
+ CodeStubAssemblerTester m(isolate, kNumParams);
+
+ {
+ Node* capacity = m.Parameter(0);
+ Node* result = m.AllocateNameDictionary(m.SmiUntag(capacity));
+ m.Return(result);
+ }
+
+ Handle<Code> code = m.GenerateCode();
+ FunctionTester ft(code, kNumParams);
+
+ {
+ Handle<Object> empty_fixed_array = factory->empty_fixed_array();
+ for (int i = 2; i < 100; i *= 2) {
+ Handle<JSObject> result = Handle<JSObject>::cast(
+ ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked());
+ Handle<NameDictionary> dict = NameDictionary::New(
+ isolate, i, NOT_TENURED, USE_CUSTOM_MINIMUM_CAPACITY);
+ // Both dictionaries should be memory equal.
+ int size =
+ FixedArrayBase::kHeaderSize + (dict->length() - 1) * kPointerSize;
+ CHECK_EQ(0, memcmp(*dict, *result, size));
+ }
+ }
+}
} // namespace internal
} // namespace v8
« src/objects.cc ('K') | « src/runtime/runtime-object.cc ('k') | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698