Update V8 to version 4.1.0.21
This is a cherry-pick of all commits up to and including the
4.1.0.21 cherry-pick in Chromium.
Original commit message:
Version 4.1.0.21 (cherry-pick)
Merged 206e9136bde0f2b5ae8cb77afbb1e7833e5bd412
Unlink pages from the space page list after evacuation.
BUG=430201
LOG=N
R=jkummerow@chromium.org
Review URL: https://codereview.chromium.org/953813002
Cr-Commit-Position: refs/branch-heads/4.1@{#22}
Cr-Branched-From: 2e08d2a7aa9d65d269d8c57aba82eb38a8cb0a18-refs/heads/candidates@{#25353}
---
FPIIM-449
Change-Id: I8c23c7bbb70772b4858fe8a47b64fa97ee0d1f8c
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 3b31399..8448e55 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -39,6 +39,7 @@
V(KeyedLoadICTrampoline) \
V(LoadICTrampoline) \
V(LoadIndexedInterceptor) \
+ V(LoadIndexedString) \
V(MathPow) \
V(ProfileEntryHook) \
V(RecordWrite) \
@@ -49,7 +50,9 @@
V(StringCompare) \
V(StubFailureTrampoline) \
V(SubString) \
+ V(ToNumber) \
/* HydrogenCodeStubs */ \
+ V(AllocateHeapNumber) \
V(ArrayNArgumentsConstructor) \
V(ArrayNoArgumentConstructor) \
V(ArraySingleArgumentConstructor) \
@@ -66,6 +69,7 @@
V(InternalArrayNoArgumentConstructor) \
V(InternalArraySingleArgumentConstructor) \
V(KeyedLoadGeneric) \
+ V(LoadScriptContextField) \
V(LoadDictionaryElement) \
V(LoadFastElement) \
V(MegamorphicLoad) \
@@ -73,9 +77,9 @@
V(NumberToString) \
V(RegExpConstructResult) \
V(StoreFastElement) \
+ V(StoreScriptContextField) \
V(StringAdd) \
V(ToBoolean) \
- V(ToNumber) \
V(TransitionElementsKind) \
V(VectorKeyedLoad) \
V(VectorLoad) \
@@ -85,13 +89,12 @@
V(KeyedLoadSloppyArguments) \
V(StoreField) \
V(StoreGlobal) \
+ V(StoreTransition) \
V(StringLength)
// List of code stubs only used on ARM 32 bits platforms.
#if V8_TARGET_ARCH_ARM
-#define CODE_STUB_LIST_ARM(V) \
- V(DirectCEntry) \
- V(WriteInt32ToHeapNumber)
+#define CODE_STUB_LIST_ARM(V) V(DirectCEntry)
#else
#define CODE_STUB_LIST_ARM(V)
@@ -110,17 +113,15 @@
// List of code stubs only used on MIPS platforms.
#if V8_TARGET_ARCH_MIPS
-#define CODE_STUB_LIST_MIPS(V) \
- V(DirectCEntry) \
- V(RestoreRegistersState) \
- V(StoreRegistersState) \
- V(WriteInt32ToHeapNumber)
+#define CODE_STUB_LIST_MIPS(V) \
+ V(DirectCEntry) \
+ V(RestoreRegistersState) \
+ V(StoreRegistersState)
#elif V8_TARGET_ARCH_MIPS64
-#define CODE_STUB_LIST_MIPS(V) \
- V(DirectCEntry) \
- V(RestoreRegistersState) \
- V(StoreRegistersState) \
- V(WriteInt32ToHeapNumber)
+#define CODE_STUB_LIST_MIPS(V) \
+ V(DirectCEntry) \
+ V(RestoreRegistersState) \
+ V(StoreRegistersState)
#else
#define CODE_STUB_LIST_MIPS(V)
#endif
@@ -136,10 +137,12 @@
class CodeStub BASE_EMBEDDED {
public:
enum Major {
+ // TODO(mvstanton): eliminate the NoCache key by getting rid
+ // of the non-monomorphic-cache.
+ NoCache = 0, // marker for stubs that do custom caching]
#define DEF_ENUM(name) name,
CODE_STUB_LIST(DEF_ENUM)
#undef DEF_ENUM
- NoCache, // marker for stubs that do custom caching
NUMBER_OF_IDS
};
@@ -201,7 +204,7 @@
return Code::NORMAL;
}
- friend OStream& operator<<(OStream& os, const CodeStub& s) {
+ friend std::ostream& operator<<(std::ostream& os, const CodeStub& s) {
s.PrintName(os);
return os;
}
@@ -219,9 +222,9 @@
// a fixed (non-moveable) code object.
virtual bool NeedsImmovableCode() { return false; }
- virtual void PrintName(OStream& os) const; // NOLINT
- virtual void PrintBaseName(OStream& os) const; // NOLINT
- virtual void PrintState(OStream& os) const { ; } // NOLINT
+ virtual void PrintName(std::ostream& os) const; // NOLINT
+ virtual void PrintBaseName(std::ostream& os) const; // NOLINT
+ virtual void PrintState(std::ostream& os) const { ; } // NOLINT
// Computes the key based on major and minor.
uint32_t GetKey() {
@@ -286,54 +289,52 @@
DISALLOW_COPY_AND_ASSIGN(NAME)
-#define DEFINE_CODE_STUB(NAME, SUPER) \
- protected: \
- virtual inline Major MajorKey() const OVERRIDE { \
- return NAME; \
- }; \
+#define DEFINE_CODE_STUB(NAME, SUPER) \
+ protected: \
+ inline Major MajorKey() const OVERRIDE { return NAME; }; \
DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER)
-#define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \
- private: \
- virtual void Generate(MacroAssembler* masm) OVERRIDE; \
+#define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \
+ private: \
+ void Generate(MacroAssembler* masm) OVERRIDE; \
DEFINE_CODE_STUB(NAME, SUPER)
-#define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \
- public: \
- virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE; \
- virtual Handle<Code> GenerateCode() OVERRIDE; \
+#define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \
+ public: \
+ void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE; \
+ Handle<Code> GenerateCode() OVERRIDE; \
DEFINE_CODE_STUB(NAME, SUPER)
-#define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \
- public: \
- virtual Handle<Code> GenerateCode() OVERRIDE; \
+#define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \
+ public: \
+ Handle<Code> GenerateCode() OVERRIDE; \
DEFINE_CODE_STUB(NAME, SUPER)
-#define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
- public: \
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
- return NAME##Descriptor(isolate()); \
+#define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
+ public: \
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
+ return NAME##Descriptor(isolate()); \
}
// There are some code stubs we just can't describe right now with a
// CallInterfaceDescriptor. Isolate behavior for those cases with this macro.
// An attempt to retrieve a descriptor will fail.
-#define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \
- public: \
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
- UNREACHABLE(); \
- return CallInterfaceDescriptor(); \
+#define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \
+ public: \
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
+ UNREACHABLE(); \
+ return CallInterfaceDescriptor(); \
}
class PlatformCodeStub : public CodeStub {
public:
// Retrieve the code for the stub. Generate the code if needed.
- virtual Handle<Code> GenerateCode() OVERRIDE;
+ Handle<Code> GenerateCode() OVERRIDE;
- virtual Code::Kind GetCodeKind() const { return Code::STUB; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::STUB; }
protected:
explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {}
@@ -433,7 +434,7 @@
INITIALIZED
};
- virtual Code::Kind GetCodeKind() const { return Code::STUB; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::STUB; }
template<class SubClass>
static Handle<Code> GetUninitialized(Isolate* isolate) {
@@ -442,7 +443,7 @@
}
// Retrieve the code for the stub. Generate the code if needed.
- virtual Handle<Code> GenerateCode() = 0;
+ Handle<Code> GenerateCode() OVERRIDE = 0;
bool IsUninitialized() const { return IsMissBits::decode(minor_key_); }
@@ -540,15 +541,6 @@
};
-class ToNumberStub: public HydrogenCodeStub {
- public:
- explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { }
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(ToNumber);
- DEFINE_HYDROGEN_CODE_STUB(ToNumber, HydrogenCodeStub);
-};
-
-
class NumberToStringStub FINAL : public HydrogenCodeStub {
public:
explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
@@ -581,10 +573,11 @@
bool is_arrow() const { return IsArrowFunction(kind()); }
bool is_generator() const { return IsGeneratorFunction(kind()); }
bool is_concise_method() const { return IsConciseMethod(kind()); }
+ bool is_default_constructor() const { return IsDefaultConstructor(kind()); }
private:
class StrictModeBits : public BitField<StrictMode, 0, 1> {};
- class FunctionKindBits : public BitField<FunctionKind, 1, 3> {};
+ class FunctionKindBits : public BitField<FunctionKind, 1, 4> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewClosure);
DEFINE_HYDROGEN_CODE_STUB(FastNewClosure, HydrogenCodeStub);
@@ -683,7 +676,7 @@
static Register left() { return InstanceofDescriptor::left(); }
static Register right() { return InstanceofDescriptor::right(); }
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
if (HasArgsInRegisters()) {
return InstanceofDescriptor(isolate());
}
@@ -703,7 +696,7 @@
return (flags() & kReturnTrueFalseObject) != 0;
}
- virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class FlagBits : public BitField<Flags, 0, 3> {};
@@ -734,7 +727,7 @@
void GenerateDispatchToArrayStub(MacroAssembler* masm,
AllocationSiteOverrideMode mode);
- virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};
@@ -764,7 +757,7 @@
minor_key_ = ExponentTypeBits::encode(exponent_type);
}
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
if (exponent_type() == TAGGED) {
return MathPowTaggedDescriptor(isolate());
} else if (exponent_type() == INTEGER) {
@@ -797,11 +790,11 @@
return state.arg_count();
}
- virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; }
- virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; }
+ InlineCacheState GetICState() const OVERRIDE { return DEFAULT; }
- virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
+ ExtraICState GetExtraICState() const FINAL {
return static_cast<ExtraICState>(minor_key_);
}
@@ -820,7 +813,7 @@
void GenerateMiss(MacroAssembler* masm);
private:
- virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
+ void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback);
DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub);
@@ -832,12 +825,10 @@
CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in)
: CallICStub(isolate, state_in) {}
- virtual InlineCacheState GetICState() const FINAL OVERRIDE {
- return MONOMORPHIC;
- }
+ InlineCacheState GetICState() const FINAL { return MONOMORPHIC; }
private:
- virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
+ void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub);
};
@@ -849,12 +840,18 @@
explicit FunctionPrototypeStub(Isolate* isolate)
: PlatformCodeStub(isolate) {}
- virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; }
// TODO(mvstanton): only the receiver register is accessed. When this is
// translated to a hydrogen code stub, a new CallInterfaceDescriptor
// should be created that just uses that register for more efficient code.
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ if (FLAG_vector_ics) {
+ return VectorLoadICDescriptor(isolate());
+ }
+ return LoadDescriptor(isolate());
+ }
+
DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub);
};
@@ -865,23 +862,36 @@
explicit LoadIndexedInterceptorStub(Isolate* isolate)
: PlatformCodeStub(isolate) {}
- virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
- virtual Code::StubType GetStubType() { return Code::FAST; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
DEFINE_PLATFORM_CODE_STUB(LoadIndexedInterceptor, PlatformCodeStub);
};
+class LoadIndexedStringStub : public PlatformCodeStub {
+ public:
+ explicit LoadIndexedStringStub(Isolate* isolate)
+ : PlatformCodeStub(isolate) {}
+
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
+ DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub);
+};
+
+
class HandlerStub : public HydrogenCodeStub {
public:
- virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
- virtual ExtraICState GetExtraICState() const { return kind(); }
- virtual InlineCacheState GetICState() const { return MONOMORPHIC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; }
+ ExtraICState GetExtraICState() const OVERRIDE { return kind(); }
+ InlineCacheState GetICState() const OVERRIDE { return MONOMORPHIC; }
- virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE;
+ void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE;
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE;
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE;
protected:
explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
@@ -905,8 +915,8 @@
}
protected:
- virtual Code::Kind kind() const { return Code::LOAD_IC; }
- virtual Code::StubType GetStubType() { return Code::FAST; }
+ Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
private:
class LoadFieldByIndexBits : public BitField<int, 0, 13> {};
@@ -921,8 +931,8 @@
: HandlerStub(isolate) {}
protected:
- virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
- virtual Code::StubType GetStubType() { return Code::FAST; }
+ Code::Kind kind() const OVERRIDE { return Code::KEYED_LOAD_IC; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
private:
DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub);
@@ -941,8 +951,8 @@
}
protected:
- virtual Code::Kind kind() const { return Code::LOAD_IC; }
- virtual Code::StubType GetStubType() { return Code::FAST; }
+ Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
private:
class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {};
@@ -956,8 +966,8 @@
explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {}
protected:
- virtual Code::Kind kind() const { return Code::LOAD_IC; }
- virtual Code::StubType GetStubType() { return Code::FAST; }
+ Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
DEFINE_HANDLER_CODE_STUB(StringLength, HandlerStub);
};
@@ -985,8 +995,8 @@
}
protected:
- virtual Code::Kind kind() const { return Code::STORE_IC; }
- virtual Code::StubType GetStubType() { return Code::FAST; }
+ Code::Kind kind() const OVERRIDE { return Code::STORE_IC; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
private:
class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
@@ -996,6 +1006,60 @@
};
+class StoreTransitionStub : public HandlerStub {
+ public:
+ enum StoreMode {
+ StoreMapOnly,
+ StoreMapAndValue,
+ ExtendStorageAndStoreMapAndValue
+ };
+
+ explicit StoreTransitionStub(Isolate* isolate) : HandlerStub(isolate) {
+ set_sub_minor_key(StoreModeBits::encode(StoreMapOnly));
+ }
+
+ StoreTransitionStub(Isolate* isolate, FieldIndex index,
+ Representation representation, StoreMode store_mode)
+ : HandlerStub(isolate) {
+ DCHECK(store_mode != StoreMapOnly);
+ int property_index_key = index.GetFieldAccessStubKey();
+ uint8_t repr = PropertyDetails::EncodeRepresentation(representation);
+ set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) |
+ RepresentationBits::encode(repr) |
+ StoreModeBits::encode(store_mode));
+ }
+
+ FieldIndex index() const {
+ DCHECK(store_mode() != StoreMapOnly);
+ int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key());
+ return FieldIndex::FromFieldAccessStubKey(property_index_key);
+ }
+
+ Representation representation() {
+ DCHECK(store_mode() != StoreMapOnly);
+ uint8_t repr = RepresentationBits::decode(sub_minor_key());
+ return PropertyDetails::DecodeRepresentation(repr);
+ }
+
+ StoreMode store_mode() const {
+ return StoreModeBits::decode(sub_minor_key());
+ }
+
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE;
+
+ protected:
+ Code::Kind kind() const OVERRIDE { return Code::STORE_IC; }
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
+
+ private:
+ class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
+ class RepresentationBits : public BitField<uint8_t, 13, 4> {};
+ class StoreModeBits : public BitField<StoreMode, 17, 2> {};
+
+ DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub);
+};
+
+
class StoreGlobalStub : public HandlerStub {
public:
StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
@@ -1023,7 +1087,7 @@
}
}
- virtual Code::Kind kind() const { return Code::STORE_IC; }
+ Code::Kind kind() const OVERRIDE { return Code::STORE_IC; }
bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); }
@@ -1105,15 +1169,11 @@
static void GenerateAheadOfTime(Isolate* isolate);
- virtual Code::Kind GetCodeKind() const OVERRIDE {
- return Code::BINARY_OP_IC;
- }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::BINARY_OP_IC; }
- virtual InlineCacheState GetICState() const FINAL OVERRIDE {
- return state().GetICState();
- }
+ InlineCacheState GetICState() const FINAL { return state().GetICState(); }
- virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
+ ExtraICState GetExtraICState() const FINAL {
return static_cast<ExtraICState>(sub_minor_key());
}
@@ -1121,7 +1181,7 @@
return BinaryOpICState(isolate(), GetExtraICState());
}
- virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT
+ void PrintState(std::ostream& os) const FINAL; // NOLINT
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kLeft = 0;
@@ -1154,19 +1214,15 @@
return CodeStub::GetCodeCopy(pattern);
}
- virtual Code::Kind GetCodeKind() const OVERRIDE {
- return Code::BINARY_OP_IC;
- }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::BINARY_OP_IC; }
- virtual InlineCacheState GetICState() const OVERRIDE {
- return state().GetICState();
- }
+ InlineCacheState GetICState() const OVERRIDE { return state().GetICState(); }
- virtual ExtraICState GetExtraICState() const OVERRIDE {
+ ExtraICState GetExtraICState() const OVERRIDE {
return static_cast<ExtraICState>(minor_key_);
}
- virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
+ void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
private:
BinaryOpICState state() const {
@@ -1191,9 +1247,7 @@
BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state)
: BinaryOpICStub(isolate, state) {}
- virtual Code::Kind GetCodeKind() const FINAL OVERRIDE {
- return Code::STUB;
- }
+ Code::Kind GetCodeKind() const FINAL { return Code::STUB; }
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kAllocationSite = 0;
@@ -1242,7 +1296,7 @@
class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
- virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
+ void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT
DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd);
DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub);
@@ -1261,7 +1315,7 @@
void set_known_map(Handle<Map> map) { known_map_ = map; }
- virtual InlineCacheState GetICState() const;
+ InlineCacheState GetICState() const OVERRIDE;
Token::Value op() const {
return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_));
@@ -1276,7 +1330,7 @@
CompareICState::State state() const { return StateBits::decode(minor_key_); }
private:
- virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::COMPARE_IC; }
void GenerateSmis(MacroAssembler* masm);
void GenerateNumbers(MacroAssembler* masm);
@@ -1291,9 +1345,9 @@
bool strict() const { return op() == Token::EQ_STRICT; }
Condition GetCondition() const;
- virtual void AddToSpecialCache(Handle<Code> new_object);
- virtual bool FindCodeInSpecialCache(Code** code_out);
- virtual bool UseSpecialCache() {
+ void AddToSpecialCache(Handle<Code> new_object) OVERRIDE;
+ bool FindCodeInSpecialCache(Code** code_out) OVERRIDE;
+ bool UseSpecialCache() OVERRIDE {
return state() == CompareICState::KNOWN_OBJECT;
}
@@ -1329,7 +1383,7 @@
return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode();
}
- virtual InlineCacheState GetICState() const {
+ InlineCacheState GetICState() const OVERRIDE {
State state = this->state();
if (state.Contains(GENERIC)) {
return MEGAMORPHIC;
@@ -1340,9 +1394,9 @@
}
}
- virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::COMPARE_NIL_IC; }
- virtual ExtraICState GetExtraICState() const { return sub_minor_key(); }
+ ExtraICState GetExtraICState() const OVERRIDE { return sub_minor_key(); }
void UpdateStatus(Handle<Object> object);
@@ -1354,8 +1408,8 @@
set_sub_minor_key(TypesBits::update(sub_minor_key(), 0));
}
- virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
- virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
+ void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
+ void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT
private:
CompareNilICStub(Isolate* isolate, NilValue nil,
@@ -1382,7 +1436,7 @@
State() : EnumSet<CompareNilType, byte>(0) { }
explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { }
};
- friend OStream& operator<<(OStream& os, const State& s);
+ friend std::ostream& operator<<(std::ostream& os, const State& s);
State state() const { return State(TypesBits::decode(sub_minor_key())); }
@@ -1396,7 +1450,7 @@
};
-OStream& operator<<(OStream& os, const CompareNilICStub::State& s);
+std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s);
class CEntryStub : public PlatformCodeStub {
@@ -1423,7 +1477,7 @@
int result_size() const { return ResultSizeBits::decode(minor_key_); }
#endif // _WIN64
- bool NeedsImmovableCode();
+ bool NeedsImmovableCode() OVERRIDE;
class SaveDoublesBits : public BitField<bool, 0, 1> {};
class ResultSizeBits : public BitField<int, 1, 3> {};
@@ -1442,9 +1496,9 @@
}
private:
- virtual void FinishCode(Handle<Code> code);
+ void FinishCode(Handle<Code> code) OVERRIDE;
- virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
os << (type() == StackFrame::ENTRY ? "JSEntryStub"
: "JSConstructEntryStub");
}
@@ -1475,7 +1529,7 @@
minor_key_ = TypeBits::encode(type);
}
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
if (type() == READ_ELEMENT) {
return ArgumentsAccessReadDescriptor(isolate());
}
@@ -1490,7 +1544,7 @@
void GenerateNewSloppyFast(MacroAssembler* masm);
void GenerateNewSloppySlow(MacroAssembler* masm);
- virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class TypeBits : public BitField<Type, 0, 2> {};
@@ -1544,7 +1598,7 @@
bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }
- virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
// Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
@@ -1563,7 +1617,7 @@
minor_key_ = FlagBits::encode(flags);
}
- virtual void FinishCode(Handle<Code> code) {
+ void FinishCode(Handle<Code> code) OVERRIDE {
code->set_has_function_cache(RecordCallTarget());
}
@@ -1574,7 +1628,7 @@
return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0;
}
- virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class FlagBits : public BitField<CallConstructorFlags, 0, 1> {};
@@ -1594,6 +1648,15 @@
};
+enum ReceiverCheckMode {
+ // We don't know anything about the receiver.
+ RECEIVER_IS_UNKNOWN,
+
+ // We know the receiver is a string.
+ RECEIVER_IS_STRING
+};
+
+
// Generates code implementing String.prototype.charCodeAt.
//
// Only supports the case when the receiver is a string and the index
@@ -1606,20 +1669,19 @@
// preserved, |scratch| and |result| are clobbered.
class StringCharCodeAtGenerator {
public:
- StringCharCodeAtGenerator(Register object,
- Register index,
- Register result,
- Label* receiver_not_string,
- Label* index_not_number,
+ StringCharCodeAtGenerator(Register object, Register index, Register result,
+ Label* receiver_not_string, Label* index_not_number,
Label* index_out_of_range,
- StringIndexFlags index_flags)
+ StringIndexFlags index_flags,
+ ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN)
: object_(object),
index_(index),
result_(result),
receiver_not_string_(receiver_not_string),
index_not_number_(index_not_number),
index_out_of_range_(index_out_of_range),
- index_flags_(index_flags) {
+ index_flags_(index_flags),
+ check_mode_(check_mode) {
DCHECK(!result_.is(object_));
DCHECK(!result_.is(index_));
}
@@ -1651,6 +1713,7 @@
Label* index_out_of_range_;
StringIndexFlags index_flags_;
+ ReceiverCheckMode check_mode_;
Label call_runtime_;
Label index_not_smi_;
@@ -1710,21 +1773,14 @@
// preserved, |scratch1|, |scratch2|, and |result| are clobbered.
class StringCharAtGenerator {
public:
- StringCharAtGenerator(Register object,
- Register index,
- Register scratch,
- Register result,
- Label* receiver_not_string,
- Label* index_not_number,
- Label* index_out_of_range,
- StringIndexFlags index_flags)
- : char_code_at_generator_(object,
- index,
- scratch,
- receiver_not_string,
- index_not_number,
- index_out_of_range,
- index_flags),
+ StringCharAtGenerator(Register object, Register index, Register scratch,
+ Register result, Label* receiver_not_string,
+ Label* index_not_number, Label* index_out_of_range,
+ StringIndexFlags index_flags,
+ ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN)
+ : char_code_at_generator_(object, index, scratch, receiver_not_string,
+ index_not_number, index_out_of_range,
+ index_flags, check_mode),
char_from_code_generator_(scratch, result) {}
// Generates the fast case code. On the fallthrough path |result|
@@ -1762,7 +1818,13 @@
explicit LoadDictionaryElementStub(Isolate* isolate)
: HydrogenCodeStub(isolate) {}
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ if (FLAG_vector_ics) {
+ return VectorLoadICDescriptor(isolate());
+ }
+ return LoadDescriptor(isolate());
+ }
+
DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub);
};
@@ -1771,10 +1833,14 @@
public:
explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
- virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; }
- virtual InlineCacheState GetICState() const { return GENERIC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::KEYED_LOAD_IC; }
+ InlineCacheState GetICState() const OVERRIDE { return GENERIC; }
+ // Since KeyedLoadGeneric stub doesn't miss (simply calls runtime), it
+ // doesn't need to use the VectorLoadICDescriptor for the case when
+ // flag --vector-ics is true.
DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
+
DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub);
};
@@ -1786,13 +1852,11 @@
minor_key_ = state.GetExtraICState();
}
- virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
- virtual InlineCacheState GetICState() const FINAL OVERRIDE {
- return GENERIC;
- }
+ InlineCacheState GetICState() const FINAL { return DEFAULT; }
- virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
+ ExtraICState GetExtraICState() const FINAL {
return static_cast<ExtraICState>(minor_key_);
}
@@ -1811,9 +1875,7 @@
explicit KeyedLoadICTrampolineStub(Isolate* isolate)
: LoadICTrampolineStub(isolate, LoadICState(0)) {}
- virtual Code::Kind GetCodeKind() const OVERRIDE {
- return Code::KEYED_LOAD_IC;
- }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::KEYED_LOAD_IC; }
DEFINE_PLATFORM_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub);
};
@@ -1826,17 +1888,21 @@
set_sub_minor_key(state.GetExtraICState());
}
- virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
- virtual InlineCacheState GetICState() const FINAL OVERRIDE {
- return MEGAMORPHIC;
- }
+ InlineCacheState GetICState() const FINAL { return MEGAMORPHIC; }
- virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
+ ExtraICState GetExtraICState() const FINAL {
return static_cast<ExtraICState>(sub_minor_key());
}
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ if (FLAG_vector_ics) {
+ return VectorLoadICDescriptor(isolate());
+ }
+ return LoadDescriptor(isolate());
+ }
+
DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub);
};
@@ -1848,13 +1914,11 @@
set_sub_minor_key(state.GetExtraICState());
}
- virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
- virtual InlineCacheState GetICState() const FINAL OVERRIDE {
- return GENERIC;
- }
+ InlineCacheState GetICState() const FINAL { return DEFAULT; }
- virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
+ ExtraICState GetExtraICState() const FINAL {
return static_cast<ExtraICState>(sub_minor_key());
}
@@ -1871,9 +1935,7 @@
explicit VectorKeyedLoadStub(Isolate* isolate)
: VectorLoadStub(isolate, LoadICState(0)) {}
- virtual Code::Kind GetCodeKind() const OVERRIDE {
- return Code::KEYED_LOAD_IC;
- }
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::KEYED_LOAD_IC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC);
DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub);
@@ -1893,7 +1955,7 @@
SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0);
}
- virtual bool SometimesSetsUpAFrame() { return false; }
+ bool SometimesSetsUpAFrame() OVERRIDE { return false; }
private:
Register source() const {
@@ -1927,6 +1989,66 @@
};
+class ScriptContextFieldStub : public HandlerStub {
+ public:
+ ScriptContextFieldStub(Isolate* isolate,
+ const ScriptContextTable::LookupResult* lookup_result)
+ : HandlerStub(isolate) {
+ DCHECK(Accepted(lookup_result));
+ set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) |
+ SlotIndexBits::encode(lookup_result->slot_index));
+ }
+
+ int context_index() const {
+ return ContextIndexBits::decode(sub_minor_key());
+ }
+
+ int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); }
+
+ static bool Accepted(const ScriptContextTable::LookupResult* lookup_result) {
+ return ContextIndexBits::is_valid(lookup_result->context_index) &&
+ SlotIndexBits::is_valid(lookup_result->slot_index);
+ }
+
+ private:
+ static const int kContextIndexBits = 13;
+ static const int kSlotIndexBits = 13;
+ class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {};
+ class SlotIndexBits
+ : public BitField<int, kContextIndexBits, kSlotIndexBits> {};
+
+ Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
+
+ DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub);
+};
+
+
+class LoadScriptContextFieldStub : public ScriptContextFieldStub {
+ public:
+ LoadScriptContextFieldStub(
+ Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result)
+ : ScriptContextFieldStub(isolate, lookup_result) {}
+
+ private:
+ Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; }
+
+ DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub);
+};
+
+
+class StoreScriptContextFieldStub : public ScriptContextFieldStub {
+ public:
+ StoreScriptContextFieldStub(
+ Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result)
+ : ScriptContextFieldStub(isolate, lookup_result) {}
+
+ private:
+ Code::Kind kind() const OVERRIDE { return Code::STORE_IC; }
+
+ DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub);
+};
+
+
class LoadFastElementStub : public HydrogenCodeStub {
public:
LoadFastElementStub(Isolate* isolate, bool is_js_array,
@@ -1946,7 +2068,13 @@
class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
class IsJSArrayBits: public BitField<bool, 8, 1> {};
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ if (FLAG_vector_ics) {
+ return VectorLoadICDescriptor(isolate());
+ }
+ return LoadDescriptor(isolate());
+ }
+
DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub);
};
@@ -2010,6 +2138,17 @@
};
+class AllocateHeapNumberStub FINAL : public HydrogenCodeStub {
+ public:
+ explicit AllocateHeapNumberStub(Isolate* isolate)
+ : HydrogenCodeStub(isolate) {}
+
+ private:
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateHeapNumber);
+ DEFINE_HYDROGEN_CODE_STUB(AllocateHeapNumber, HydrogenCodeStub);
+};
+
+
class ArrayConstructorStubBase : public HydrogenCodeStub {
public:
ArrayConstructorStubBase(Isolate* isolate,
@@ -2040,7 +2179,8 @@
static const int kAllocationSite = 1;
protected:
- OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT
+ std::ostream& BasePrintName(std::ostream& os,
+ const char* name) const; // NOLINT
private:
// Ensure data fits within available bits.
@@ -2064,7 +2204,7 @@
}
private:
- virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
BasePrintName(os, "ArrayNoArgumentConstructorStub");
}
@@ -2084,7 +2224,7 @@
}
private:
- virtual void PrintName(OStream& os) const { // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
BasePrintName(os, "ArraySingleArgumentConstructorStub");
}
@@ -2104,7 +2244,7 @@
}
private:
- virtual void PrintName(OStream& os) const { // NOLINT
+ void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
BasePrintName(os, "ArrayNArgumentsConstructorStub");
}
@@ -2248,18 +2388,18 @@
Types types() const { return Types(TypesBits::decode(sub_minor_key())); }
ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); }
- virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
- virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
+ Code::Kind GetCodeKind() const OVERRIDE { return Code::TO_BOOLEAN_IC; }
+ void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
- virtual bool SometimesSetsUpAFrame() { return false; }
+ bool SometimesSetsUpAFrame() OVERRIDE { return false; }
static Handle<Code> GetUninitialized(Isolate* isolate) {
return ToBooleanStub(isolate, UNINITIALIZED).GetCode();
}
- virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); }
+ ExtraICState GetExtraICState() const OVERRIDE { return types().ToIntegral(); }
- virtual InlineCacheState GetICState() const {
+ InlineCacheState GetICState() const OVERRIDE {
if (types().IsEmpty()) {
return ::v8::internal::UNINITIALIZED;
} else {
@@ -2281,7 +2421,7 @@
};
-OStream& operator<<(OStream& os, const ToBooleanStub::Types& t);
+std::ostream& operator<<(std::ostream& os, const ToBooleanStub::Types& t);
class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
@@ -2371,7 +2511,7 @@
explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
// The profile entry hook function is not allowed to cause a GC.
- virtual bool SometimesSetsUpAFrame() { return false; }
+ bool SometimesSetsUpAFrame() OVERRIDE { return false; }
// Generates a call to the entry hook if it's enabled.
static void MaybeCallEntryHook(MacroAssembler* masm);
@@ -2396,7 +2536,7 @@
}
static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
- virtual bool SometimesSetsUpAFrame() { return false; }
+ bool SometimesSetsUpAFrame() OVERRIDE { return false; }
private:
bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
@@ -2417,6 +2557,15 @@
};
+class ToNumberStub FINAL : public PlatformCodeStub {
+ public:
+ explicit ToNumberStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ToNumber);
+ DEFINE_PLATFORM_CODE_STUB(ToNumber, PlatformCodeStub);
+};
+
+
class StringCompareStub : public PlatformCodeStub {
public:
explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {}