is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackSlot());
if (is_monomorphic_) {
target_ = oracle->GetCallNewTarget(CallNewFeedbackSlot());
- if (!allocation_site_.is_null()) {
- elements_kind_ = allocation_site_->GetElementsKind();
- }
}
}
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_;
}
expression_(expression),
arguments_(arguments),
is_monomorphic_(false),
- elements_kind_(GetInitialFastElementsKind()),
callnew_feedback_slot_(kInvalidFeedbackSlot),
return_id_(id_gen->GetNextId()) {}
bool is_monomorphic_;
Handle<JSFunction> target_;
- ElementsKind elements_kind_;
Handle<AllocationSite> allocation_site_;
int callnew_feedback_slot_;
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);
}
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());
}
--- /dev/null
+// 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());
+})();