Commit 01e46b95 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Initialize internal arrays with the correct map.

BUG=v8:1878
TEST=regress-1878.js

Review URL: https://chromiumcodereview.appspot.com/9402009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10712 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b21ada9a
......@@ -206,8 +206,7 @@ static MaybeObject* ArrayCodeGenericCommon(Arguments* args,
}
} else {
// Allocate the JS Array
MaybeObject* maybe_obj =
heap->AllocateEmptyJSArray(FAST_SMI_ONLY_ELEMENTS);
MaybeObject* maybe_obj = heap->AllocateJSObject(constructor);
if (!maybe_obj->To(&array)) return maybe_obj;
}
......
// Copyright 2009 the V8 project authors. All rights reserved.
// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
......@@ -30,5 +30,15 @@
// Flags: --allow-natives-syntax --expose_natives_as=natives
var a = Array();
var ai = natives.InternalArray();
assertFalse(%HaveSameMap(ai, a));
for (var i = 0; i < 1000; i++) {
var ai = natives.InternalArray(10000);
assertFalse(%HaveSameMap(ai, a));
assertTrue(%HasFastElements(ai));
}
for (var i = 0; i < 1000; i++) {
var ai = new natives.InternalArray(10000);
assertFalse(%HaveSameMap(ai, a));
assertTrue(%HasFastElements(ai));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment