Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index 6b6ba79b44680eb3a2e5e1636053743845ff44a5..82bdf421148bd97fe9eaa57562fe6b2183faf7a9 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -1735,14 +1735,16 @@ class TransitionElementsKindStub : public HydrogenCodeStub { |
class ArrayConstructorStubBase : public HydrogenCodeStub { |
public: |
- ArrayConstructorStubBase(ElementsKind kind, bool disable_allocation_sites) { |
+ ArrayConstructorStubBase(ElementsKind kind, bool ensure_context, |
+ bool disable_allocation_sites) { |
// It only makes sense to override local allocation site behavior |
// if there is a difference between the global allocation site policy |
// for an ElementsKind and the desired usage of the stub. |
ASSERT(!disable_allocation_sites || |
AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); |
bit_field_ = ElementsKindBits::encode(kind) | |
- DisableAllocationSitesBits::encode(disable_allocation_sites); |
+ DisableAllocationSitesBits::encode(disable_allocation_sites) | |
+ EnsureContextBits::encode(ensure_context); |
} |
ElementsKind elements_kind() const { |
@@ -1753,7 +1755,15 @@ class ArrayConstructorStubBase : public HydrogenCodeStub { |
return DisableAllocationSitesBits::decode(bit_field_); |
} |
- virtual bool IsPregenerated() { return true; } |
+ bool ensure_context() const { |
+ return EnsureContextBits::decode(bit_field_); |
+ } |
+ |
+ virtual bool IsPregenerated() { |
+ // We only pre-generate stubs that verify correct context |
+ return ensure_context(); |
+ } |
+ |
static void GenerateStubsAheadOfTime(Isolate* isolate); |
static void InstallDescriptors(Isolate* isolate); |
@@ -1766,6 +1776,7 @@ class ArrayConstructorStubBase : public HydrogenCodeStub { |
class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
class DisableAllocationSitesBits: public BitField<bool, 8, 1> {}; |
+ class EnsureContextBits: public BitField<bool, 9, 1> {}; |
uint32_t bit_field_; |
DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
@@ -1776,8 +1787,10 @@ class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
public: |
ArrayNoArgumentConstructorStub( |
ElementsKind kind, |
+ bool ensure_context = true, |
bool disable_allocation_sites = false) |
- : ArrayConstructorStubBase(kind, disable_allocation_sites) { |
+ : ArrayConstructorStubBase(kind, ensure_context, |
+ disable_allocation_sites) { |
} |
virtual Handle<Code> GenerateCode(); |
@@ -1797,8 +1810,10 @@ class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
public: |
ArraySingleArgumentConstructorStub( |
ElementsKind kind, |
+ bool ensure_context = true, |
bool disable_allocation_sites = false) |
- : ArrayConstructorStubBase(kind, disable_allocation_sites) { |
+ : ArrayConstructorStubBase(kind, ensure_context, |
+ disable_allocation_sites) { |
} |
virtual Handle<Code> GenerateCode(); |
@@ -1818,8 +1833,10 @@ class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
public: |
ArrayNArgumentsConstructorStub( |
ElementsKind kind, |
+ bool ensure_context = true, |
bool disable_allocation_sites = false) |
- : ArrayConstructorStubBase(kind, disable_allocation_sites) { |
+ : ArrayConstructorStubBase(kind, ensure_context, |
+ disable_allocation_sites) { |
} |
virtual Handle<Code> GenerateCode(); |