Non-JSArrays must always have holey elements.

Drive-by cleanup: remove unused elements_kind_ field in CallNew.

BUG=chromium:416558
LOG=n
R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/595333002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24211 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jkummerow@chromium.org 2014-09-25 08:25:25 +00:00
parent 7712bd1a7a
commit 1903e560b0
5 changed files with 119 additions and 9 deletions

View File

@ -615,9 +615,6 @@ void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackSlot());
if (is_monomorphic_) {
target_ = oracle->GetCallNewTarget(CallNewFeedbackSlot());
if (!allocation_site_.is_null()) {
elements_kind_ = allocation_site_->GetElementsKind();
}
}
}

View File

@ -1868,7 +1868,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface {
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
Handle<JSFunction> target() const { return target_; }
ElementsKind elements_kind() const { return elements_kind_; }
Handle<AllocationSite> allocation_site() const {
return allocation_site_;
}
@ -1884,7 +1883,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface {
expression_(expression),
arguments_(arguments),
is_monomorphic_(false),
elements_kind_(GetInitialFastElementsKind()),
callnew_feedback_slot_(kInvalidFeedbackSlot),
return_id_(id_gen->GetNextId()) {}
@ -1894,7 +1892,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface {
bool is_monomorphic_;
Handle<JSFunction> target_;
ElementsKind elements_kind_;
Handle<AllocationSite> allocation_site_;
int callnew_feedback_slot_;

View File

@ -1302,8 +1302,9 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name,
Handle<JSFunction> function = NewFunction(
name, code, prototype, read_only_prototype);
Handle<Map> initial_map = NewMap(
type, instance_size, GetInitialFastElementsKind());
ElementsKind elements_kind =
type == JS_ARRAY_TYPE ? FAST_SMI_ELEMENTS : FAST_HOLEY_SMI_ELEMENTS;
Handle<Map> initial_map = NewMap(type, instance_size, elements_kind);
if (prototype->IsTheHole() && !function->shared()->is_generator()) {
prototype = NewFunctionPrototype(function);
}

View File

@ -547,7 +547,7 @@ void JSGlobalProxy::JSGlobalProxyVerify() {
VerifyObjectField(JSGlobalProxy::kNativeContextOffset);
// Make sure that this object has no properties, elements.
CHECK_EQ(0, properties()->length());
CHECK(HasFastSmiElements());
CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, GetElementsKind());
CHECK_EQ(0, FixedArray::cast(elements())->length());
}

View File

@ -0,0 +1,115 @@
// 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.
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = /x/;
store(c);
function get_hole() {
var b = /x/;
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = new Date();
store(c);
function get_hole() {
var b = new Date();
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = new Number(1);
store(c);
function get_hole() {
var b = new Number(1);
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = new Boolean();
store(c);
function get_hole() {
var b = new Boolean();
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = new Map();
store(c);
function get_hole() {
var b = new Map();
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = new Set();
store(c);
function get_hole() {
var b = new Set();
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = new WeakMap();
store(c);
function get_hole() {
var b = new WeakMap();
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();
(function() {
function store(x) { x[0] = 0; }
store([]);
var c = new WeakSet();
store(c);
function get_hole() {
var b = new WeakSet();
store(b);
return b[1];
}
assertEquals(undefined, get_hole());
assertEquals(undefined, get_hole());
})();