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
This commit is contained in:
parent
b21ada9a98
commit
01e46b955f
@ -206,8 +206,7 @@ static MaybeObject* ArrayCodeGenericCommon(Arguments* args,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Allocate the JS Array
|
// Allocate the JS Array
|
||||||
MaybeObject* maybe_obj =
|
MaybeObject* maybe_obj = heap->AllocateJSObject(constructor);
|
||||||
heap->AllocateEmptyJSArray(FAST_SMI_ONLY_ELEMENTS);
|
|
||||||
if (!maybe_obj->To(&array)) return maybe_obj;
|
if (!maybe_obj->To(&array)) return maybe_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// 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
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -30,5 +30,15 @@
|
|||||||
// Flags: --allow-natives-syntax --expose_natives_as=natives
|
// Flags: --allow-natives-syntax --expose_natives_as=natives
|
||||||
|
|
||||||
var a = Array();
|
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));
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user