summaryrefslogtreecommitdiff
path: root/deps/v8/src/code-stubs.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/code-stubs.h')
-rw-r--r--deps/v8/src/code-stubs.h505
1 files changed, 206 insertions, 299 deletions
diff --git a/deps/v8/src/code-stubs.h b/deps/v8/src/code-stubs.h
index 4793d74f96..5c83fdebb0 100644
--- a/deps/v8/src/code-stubs.h
+++ b/deps/v8/src/code-stubs.h
@@ -18,6 +18,8 @@
namespace v8 {
namespace internal {
+class ObjectLiteral;
+
// List of code stubs used on all platforms.
#define CODE_STUB_LIST_ALL_PLATFORMS(V) \
/* --- PlatformCodeStubs --- */ \
@@ -41,8 +43,6 @@ namespace internal {
V(StoreBufferOverflow) \
V(StoreElement) \
V(SubString) \
- V(ToString) \
- V(ToName) \
V(StoreIC) \
V(KeyedStoreIC) \
V(KeyedLoadIC) \
@@ -66,12 +66,8 @@ namespace internal {
V(KeyedStoreICTrampoline) \
V(StoreICTrampoline) \
/* --- HydrogenCodeStubs --- */ \
- V(ElementsTransitionAndStore) \
- V(FastCloneShallowArray) \
V(NumberToString) \
V(StringAdd) \
- V(ToObject) \
- V(Typeof) \
/* These builtins w/ JS linkage are */ \
/* just fast-cases of C++ builtins. They */ \
/* require varg support from TF */ \
@@ -81,18 +77,10 @@ namespace internal {
/* as part of the new IC system, ask */ \
/* ishell before doing anything */ \
V(KeyedLoadGeneric) \
- V(KeyedLoadSloppyArguments) \
- V(KeyedStoreSloppyArguments) \
V(LoadConstant) \
V(LoadDictionaryElement) \
V(LoadFastElement) \
V(LoadField) \
- V(LoadScriptContextField) \
- V(StoreFastElement) \
- V(StoreField) \
- V(StoreGlobal) \
- V(StoreScriptContextField) \
- V(StoreTransition) \
/* These should never be ported to TF */ \
/* because they are either used only by */ \
/* FCG/Crankshaft or are deprecated */ \
@@ -140,8 +128,10 @@ namespace internal {
V(InternalArrayNoArgumentConstructor) \
V(InternalArraySingleArgumentConstructor) \
V(Dec) \
- V(FastCloneShallowObject) \
+ V(ElementsTransitionAndStore) \
V(FastCloneRegExp) \
+ V(FastCloneShallowArray) \
+ V(FastCloneShallowObject) \
V(FastNewClosure) \
V(FastNewFunctionContext) \
V(InstanceOf) \
@@ -151,14 +141,12 @@ namespace internal {
V(GreaterThanOrEqual) \
V(Equal) \
V(NotEqual) \
+ V(KeyedLoadSloppyArguments) \
+ V(KeyedStoreSloppyArguments) \
+ V(LoadScriptContextField) \
+ V(StoreScriptContextField) \
V(StrictEqual) \
V(StrictNotEqual) \
- V(StringEqual) \
- V(StringNotEqual) \
- V(StringLessThan) \
- V(StringLessThanOrEqual) \
- V(StringGreaterThan) \
- V(StringGreaterThanOrEqual) \
V(ToInteger) \
V(ToLength) \
V(HasProperty) \
@@ -166,16 +154,25 @@ namespace internal {
V(GetProperty) \
V(LoadICTF) \
V(KeyedLoadICTF) \
+ V(StoreFastElement) \
+ V(StoreField) \
+ V(StoreGlobal) \
+ V(StoreICTF) \
V(StoreInterceptor) \
+ V(StoreMap) \
+ V(StoreTransition) \
V(LoadApiGetter) \
V(LoadIndexedInterceptor) \
V(GrowArrayElements) \
+ V(ToObject) \
+ V(Typeof) \
/* These are only called from FGC and */ \
/* can be removed when we use ignition */ \
/* only */ \
V(LoadICTrampolineTF) \
V(LoadGlobalICTrampoline) \
- V(KeyedLoadICTrampolineTF)
+ V(KeyedLoadICTrampolineTF) \
+ V(StoreICTrampolineTF)
// List of code stubs only used on ARM 32 bits platforms.
#if V8_TARGET_ARCH_ARM
@@ -487,12 +484,6 @@ class CodeStub BASE_EMBEDDED {
return 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.
@@ -564,7 +555,7 @@ class CodeStubDescriptor {
return call_descriptor().GetRegisterParameter(index);
}
- Type* GetParameterType(int index) const {
+ MachineType GetParameterType(int index) const {
return call_descriptor().GetParameterType(index);
}
@@ -993,57 +984,6 @@ class StrictNotEqualStub final : public TurboFanCodeStub {
DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(StrictNotEqual, TurboFanCodeStub);
};
-class StringEqualStub final : public TurboFanCodeStub {
- public:
- explicit StringEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StringEqual, TurboFanCodeStub);
-};
-
-class StringNotEqualStub final : public TurboFanCodeStub {
- public:
- explicit StringNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StringNotEqual, TurboFanCodeStub);
-};
-
-class StringLessThanStub final : public TurboFanCodeStub {
- public:
- explicit StringLessThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StringLessThan, TurboFanCodeStub);
-};
-
-class StringLessThanOrEqualStub final : public TurboFanCodeStub {
- public:
- explicit StringLessThanOrEqualStub(Isolate* isolate)
- : TurboFanCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StringLessThanOrEqual, TurboFanCodeStub);
-};
-
-class StringGreaterThanStub final : public TurboFanCodeStub {
- public:
- explicit StringGreaterThanStub(Isolate* isolate)
- : TurboFanCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StringGreaterThan, TurboFanCodeStub);
-};
-
-class StringGreaterThanOrEqualStub final : public TurboFanCodeStub {
- public:
- explicit StringGreaterThanOrEqualStub(Isolate* isolate)
- : TurboFanCodeStub(isolate) {}
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
- DEFINE_TURBOFAN_CODE_STUB(StringGreaterThanOrEqual, TurboFanCodeStub);
-};
-
class ToIntegerStub final : public TurboFanCodeStub {
public:
explicit ToIntegerStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
@@ -1174,7 +1114,7 @@ class FastNewFunctionContextStub final : public TurboFanCodeStub {
// FastNewFunctionContextStub can only allocate closures which fit in the
// new space.
STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize +
- FixedArray::kHeaderSize) < Page::kMaxRegularHeapObjectSize);
+ FixedArray::kHeaderSize) < kMaxRegularHeapObjectSize);
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewFunctionContext);
DEFINE_TURBOFAN_CODE_STUB(FastNewFunctionContext, TurboFanCodeStub);
@@ -1269,24 +1209,30 @@ class FastCloneRegExpStub final : public TurboFanCodeStub {
DEFINE_TURBOFAN_CODE_STUB(FastCloneRegExp, TurboFanCodeStub);
};
-
-class FastCloneShallowArrayStub : public HydrogenCodeStub {
+class FastCloneShallowArrayStub : public TurboFanCodeStub {
public:
FastCloneShallowArrayStub(Isolate* isolate,
AllocationSiteMode allocation_site_mode)
- : HydrogenCodeStub(isolate) {
- set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode));
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = AllocationSiteModeBits::encode(allocation_site_mode);
}
+ static compiler::Node* Generate(CodeStubAssembler* assembler,
+ compiler::Node* closure,
+ compiler::Node* literal_index,
+ compiler::Node* context,
+ CodeStubAssembler::Label* call_runtime,
+ AllocationSiteMode allocation_site_mode);
+
AllocationSiteMode allocation_site_mode() const {
- return AllocationSiteModeBits::decode(sub_minor_key());
+ return AllocationSiteModeBits::decode(minor_key_);
}
private:
class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowArray);
- DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowArray, HydrogenCodeStub);
+ DEFINE_TURBOFAN_CODE_STUB(FastCloneShallowArray, TurboFanCodeStub);
};
class FastCloneShallowObjectStub : public TurboFanCodeStub {
@@ -1556,35 +1502,36 @@ class LoadFieldStub: public HandlerStub {
DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub);
};
-
-class KeyedLoadSloppyArgumentsStub : public HandlerStub {
+class KeyedLoadSloppyArgumentsStub : public TurboFanCodeStub {
public:
explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate)
- : HandlerStub(isolate) {}
+ : TurboFanCodeStub(isolate) {}
- protected:
- Code::Kind kind() const override { return Code::KEYED_LOAD_IC; }
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; }
+ ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
+ protected:
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
- DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub);
+ DEFINE_TURBOFAN_CODE_STUB(KeyedLoadSloppyArguments, TurboFanCodeStub);
};
class CommonStoreModeBits : public BitField<KeyedAccessStoreMode, 0, 3> {};
-class KeyedStoreSloppyArgumentsStub : public HandlerStub {
+class KeyedStoreSloppyArgumentsStub : public TurboFanCodeStub {
public:
explicit KeyedStoreSloppyArgumentsStub(Isolate* isolate,
KeyedAccessStoreMode mode)
- : HandlerStub(isolate) {
- set_sub_minor_key(CommonStoreModeBits::encode(mode));
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = CommonStoreModeBits::encode(mode);
}
- protected:
- Code::Kind kind() const override { return Code::KEYED_STORE_IC; }
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; }
+ ExtraICState GetExtraICState() const override { return Code::STORE_IC; }
+ protected:
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
- DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub);
+ DEFINE_TURBOFAN_CODE_STUB(KeyedStoreSloppyArguments, TurboFanCodeStub);
};
@@ -1637,161 +1584,107 @@ class LoadApiGetterStub : public TurboFanCodeStub {
DEFINE_TURBOFAN_CODE_STUB(LoadApiGetter, TurboFanCodeStub);
};
-class StoreFieldStub : public HandlerStub {
+class StoreFieldStub : public TurboFanCodeStub {
public:
StoreFieldStub(Isolate* isolate, FieldIndex index,
Representation representation)
- : HandlerStub(isolate) {
+ : TurboFanCodeStub(isolate) {
int property_index_key = index.GetFieldAccessStubKey();
- uint8_t repr = PropertyDetails::EncodeRepresentation(representation);
- set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) |
- RepresentationBits::encode(repr));
+ minor_key_ = StoreFieldByIndexBits::encode(property_index_key) |
+ RepresentationBits::encode(representation.kind());
}
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; }
+ ExtraICState GetExtraICState() const override { return Code::STORE_IC; }
+
FieldIndex index() const {
- int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key());
+ int property_index_key = StoreFieldByIndexBits::decode(minor_key_);
return FieldIndex::FromFieldAccessStubKey(property_index_key);
}
- Representation representation() {
- uint8_t repr = RepresentationBits::decode(sub_minor_key());
- return PropertyDetails::DecodeRepresentation(repr);
+ Representation representation() const {
+ return Representation::FromKind(RepresentationBits::decode(minor_key_));
}
- protected:
- Code::Kind kind() const override { return Code::STORE_IC; }
-
private:
class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
- class RepresentationBits : public BitField<uint8_t, 13, 4> {};
+ class RepresentationBits
+ : public BitField<Representation::Kind, StoreFieldByIndexBits::kNext, 4> {
+ };
+ STATIC_ASSERT(Representation::kNumRepresentations - 1 <
+ RepresentationBits::kMax);
- // TODO(ishell): The stub uses only kReceiver and kValue parameters.
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
- DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub);
+ DEFINE_TURBOFAN_CODE_STUB(StoreField, TurboFanCodeStub);
};
-
-// Register and parameter access methods are specified here instead of in
-// the CallInterfaceDescriptor because the stub uses a different descriptor
-// if FLAG_vector_stores is on.
-class StoreTransitionHelper {
+class StoreMapStub : public TurboFanCodeStub {
public:
- static Register ReceiverRegister() {
- return StoreTransitionDescriptor::ReceiverRegister();
- }
-
- static Register NameRegister() {
- return StoreTransitionDescriptor::NameRegister();
- }
-
- static Register ValueRegister() {
- return StoreTransitionDescriptor::ValueRegister();
- }
-
- static Register SlotRegister() {
- return VectorStoreTransitionDescriptor::SlotRegister();
- }
-
- static Register VectorRegister() {
- return VectorStoreTransitionDescriptor::VectorRegister();
- }
-
- static Register MapRegister() {
- return VectorStoreTransitionDescriptor::MapRegister();
- }
-
- static int ReceiverIndex() { return StoreTransitionDescriptor::kReceiver; }
-
- static int NameIndex() { return StoreTransitionDescriptor::kReceiver; }
-
- static int ValueIndex() { return StoreTransitionDescriptor::kValue; }
-
- static int MapIndex() {
- DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMap) ==
- static_cast<int>(StoreTransitionDescriptor::kMap));
- return StoreTransitionDescriptor::kMap;
- }
+ explicit StoreMapStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
- static int VectorIndex() {
- if (HasVirtualSlotArg()) {
- return VectorStoreTransitionDescriptor::kVirtualSlotVector;
- }
- return VectorStoreTransitionDescriptor::kVector;
- }
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; }
+ ExtraICState GetExtraICState() const override { return Code::STORE_IC; }
- // Some platforms don't have a slot arg.
- static bool HasVirtualSlotArg() {
- return SlotRegister().is(no_reg);
- }
+ private:
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreTransition);
+ DEFINE_TURBOFAN_CODE_STUB(StoreMap, TurboFanCodeStub);
};
-
-class StoreTransitionStub : public HandlerStub {
+class StoreTransitionStub : public TurboFanCodeStub {
public:
enum StoreMode {
- StoreMapOnly,
StoreMapAndValue,
ExtendStorageAndStoreMapAndValue
};
- explicit StoreTransitionStub(Isolate* isolate) : HandlerStub(isolate) {
- set_sub_minor_key(StoreModeBits::encode(StoreMapOnly));
- }
-
- StoreTransitionStub(Isolate* isolate, FieldIndex index,
+ StoreTransitionStub(Isolate* isolate, bool is_inobject,
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));
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = IsInobjectBits::encode(is_inobject) |
+ RepresentationBits::encode(representation.kind()) |
+ 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);
- }
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; }
+ ExtraICState GetExtraICState() const override { return Code::STORE_IC; }
- Representation representation() {
- DCHECK(store_mode() != StoreMapOnly);
- uint8_t repr = RepresentationBits::decode(sub_minor_key());
- return PropertyDetails::DecodeRepresentation(repr);
- }
+ bool is_inobject() const { return IsInobjectBits::decode(minor_key_); }
- StoreMode store_mode() const {
- return StoreModeBits::decode(sub_minor_key());
+ Representation representation() const {
+ return Representation::FromKind(RepresentationBits::decode(minor_key_));
}
- protected:
- Code::Kind kind() const override { return Code::STORE_IC; }
- void InitializeDescriptor(CodeStubDescriptor* descriptor) override;
+ StoreMode store_mode() const { return StoreModeBits::decode(minor_key_); }
private:
- class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
- class RepresentationBits : public BitField<uint8_t, 13, 4> {};
- class StoreModeBits : public BitField<StoreMode, 17, 2> {};
+ class IsInobjectBits : public BitField<bool, 0, 1> {};
+ class RepresentationBits
+ : public BitField<Representation::Kind, IsInobjectBits::kNext, 4> {};
+ STATIC_ASSERT(Representation::kNumRepresentations - 1 <
+ RepresentationBits::kMax);
+ class StoreModeBits
+ : public BitField<StoreMode, RepresentationBits::kNext, 1> {};
- DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition);
- DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreNamedTransition);
+ DEFINE_TURBOFAN_CODE_STUB(StoreTransition, TurboFanCodeStub);
};
-
-class StoreGlobalStub : public HandlerStub {
+class StoreGlobalStub : public TurboFanCodeStub {
public:
StoreGlobalStub(Isolate* isolate, PropertyCellType type,
Maybe<PropertyCellConstantType> constant_type,
bool check_global)
- : HandlerStub(isolate) {
+ : TurboFanCodeStub(isolate) {
PropertyCellConstantType encoded_constant_type =
constant_type.FromMaybe(PropertyCellConstantType::kSmi);
- set_sub_minor_key(CellTypeBits::encode(type) |
- ConstantTypeBits::encode(encoded_constant_type) |
- CheckGlobalBits::encode(check_global));
+ minor_key_ = CellTypeBits::encode(type) |
+ ConstantTypeBits::encode(encoded_constant_type) |
+ CheckGlobalBits::encode(check_global);
}
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; }
+ ExtraICState GetExtraICState() const override { return Code::STORE_IC; }
+
static Handle<HeapObject> property_cell_placeholder(Isolate* isolate) {
return isolate->factory()->uninitialized_value();
}
@@ -1812,37 +1705,25 @@ class StoreGlobalStub : public HandlerStub {
return CodeStub::GetCodeCopy(pattern);
}
- Code::Kind kind() const override { return Code::STORE_IC; }
-
PropertyCellType cell_type() const {
- return CellTypeBits::decode(sub_minor_key());
+ return CellTypeBits::decode(minor_key_);
}
PropertyCellConstantType constant_type() const {
DCHECK(PropertyCellType::kConstantType == cell_type());
- return ConstantTypeBits::decode(sub_minor_key());
+ return ConstantTypeBits::decode(minor_key_);
}
- bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); }
-
- Representation representation() {
- return Representation::FromKind(
- RepresentationBits::decode(sub_minor_key()));
- }
-
- void set_representation(Representation r) {
- set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind()));
- }
+ bool check_global() const { return CheckGlobalBits::decode(minor_key_); }
private:
class CellTypeBits : public BitField<PropertyCellType, 0, 2> {};
- class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {};
- class RepresentationBits : public BitField<Representation::Kind, 4, 8> {};
- class CheckGlobalBits : public BitField<bool, 12, 1> {};
+ class ConstantTypeBits
+ : public BitField<PropertyCellConstantType, CellTypeBits::kNext, 2> {};
+ class CheckGlobalBits : public BitField<bool, ConstantTypeBits::kNext, 1> {};
- // TODO(ishell): The stub uses only kValue parameter.
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
- DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub);
+ DEFINE_TURBOFAN_CODE_STUB(StoreGlobal, TurboFanCodeStub);
};
// TODO(ishell): remove, once StoreGlobalIC is implemented.
@@ -1889,10 +1770,6 @@ class CallApiCallbackStub : public PlatformCodeStub {
: CallApiCallbackStub(isolate, argc, false, call_data_undefined,
is_lazy) {}
- CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
- return ApiCallbackDescriptorBase::ForArgs(isolate(), argc());
- }
-
private:
CallApiCallbackStub(Isolate* isolate, int argc, bool is_store,
bool call_data_undefined, bool is_lazy)
@@ -1916,6 +1793,7 @@ class CallApiCallbackStub : public PlatformCodeStub {
class ArgumentBits : public BitField<int, 2, kArgBits> {};
class IsLazyAccessorBits : public BitField<bool, 3 + kArgBits, 1> {};
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiCallback);
DEFINE_PLATFORM_CODE_STUB(CallApiCallback, PlatformCodeStub);
};
@@ -2195,11 +2073,11 @@ class RegExpExecStub: public PlatformCodeStub {
public:
explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
- DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(4);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpExec);
DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub);
};
-
+// TODO(jgruber): Remove this once all uses in regexp.js have been removed.
class RegExpConstructResultStub final : public HydrogenCodeStub {
public:
explicit RegExpConstructResultStub(Isolate* isolate)
@@ -2490,15 +2368,34 @@ class StoreICTrampolineStub : public PlatformCodeStub {
}
protected:
- StoreICState state() const {
- return StoreICState(static_cast<ExtraICState>(minor_key_));
- }
+ StoreICState state() const { return StoreICState(GetExtraICState()); }
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(Store);
DEFINE_PLATFORM_CODE_STUB(StoreICTrampoline, PlatformCodeStub);
};
+class StoreICTrampolineTFStub : public TurboFanCodeStub {
+ public:
+ StoreICTrampolineTFStub(Isolate* isolate, const StoreICState& state)
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = state.GetExtraICState();
+ }
+
+ void GenerateAssembly(CodeStubAssembler* assembler) const override;
+
+ Code::Kind GetCodeKind() const override { return Code::STORE_IC; }
+ ExtraICState GetExtraICState() const final {
+ return static_cast<ExtraICState>(minor_key_);
+ }
+
+ protected:
+ StoreICState state() const { return StoreICState(GetExtraICState()); }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(Store);
+ DEFINE_CODE_STUB(StoreICTrampolineTF, TurboFanCodeStub);
+};
+
class KeyedStoreICTrampolineStub : public StoreICTrampolineStub {
public:
KeyedStoreICTrampolineStub(Isolate* isolate, const StoreICState& state)
@@ -2627,6 +2524,24 @@ class StoreICStub : public PlatformCodeStub {
void GenerateImpl(MacroAssembler* masm, bool in_frame);
};
+class StoreICTFStub : public TurboFanCodeStub {
+ public:
+ StoreICTFStub(Isolate* isolate, const StoreICState& state)
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = state.GetExtraICState();
+ }
+
+ void GenerateAssembly(CodeStubAssembler* assembler) const override;
+
+ Code::Kind GetCodeKind() const override { return Code::STORE_IC; }
+ ExtraICState GetExtraICState() const final {
+ return static_cast<ExtraICState>(minor_key_);
+ }
+
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
+ DEFINE_CODE_STUB(StoreICTF, TurboFanCodeStub);
+};
+
class KeyedStoreICStub : public PlatformCodeStub {
public:
KeyedStoreICStub(Isolate* isolate, const StoreICState& state)
@@ -2696,23 +2611,21 @@ class DoubleToIStub : public PlatformCodeStub {
DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub);
};
-
-class ScriptContextFieldStub : public HandlerStub {
+class ScriptContextFieldStub : public TurboFanCodeStub {
public:
ScriptContextFieldStub(Isolate* isolate,
const ScriptContextTable::LookupResult* lookup_result)
- : HandlerStub(isolate) {
+ : TurboFanCodeStub(isolate) {
DCHECK(Accepted(lookup_result));
- STATIC_ASSERT(kContextIndexBits + kSlotIndexBits <= kSubMinorKeyBits);
- set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) |
- SlotIndexBits::encode(lookup_result->slot_index));
+ minor_key_ = ContextIndexBits::encode(lookup_result->context_index) |
+ SlotIndexBits::encode(lookup_result->slot_index);
}
- int context_index() const {
- return ContextIndexBits::decode(sub_minor_key());
- }
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; }
+
+ int context_index() const { return ContextIndexBits::decode(minor_key_); }
- int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); }
+ int slot_index() const { return SlotIndexBits::decode(minor_key_); }
static bool Accepted(const ScriptContextTable::LookupResult* lookup_result) {
return ContextIndexBits::is_valid(lookup_result->context_index) &&
@@ -2726,7 +2639,7 @@ class ScriptContextFieldStub : public HandlerStub {
class SlotIndexBits
: public BitField<int, kContextIndexBits, kSlotIndexBits> {};
- DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub);
+ DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, TurboFanCodeStub);
};
@@ -2736,11 +2649,11 @@ class LoadScriptContextFieldStub : public ScriptContextFieldStub {
Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result)
: ScriptContextFieldStub(isolate, lookup_result) {}
- private:
- Code::Kind kind() const override { return Code::LOAD_IC; }
+ ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
+ private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
- DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub);
+ DEFINE_TURBOFAN_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub);
};
@@ -2750,11 +2663,11 @@ class StoreScriptContextFieldStub : public ScriptContextFieldStub {
Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result)
: ScriptContextFieldStub(isolate, lookup_result) {}
- private:
- Code::Kind kind() const override { return Code::STORE_IC; }
+ ExtraICState GetExtraICState() const override { return Code::STORE_IC; }
+ private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
- DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub);
+ DEFINE_TURBOFAN_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub);
};
@@ -2790,38 +2703,38 @@ class LoadFastElementStub : public HandlerStub {
DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub);
};
-
-class StoreFastElementStub : public HydrogenCodeStub {
+class StoreFastElementStub : public TurboFanCodeStub {
public:
StoreFastElementStub(Isolate* isolate, bool is_js_array,
ElementsKind elements_kind, KeyedAccessStoreMode mode)
- : HydrogenCodeStub(isolate) {
- set_sub_minor_key(CommonStoreModeBits::encode(mode) |
- ElementsKindBits::encode(elements_kind) |
- IsJSArrayBits::encode(is_js_array));
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = CommonStoreModeBits::encode(mode) |
+ ElementsKindBits::encode(elements_kind) |
+ IsJSArrayBits::encode(is_js_array);
}
static void GenerateAheadOfTime(Isolate* isolate);
- bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
+ bool is_js_array() const { return IsJSArrayBits::decode(minor_key_); }
ElementsKind elements_kind() const {
- return ElementsKindBits::decode(sub_minor_key());
+ return ElementsKindBits::decode(minor_key_);
}
KeyedAccessStoreMode store_mode() const {
- return CommonStoreModeBits::decode(sub_minor_key());
+ return CommonStoreModeBits::decode(minor_key_);
}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
private:
- class ElementsKindBits : public BitField<ElementsKind, 3, 8> {};
- class IsJSArrayBits : public BitField<bool, 11, 1> {};
+ class ElementsKindBits
+ : public BitField<ElementsKind, CommonStoreModeBits::kNext, 8> {};
+ class IsJSArrayBits : public BitField<bool, ElementsKindBits::kNext, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
- DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub);
+ DEFINE_TURBOFAN_CODE_STUB(StoreFastElement, TurboFanCodeStub);
};
@@ -3008,10 +2921,6 @@ class StoreElementStub : public PlatformCodeStub {
CommonStoreModeBits::encode(mode);
}
- CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
- return StoreWithVectorDescriptor(isolate());
- }
-
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
@@ -3020,8 +2929,10 @@ class StoreElementStub : public PlatformCodeStub {
return ElementsKindBits::decode(minor_key_);
}
- class ElementsKindBits : public BitField<ElementsKind, 3, 8> {};
+ class ElementsKindBits
+ : public BitField<ElementsKind, CommonStoreModeBits::kNext, 8> {};
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub);
};
@@ -3098,34 +3009,35 @@ class ToBooleanICStub : public HydrogenCodeStub {
std::ostream& operator<<(std::ostream& os, const ToBooleanICStub::Types& t);
-class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
+class ElementsTransitionAndStoreStub : public TurboFanCodeStub {
public:
ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind,
ElementsKind to_kind, bool is_jsarray,
KeyedAccessStoreMode store_mode)
- : HydrogenCodeStub(isolate) {
- set_sub_minor_key(CommonStoreModeBits::encode(store_mode) |
- FromBits::encode(from_kind) | ToBits::encode(to_kind) |
- IsJSArrayBits::encode(is_jsarray));
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = CommonStoreModeBits::encode(store_mode) |
+ FromBits::encode(from_kind) | ToBits::encode(to_kind) |
+ IsJSArrayBits::encode(is_jsarray);
}
- ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); }
- ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); }
- bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); }
+ ElementsKind from_kind() const { return FromBits::decode(minor_key_); }
+ ElementsKind to_kind() const { return ToBits::decode(minor_key_); }
+ bool is_jsarray() const { return IsJSArrayBits::decode(minor_key_); }
KeyedAccessStoreMode store_mode() const {
- return CommonStoreModeBits::decode(sub_minor_key());
+ return CommonStoreModeBits::decode(minor_key_);
}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
private:
- class FromBits : public BitField<ElementsKind, 3, 8> {};
+ class FromBits
+ : public BitField<ElementsKind, CommonStoreModeBits::kNext, 8> {};
class ToBits : public BitField<ElementsKind, 11, 8> {};
class IsJSArrayBits : public BitField<bool, 19, 1> {};
- DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition);
- DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreTransition);
+ DEFINE_TURBOFAN_CODE_STUB(ElementsTransitionAndStore, TurboFanCodeStub);
};
@@ -3191,29 +3103,24 @@ class StoreBufferOverflowStub : public PlatformCodeStub {
DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub);
};
-
-class SubStringStub : public PlatformCodeStub {
- public:
- explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
-
- DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(3);
- DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub);
-};
-
-class ToStringStub final : public PlatformCodeStub {
+class SubStringStub : public TurboFanCodeStub {
public:
- explicit ToStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
+ explicit SubStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
- DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
- DEFINE_PLATFORM_CODE_STUB(ToString, PlatformCodeStub);
-};
+ static compiler::Node* Generate(CodeStubAssembler* assembler,
+ compiler::Node* string, compiler::Node* from,
+ compiler::Node* to, compiler::Node* context);
-class ToNameStub final : public PlatformCodeStub {
- public:
- explicit ToNameStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
+ void GenerateAssembly(CodeStubAssembler* assembler) const override {
+ assembler->Return(Generate(assembler,
+ assembler->Parameter(Descriptor::kString),
+ assembler->Parameter(Descriptor::kFrom),
+ assembler->Parameter(Descriptor::kTo),
+ assembler->Parameter(Descriptor::kContext)));
+ }
- DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
- DEFINE_PLATFORM_CODE_STUB(ToName, PlatformCodeStub);
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(SubString);
+ DEFINE_CODE_STUB(SubString, TurboFanCodeStub);
};
class ToObjectStub final : public TurboFanCodeStub {
@@ -3231,7 +3138,7 @@ class ToObjectStub final : public TurboFanCodeStub {
#undef DEFINE_CODE_STUB
#undef DEFINE_CODE_STUB_BASE
-extern Representation RepresentationFromType(Type* type);
+extern Representation RepresentationFromMachineType(MachineType type);
} // namespace internal
} // namespace v8