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
parent 7712bd1a
...@@ -615,9 +615,6 @@ void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { ...@@ -615,9 +615,6 @@ void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackSlot()); is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackSlot());
if (is_monomorphic_) { if (is_monomorphic_) {
target_ = oracle->GetCallNewTarget(CallNewFeedbackSlot()); target_ = oracle->GetCallNewTarget(CallNewFeedbackSlot());
if (!allocation_site_.is_null()) {
elements_kind_ = allocation_site_->GetElementsKind();
}
} }
} }
......
...@@ -1868,7 +1868,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface { ...@@ -1868,7 +1868,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface {
void RecordTypeFeedback(TypeFeedbackOracle* oracle); void RecordTypeFeedback(TypeFeedbackOracle* oracle);
virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
Handle<JSFunction> target() const { return target_; } Handle<JSFunction> target() const { return target_; }
ElementsKind elements_kind() const { return elements_kind_; }
Handle<AllocationSite> allocation_site() const { Handle<AllocationSite> allocation_site() const {
return allocation_site_; return allocation_site_;
} }
...@@ -1884,7 +1883,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface { ...@@ -1884,7 +1883,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface {
expression_(expression), expression_(expression),
arguments_(arguments), arguments_(arguments),
is_monomorphic_(false), is_monomorphic_(false),
elements_kind_(GetInitialFastElementsKind()),
callnew_feedback_slot_(kInvalidFeedbackSlot), callnew_feedback_slot_(kInvalidFeedbackSlot),
return_id_(id_gen->GetNextId()) {} return_id_(id_gen->GetNextId()) {}
...@@ -1894,7 +1892,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface { ...@@ -1894,7 +1892,6 @@ class CallNew FINAL : public Expression, public FeedbackSlotInterface {
bool is_monomorphic_; bool is_monomorphic_;
Handle<JSFunction> target_; Handle<JSFunction> target_;
ElementsKind elements_kind_;
Handle<AllocationSite> allocation_site_; Handle<AllocationSite> allocation_site_;
int callnew_feedback_slot_; int callnew_feedback_slot_;
......
...@@ -1302,8 +1302,9 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, ...@@ -1302,8 +1302,9 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name,
Handle<JSFunction> function = NewFunction( Handle<JSFunction> function = NewFunction(
name, code, prototype, read_only_prototype); name, code, prototype, read_only_prototype);
Handle<Map> initial_map = NewMap( ElementsKind elements_kind =
type, instance_size, GetInitialFastElementsKind()); 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()) { if (prototype->IsTheHole() && !function->shared()->is_generator()) {
prototype = NewFunctionPrototype(function); prototype = NewFunctionPrototype(function);
} }
......
...@@ -547,7 +547,7 @@ void JSGlobalProxy::JSGlobalProxyVerify() { ...@@ -547,7 +547,7 @@ void JSGlobalProxy::JSGlobalProxyVerify() {
VerifyObjectField(JSGlobalProxy::kNativeContextOffset); VerifyObjectField(JSGlobalProxy::kNativeContextOffset);
// Make sure that this object has no properties, elements. // Make sure that this object has no properties, elements.
CHECK_EQ(0, properties()->length()); CHECK_EQ(0, properties()->length());
CHECK(HasFastSmiElements()); CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, GetElementsKind());
CHECK_EQ(0, FixedArray::cast(elements())->length()); CHECK_EQ(0, FixedArray::cast(elements())->length());
} }
......
// 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());
})();
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