Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 7bccaa9..85b0883 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -35,6 +35,7 @@
V(JSEntry) \
V(KeyedLoadICTrampoline) \
V(LoadICTrampoline) \
+ V(LoadGlobalICTrampoline) \
V(CallICTrampoline) \
V(LoadIndexedString) \
V(MathPow) \
@@ -45,9 +46,6 @@
V(StoreElement) \
V(StubFailureTrampoline) \
V(SubString) \
- V(ToNumber) \
- V(NonNumberToNumber) \
- V(StringToNumber) \
V(ToString) \
V(ToName) \
V(ToObject) \
@@ -56,8 +54,6 @@
V(VectorStoreIC) \
V(VectorKeyedStoreIC) \
/* HydrogenCodeStubs */ \
- V(ArrayNArgumentsConstructor) \
- V(ArraySingleArgumentConstructor) \
V(BinaryOpIC) \
V(BinaryOpWithAllocationSite) \
V(CreateAllocationSite) \
@@ -66,6 +62,7 @@
V(FastArrayPush) \
V(FastCloneRegExp) \
V(FastCloneShallowArray) \
+ V(FastFunctionBind) \
V(FastNewClosure) \
V(FastNewContext) \
V(FastNewObject) \
@@ -73,10 +70,7 @@
V(FastNewSloppyArguments) \
V(FastNewStrictArguments) \
V(GrowArrayElements) \
- V(InternalArrayNArgumentsConstructor) \
- V(InternalArraySingleArgumentConstructor) \
V(KeyedLoadGeneric) \
- V(LoadGlobalViaContext) \
V(LoadScriptContextField) \
V(LoadDictionaryElement) \
V(NameDictionaryLookup) \
@@ -91,6 +85,7 @@
V(TransitionElementsKind) \
V(KeyedLoadIC) \
V(LoadIC) \
+ V(LoadGlobalIC) \
/* TurboFanCodeStubs */ \
V(AllocateHeapNumber) \
V(AllocateFloat32x4) \
@@ -104,6 +99,8 @@
V(AllocateUint8x16) \
V(AllocateBool8x16) \
V(ArrayNoArgumentConstructor) \
+ V(ArraySingleArgumentConstructor) \
+ V(ArrayNArgumentsConstructor) \
V(StringLength) \
V(Add) \
V(Subtract) \
@@ -118,6 +115,7 @@
V(BitwiseXor) \
V(Inc) \
V(InternalArrayNoArgumentConstructor) \
+ V(InternalArraySingleArgumentConstructor) \
V(Dec) \
V(FastCloneShallowObject) \
V(InstanceOf) \
@@ -139,8 +137,9 @@
V(ToInteger) \
V(ToLength) \
V(HasProperty) \
+ V(LoadICTrampolineTF) \
+ V(LoadICTF) \
/* IC Handler stubs */ \
- V(ArrayBufferViewLoadField) \
V(KeyedLoadSloppyArguments) \
V(KeyedStoreSloppyArguments) \
V(LoadApiGetter) \
@@ -290,7 +289,6 @@
// BinaryOpStub needs to override this.
virtual Code::Kind GetCodeKind() const;
- virtual InlineCacheState GetICState() const { return UNINITIALIZED; }
virtual ExtraICState GetExtraICState() const { return kNoExtraICState; }
Code::Flags GetCodeFlags() const;
@@ -436,6 +434,12 @@
return NAME##Descriptor(isolate()); \
}
+#define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \
+ public: \
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
+ return OnStackArgsDescriptorBase::ForArgs(isolate(), PARAMETER_COUNT); \
+ }
+
// 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.
@@ -692,7 +696,6 @@
explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
- InlineCacheState GetICState() const override { return MONOMORPHIC; }
ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
@@ -810,7 +813,7 @@
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(InstanceOf, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(InstanceOf, TurboFanCodeStub);
};
class LessThanStub final : public TurboFanCodeStub {
@@ -818,7 +821,7 @@
explicit LessThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(LessThan, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(LessThan, TurboFanCodeStub);
};
class LessThanOrEqualStub final : public TurboFanCodeStub {
@@ -826,7 +829,7 @@
explicit LessThanOrEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(LessThanOrEqual, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(LessThanOrEqual, TurboFanCodeStub);
};
class GreaterThanStub final : public TurboFanCodeStub {
@@ -834,7 +837,7 @@
explicit GreaterThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(GreaterThan, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(GreaterThan, TurboFanCodeStub);
};
class GreaterThanOrEqualStub final : public TurboFanCodeStub {
@@ -843,7 +846,7 @@
: TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(GreaterThanOrEqual, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(GreaterThanOrEqual, TurboFanCodeStub);
};
class EqualStub final : public TurboFanCodeStub {
@@ -851,7 +854,7 @@
explicit EqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(Equal, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Equal, TurboFanCodeStub);
};
class NotEqualStub final : public TurboFanCodeStub {
@@ -859,7 +862,7 @@
explicit NotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(NotEqual, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(NotEqual, TurboFanCodeStub);
};
class StrictEqualStub final : public TurboFanCodeStub {
@@ -867,7 +870,7 @@
explicit StrictEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StrictEqual, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(StrictEqual, TurboFanCodeStub);
};
class StrictNotEqualStub final : public TurboFanCodeStub {
@@ -875,7 +878,7 @@
explicit StrictNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StrictNotEqual, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(StrictNotEqual, TurboFanCodeStub);
};
class StringEqualStub final : public TurboFanCodeStub {
@@ -934,7 +937,7 @@
explicit ToBooleanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
- DEFINE_TURBOFAN_CODE_STUB(ToBoolean, TurboFanCodeStub);
+ DEFINE_TURBOFAN_UNARY_OP_CODE_STUB(ToBoolean, TurboFanCodeStub);
};
class ToIntegerStub final : public TurboFanCodeStub {
@@ -961,7 +964,6 @@
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::STORE_IC; }
- InlineCacheState GetICState() const override { return MONOMORPHIC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(Store);
DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub);
@@ -974,7 +976,6 @@
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; }
- InlineCacheState GetICState() const override { return MONOMORPHIC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_TURBOFAN_CODE_STUB(LoadIndexedInterceptor, TurboFanCodeStub);
@@ -986,7 +987,7 @@
explicit HasPropertyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(HasProperty);
- DEFINE_TURBOFAN_CODE_STUB(HasProperty, TurboFanCodeStub);
+ DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(HasProperty, TurboFanCodeStub);
};
enum StringAddFlags {
@@ -1266,10 +1267,18 @@
explicit FastArrayPushStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
private:
- DEFINE_CALL_INTERFACE_DESCRIPTOR(FastArrayPush);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(VarArgFunction);
DEFINE_HYDROGEN_CODE_STUB(FastArrayPush, HydrogenCodeStub);
};
+class FastFunctionBindStub : public HydrogenCodeStub {
+ public:
+ explicit FastFunctionBindStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
+
+ private:
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(VarArgFunction);
+ DEFINE_HYDROGEN_CODE_STUB(FastFunctionBind, HydrogenCodeStub);
+};
enum AllocationSiteOverrideMode {
DONT_OVERRIDE,
@@ -1298,7 +1307,7 @@
class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};
- DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayNArgumentsConstructor);
DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub);
};
@@ -1310,7 +1319,7 @@
private:
void GenerateCase(MacroAssembler* masm, ElementsKind kind);
- DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayNArgumentsConstructor);
DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub);
};
@@ -1325,13 +1334,17 @@
}
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
- if (exponent_type() == TAGGED) {
+ if (exponent_type() == ON_STACK) {
+ return OnStackArgsDescriptorBase::ForArgs(isolate(), 2);
+ } else if (exponent_type() == TAGGED) {
return MathPowTaggedDescriptor(isolate());
} else if (exponent_type() == INTEGER) {
return MathPowIntegerDescriptor(isolate());
+ } else {
+ // A CallInterfaceDescriptor doesn't specify double registers (yet).
+ DCHECK_EQ(DOUBLE, exponent_type());
+ return ContextOnlyDescriptor(isolate());
}
- // A CallInterfaceDescriptor doesn't specify double registers (yet).
- return ContextOnlyDescriptor(isolate());
}
private:
@@ -1354,8 +1367,6 @@
Code::Kind GetCodeKind() const override { return Code::CALL_IC; }
- InlineCacheState GetICState() const override { return GENERIC; }
-
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
@@ -1365,9 +1376,7 @@
ConvertReceiverMode convert_mode() const { return state().convert_mode(); }
TailCallMode tail_call_mode() const { return state().tail_call_mode(); }
- CallICState state() const {
- return CallICState(static_cast<ExtraICState>(minor_key_));
- }
+ CallICState state() const { return CallICState(GetExtraICState()); }
// Code generation helpers.
void GenerateMiss(MacroAssembler* masm);
@@ -1416,7 +1425,6 @@
public:
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return kind(); }
- InlineCacheState GetICState() const override { return MONOMORPHIC; }
void InitializeDescriptor(CodeStubDescriptor* descriptor) override;
@@ -1453,31 +1461,6 @@
};
-class ArrayBufferViewLoadFieldStub : public HandlerStub {
- public:
- ArrayBufferViewLoadFieldStub(Isolate* isolate, FieldIndex index)
- : HandlerStub(isolate) {
- int property_index_key = index.GetFieldAccessStubKey();
- set_sub_minor_key(
- ArrayBufferViewLoadFieldByIndexBits::encode(property_index_key));
- }
-
- FieldIndex index() const {
- int property_index_key =
- ArrayBufferViewLoadFieldByIndexBits::decode(sub_minor_key());
- return FieldIndex::FromFieldAccessStubKey(property_index_key);
- }
-
- protected:
- Code::Kind kind() const override { return Code::LOAD_IC; }
-
- private:
- class ArrayBufferViewLoadFieldByIndexBits : public BitField<int, 0, 13> {};
-
- DEFINE_HANDLER_CODE_STUB(ArrayBufferViewLoadField, HandlerStub);
-};
-
-
class KeyedLoadSloppyArgumentsStub : public HandlerStub {
public:
explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate)
@@ -1542,7 +1525,6 @@
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
- InlineCacheState GetICState() const override { return MONOMORPHIC; }
int index() const { return IndexBits::decode(minor_key_); }
bool receiver_is_holder() const {
@@ -1764,26 +1746,6 @@
};
-class LoadGlobalViaContextStub final : public PlatformCodeStub {
- public:
- static const int kMaximumDepth = 15;
-
- LoadGlobalViaContextStub(Isolate* isolate, int depth)
- : PlatformCodeStub(isolate) {
- minor_key_ = DepthBits::encode(depth);
- }
-
- int depth() const { return DepthBits::decode(minor_key_); }
-
- private:
- class DepthBits : public BitField<int, 0, 4> {};
- STATIC_ASSERT(DepthBits::kMax == kMaximumDepth);
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext);
- DEFINE_PLATFORM_CODE_STUB(LoadGlobalViaContext, PlatformCodeStub);
-};
-
-
class StoreGlobalViaContextStub final : public PlatformCodeStub {
public:
static const int kMaximumDepth = 15;
@@ -1882,8 +1844,6 @@
Code::Kind GetCodeKind() const override { return Code::BINARY_OP_IC; }
- InlineCacheState GetICState() const final { return state().GetICState(); }
-
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(sub_minor_key());
}
@@ -1927,8 +1887,6 @@
Code::Kind GetCodeKind() const override { return Code::BINARY_OP_IC; }
- InlineCacheState GetICState() const override { return state().GetICState(); }
-
ExtraICState GetExtraICState() const override {
return static_cast<ExtraICState>(minor_key_);
}
@@ -1937,7 +1895,7 @@
private:
BinaryOpICState state() const {
- return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_));
+ return BinaryOpICState(isolate(), GetExtraICState());
}
static void GenerateAheadOfTime(Isolate* isolate,
@@ -2006,14 +1964,19 @@
CompareICState::State right, CompareICState::State state)
: PlatformCodeStub(isolate) {
DCHECK(Token::IsCompareOp(op));
+ DCHECK(OpBits::is_valid(op - Token::EQ));
minor_key_ = OpBits::encode(op - Token::EQ) |
LeftStateBits::encode(left) | RightStateBits::encode(right) |
StateBits::encode(state);
}
+ CompareICStub(Isolate* isolate, ExtraICState extra_ic_state)
+ : PlatformCodeStub(isolate) {
+ minor_key_ = extra_ic_state;
+ }
void set_known_map(Handle<Map> map) { known_map_ = map; }
- InlineCacheState GetICState() const override;
+ InlineCacheState GetICState() const;
Token::Value op() const {
return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_));
@@ -2044,8 +2007,9 @@
bool strict() const { return op() == Token::EQ_STRICT; }
Condition GetCondition() const;
- void AddToSpecialCache(Handle<Code> new_object) override;
- bool FindCodeInSpecialCache(Code** code_out) override;
+ // Although we don't cache anything in the special cache we have to define
+ // this predicate to avoid appearance of code stubs with embedded maps in
+ // the global stub cache.
bool UseSpecialCache() override {
return state() == CompareICState::KNOWN_RECEIVER;
}
@@ -2129,7 +2093,7 @@
public:
explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
- DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly);
+ DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(4);
DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub);
};
@@ -2159,17 +2123,6 @@
};
-enum StringIndexFlags {
- // Accepts smis or heap numbers.
- STRING_INDEX_IS_NUMBER,
-
- // Accepts smis or heap numbers that are valid array indices
- // (ECMA-262 15.4). Invalid indices are reported as being out of
- // range.
- STRING_INDEX_IS_ARRAY_INDEX
-};
-
-
enum ReceiverCheckMode {
// We don't know anything about the receiver.
RECEIVER_IS_UNKNOWN,
@@ -2203,7 +2156,6 @@
StringCharCodeAtGenerator(Register object, Register index, Register result,
Label* receiver_not_string, Label* index_not_number,
Label* index_out_of_range,
- StringIndexFlags index_flags,
ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN)
: object_(object),
index_(index),
@@ -2211,7 +2163,6 @@
receiver_not_string_(receiver_not_string),
index_not_number_(index_not_number),
index_out_of_range_(index_out_of_range),
- index_flags_(index_flags),
check_mode_(check_mode) {
DCHECK(!result_.is(object_));
DCHECK(!result_.is(index_));
@@ -2243,7 +2194,6 @@
Label* index_not_number_;
Label* index_out_of_range_;
- StringIndexFlags index_flags_;
ReceiverCheckMode check_mode_;
Label call_runtime_;
@@ -2307,11 +2257,10 @@
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),
+ check_mode),
char_from_code_generator_(scratch, result) {}
// Generates the fast case code. On the fallthrough path |result|
@@ -2346,64 +2295,72 @@
class LoadDictionaryElementStub : public HydrogenCodeStub {
public:
- explicit LoadDictionaryElementStub(Isolate* isolate, const LoadICState& state)
- : HydrogenCodeStub(isolate) {
- minor_key_ = state.GetExtraICState();
- }
+ explicit LoadDictionaryElementStub(Isolate* isolate)
+ : HydrogenCodeStub(isolate) {}
- CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
- return LoadWithVectorDescriptor(isolate());
- }
-
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub);
};
class KeyedLoadGenericStub : public HydrogenCodeStub {
public:
- explicit KeyedLoadGenericStub(Isolate* isolate, const LoadICState& state)
- : HydrogenCodeStub(isolate) {
- minor_key_ = state.GetExtraICState();
- }
+ explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; }
- InlineCacheState GetICState() const override { return GENERIC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
-
DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub);
};
class LoadICTrampolineStub : public PlatformCodeStub {
public:
- LoadICTrampolineStub(Isolate* isolate, const LoadICState& state)
- : PlatformCodeStub(isolate) {
- minor_key_ = state.GetExtraICState();
- }
+ explicit LoadICTrampolineStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
Code::Kind GetCodeKind() const override { return Code::LOAD_IC; }
- InlineCacheState GetICState() const final { return GENERIC; }
-
- ExtraICState GetExtraICState() const final {
- return static_cast<ExtraICState>(minor_key_);
- }
-
- protected:
- LoadICState state() const {
- return LoadICState(static_cast<ExtraICState>(minor_key_));
- }
-
DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub);
};
+class LoadICTrampolineTFStub : public TurboFanCodeStub {
+ public:
+ explicit LoadICTrampolineTFStub(Isolate* isolate)
+ : TurboFanCodeStub(isolate) {}
+
+ void GenerateAssembly(CodeStubAssembler* assembler) const override;
+
+ Code::Kind GetCodeKind() const override { return Code::LOAD_IC; }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
+ DEFINE_CODE_STUB(LoadICTrampolineTF, TurboFanCodeStub);
+};
+
+class LoadGlobalICTrampolineStub : public TurboFanCodeStub {
+ public:
+ explicit LoadGlobalICTrampolineStub(Isolate* isolate,
+ const LoadGlobalICState& state)
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = state.GetExtraICState();
+ }
+
+ void GenerateAssembly(CodeStubAssembler* assembler) const override;
+
+ Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; }
+
+ ExtraICState GetExtraICState() const final {
+ return static_cast<ExtraICState>(minor_key_);
+ }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobal);
+ DEFINE_CODE_STUB(LoadGlobalICTrampoline, TurboFanCodeStub);
+};
class KeyedLoadICTrampolineStub : public LoadICTrampolineStub {
public:
- explicit KeyedLoadICTrampolineStub(Isolate* isolate, const LoadICState& state)
- : LoadICTrampolineStub(isolate, state) {}
+ explicit KeyedLoadICTrampolineStub(Isolate* isolate)
+ : LoadICTrampolineStub(isolate) {}
Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; }
@@ -2420,8 +2377,6 @@
Code::Kind GetCodeKind() const override { return Code::STORE_IC; }
- InlineCacheState GetICState() const final { return GENERIC; }
-
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
@@ -2458,8 +2413,6 @@
Code::Kind GetCodeKind() const override { return Code::CALL_IC; }
- InlineCacheState GetICState() const final { return GENERIC; }
-
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
@@ -2476,18 +2429,11 @@
class LoadICStub : public PlatformCodeStub {
public:
- explicit LoadICStub(Isolate* isolate, const LoadICState& state)
- : PlatformCodeStub(isolate) {
- minor_key_ = state.GetExtraICState();
- }
+ explicit LoadICStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const override { return Code::LOAD_IC; }
- InlineCacheState GetICState() const final { return GENERIC; }
- ExtraICState GetExtraICState() const final {
- return static_cast<ExtraICState>(minor_key_);
- }
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_PLATFORM_CODE_STUB(LoadIC, PlatformCodeStub);
@@ -2496,21 +2442,44 @@
void GenerateImpl(MacroAssembler* masm, bool in_frame);
};
+class LoadICTFStub : public TurboFanCodeStub {
+ public:
+ explicit LoadICTFStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
+
+ void GenerateAssembly(CodeStubAssembler* assembler) const override;
+
+ Code::Kind GetCodeKind() const override { return Code::LOAD_IC; }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
+ DEFINE_CODE_STUB(LoadICTF, TurboFanCodeStub);
+};
+
+class LoadGlobalICStub : public TurboFanCodeStub {
+ public:
+ explicit LoadGlobalICStub(Isolate* isolate, const LoadGlobalICState& state)
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = state.GetExtraICState();
+ }
+
+ void GenerateAssembly(CodeStubAssembler* assembler) const override;
+
+ Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; }
+
+ ExtraICState GetExtraICState() const final {
+ return static_cast<ExtraICState>(minor_key_);
+ }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalWithVector);
+ DEFINE_CODE_STUB(LoadGlobalIC, TurboFanCodeStub);
+};
class KeyedLoadICStub : public PlatformCodeStub {
public:
- explicit KeyedLoadICStub(Isolate* isolate, const LoadICState& state)
- : PlatformCodeStub(isolate) {
- minor_key_ = state.GetExtraICState();
- }
+ explicit KeyedLoadICStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; }
- InlineCacheState GetICState() const final { return GENERIC; }
- ExtraICState GetExtraICState() const final {
- return static_cast<ExtraICState>(minor_key_);
- }
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_PLATFORM_CODE_STUB(KeyedLoadIC, PlatformCodeStub);
@@ -2530,7 +2499,7 @@
void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const final { return Code::STORE_IC; }
- InlineCacheState GetICState() const final { return GENERIC; }
+
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
@@ -2553,7 +2522,7 @@
void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const final { return Code::KEYED_STORE_IC; }
- InlineCacheState GetICState() const final { return GENERIC; }
+
ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_);
}
@@ -2742,13 +2711,11 @@
class TransitionElementsKindStub : public HydrogenCodeStub {
public:
- TransitionElementsKindStub(Isolate* isolate,
- ElementsKind from_kind,
- ElementsKind to_kind,
- bool is_js_array) : HydrogenCodeStub(isolate) {
+ TransitionElementsKindStub(Isolate* isolate, ElementsKind from_kind,
+ ElementsKind to_kind)
+ : HydrogenCodeStub(isolate) {
set_sub_minor_key(FromKindBits::encode(from_kind) |
- ToKindBits::encode(to_kind) |
- IsJSArrayBits::encode(is_js_array));
+ ToKindBits::encode(to_kind));
}
ElementsKind from_kind() const {
@@ -2757,12 +2724,9 @@
ElementsKind to_kind() const { return ToKindBits::decode(sub_minor_key()); }
- bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
-
private:
class FromKindBits: public BitField<ElementsKind, 8, 8> {};
class ToKindBits: public BitField<ElementsKind, 0, 8> {};
- class IsJSArrayBits: public BitField<bool, 16, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind);
DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub);
@@ -2795,50 +2759,6 @@
SIMD128_TYPES(SIMD128_ALLOC_STUB)
#undef SIMD128_ALLOC_STUB
-class ArrayConstructorStubBase : public HydrogenCodeStub {
- public:
- ArrayConstructorStubBase(Isolate* isolate,
- ElementsKind kind,
- AllocationSiteOverrideMode override_mode)
- : HydrogenCodeStub(isolate) {
- // 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.
- DCHECK(override_mode != DISABLE_ALLOCATION_SITES ||
- AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE);
- set_sub_minor_key(ElementsKindBits::encode(kind) |
- AllocationSiteOverrideModeBits::encode(override_mode));
- }
-
- ElementsKind elements_kind() const {
- return ElementsKindBits::decode(sub_minor_key());
- }
-
- AllocationSiteOverrideMode override_mode() const {
- return AllocationSiteOverrideModeBits::decode(sub_minor_key());
- }
-
- static void GenerateStubsAheadOfTime(Isolate* isolate);
-
- // Parameters accessed via CodeStubGraphBuilder::GetParameter()
- static const int kConstructor = 0;
- static const int kAllocationSite = 1;
-
- protected:
- std::ostream& BasePrintName(std::ostream& os,
- const char* name) const; // NOLINT
-
- private:
- // Ensure data fits within available bits.
- STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1);
-
- class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
- class AllocationSiteOverrideModeBits: public
- BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT
-
- DEFINE_CODE_STUB_BASE(ArrayConstructorStubBase, HydrogenCodeStub);
-};
-
class CommonArrayConstructorStub : public TurboFanCodeStub {
protected:
CommonArrayConstructorStub(Isolate* isolate, ElementsKind kind,
@@ -2869,6 +2789,8 @@
return AllocationSiteOverrideModeBits::decode(sub_minor_key());
}
+ static void GenerateStubsAheadOfTime(Isolate* isolate);
+
private:
// Ensure data fits within available bits.
STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1);
@@ -2911,94 +2833,53 @@
CommonArrayConstructorStub);
};
-class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase {
+class ArraySingleArgumentConstructorStub : public CommonArrayConstructorStub {
public:
ArraySingleArgumentConstructorStub(
- Isolate* isolate,
- ElementsKind kind,
+ Isolate* isolate, ElementsKind kind,
AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
- : ArrayConstructorStubBase(isolate, kind, override_mode) {
- }
+ : CommonArrayConstructorStub(isolate, kind, override_mode) {}
private:
void PrintName(std::ostream& os) const override { // NOLINT
- BasePrintName(os, "ArraySingleArgumentConstructorStub");
+ os << "ArraySingleArgumentConstructorStub";
}
- DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor);
- DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor,
- ArrayConstructorStubBase);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ArraySingleArgumentConstructor);
+ DEFINE_TURBOFAN_CODE_STUB(ArraySingleArgumentConstructor,
+ CommonArrayConstructorStub);
};
-
-class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase {
- public:
- ArrayNArgumentsConstructorStub(
- Isolate* isolate,
- ElementsKind kind,
- AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
- : ArrayConstructorStubBase(isolate, kind, override_mode) {
- }
-
- private:
- void PrintName(std::ostream& os) const override { // NOLINT
- BasePrintName(os, "ArrayNArgumentsConstructorStub");
- }
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor);
- DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor,
- ArrayConstructorStubBase);
-};
-
-
-class InternalArrayConstructorStubBase : public HydrogenCodeStub {
- public:
- InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind)
- : HydrogenCodeStub(isolate) {
- set_sub_minor_key(ElementsKindBits::encode(kind));
- }
-
- static void GenerateStubsAheadOfTime(Isolate* isolate);
-
- // Parameters accessed via CodeStubGraphBuilder::GetParameter()
- static const int kConstructor = 0;
-
- ElementsKind elements_kind() const {
- return ElementsKindBits::decode(sub_minor_key());
- }
-
- private:
- class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
-
- DEFINE_CODE_STUB_BASE(InternalArrayConstructorStubBase, HydrogenCodeStub);
-};
-
-
-class InternalArraySingleArgumentConstructorStub : public
- InternalArrayConstructorStubBase {
+class InternalArraySingleArgumentConstructorStub
+ : public CommonArrayConstructorStub {
public:
InternalArraySingleArgumentConstructorStub(Isolate* isolate,
ElementsKind kind)
- : InternalArrayConstructorStubBase(isolate, kind) { }
+ : CommonArrayConstructorStub(isolate, kind, DONT_OVERRIDE) {}
- DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor);
- DEFINE_HYDROGEN_CODE_STUB(InternalArraySingleArgumentConstructor,
- InternalArrayConstructorStubBase);
+ private:
+ void PrintName(std::ostream& os) const override { // NOLINT
+ os << "InternalArraySingleArgumentConstructorStub";
+ }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ArraySingleArgumentConstructor);
+ DEFINE_TURBOFAN_CODE_STUB(InternalArraySingleArgumentConstructor,
+ CommonArrayConstructorStub);
};
-
-class InternalArrayNArgumentsConstructorStub : public
- InternalArrayConstructorStubBase {
+class ArrayNArgumentsConstructorStub : public PlatformCodeStub {
public:
- InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind)
- : InternalArrayConstructorStubBase(isolate, kind) { }
+ explicit ArrayNArgumentsConstructorStub(Isolate* isolate)
+ : PlatformCodeStub(isolate) {}
- DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor);
- DEFINE_HYDROGEN_CODE_STUB(InternalArrayNArgumentsConstructor,
- InternalArrayConstructorStubBase);
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
+ return ArrayNArgumentsConstructorDescriptor(isolate());
+ }
+
+ private:
+ DEFINE_PLATFORM_CODE_STUB(ArrayNArgumentsConstructor, PlatformCodeStub);
};
-
class StoreElementStub : public PlatformCodeStub {
public:
StoreElementStub(Isolate* isolate, ElementsKind elements_kind,
@@ -3051,7 +2932,7 @@
Types() : EnumSet<Type, uint16_t>(0) {}
explicit Types(uint16_t bits) : EnumSet<Type, uint16_t>(bits) {}
- bool UpdateStatus(Handle<Object> object);
+ bool UpdateStatus(Isolate* isolate, Handle<Object> object);
bool NeedsMap() const;
bool CanBeUndetectable() const {
return Contains(ToBooleanICStub::SPEC_OBJECT);
@@ -3080,7 +2961,7 @@
ExtraICState GetExtraICState() const override { return types().ToIntegral(); }
- InlineCacheState GetICState() const override {
+ InlineCacheState GetICState() const {
if (types().IsEmpty()) {
return ::v8::internal::UNINITIALIZED;
} else {
@@ -3197,37 +3078,10 @@
public:
explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
- DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly);
+ DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(3);
DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub);
};
-
-class ToNumberStub final : public PlatformCodeStub {
- public:
- explicit ToNumberStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
- DEFINE_PLATFORM_CODE_STUB(ToNumber, PlatformCodeStub);
-};
-
-class NonNumberToNumberStub final : public PlatformCodeStub {
- public:
- explicit NonNumberToNumberStub(Isolate* isolate)
- : PlatformCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
- DEFINE_PLATFORM_CODE_STUB(NonNumberToNumber, PlatformCodeStub);
-};
-
-class StringToNumberStub final : public PlatformCodeStub {
- public:
- explicit StringToNumberStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
- DEFINE_PLATFORM_CODE_STUB(StringToNumber, PlatformCodeStub);
-};
-
-
class ToStringStub final : public PlatformCodeStub {
public:
explicit ToStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
@@ -3236,7 +3090,6 @@
DEFINE_PLATFORM_CODE_STUB(ToString, PlatformCodeStub);
};
-
class ToNameStub final : public PlatformCodeStub {
public:
explicit ToNameStub(Isolate* isolate) : PlatformCodeStub(isolate) {}