Commit 04afb10f authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

Migrate StringLengthStub to TF builtin

Bug: 
Change-Id: I58ce9a0f42dfa81c8e8affa2377c5cc0d08a35e2
Reviewed-on: https://chromium-review.googlesource.com/691714
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48222}
parent 0a346fc2
...@@ -213,6 +213,7 @@ namespace internal { ...@@ -213,6 +213,7 @@ namespace internal {
ASM(LoadIC_Getter_ForDeopt) \ ASM(LoadIC_Getter_ForDeopt) \
TFH(LoadIC_Miss, LoadWithVector) \ TFH(LoadIC_Miss, LoadWithVector) \
TFH(LoadIC_Slow, LoadWithVector) \ TFH(LoadIC_Slow, LoadWithVector) \
TFH(LoadIC_StringLength, LoadWithVector) \
TFH(LoadIC_Uninitialized, LoadWithVector) \ TFH(LoadIC_Uninitialized, LoadWithVector) \
TFH(StoreIC_Miss, StoreWithVector) \ TFH(StoreIC_Miss, StoreWithVector) \
ASM(StoreIC_Setter_ForDeopt) \ ASM(StoreIC_Setter_ForDeopt) \
......
...@@ -13,6 +13,13 @@ ...@@ -13,6 +13,13 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
TF_BUILTIN(LoadIC_StringLength, CodeStubAssembler) {
Node* value = Parameter(Descriptor::kReceiver);
Node* string = LoadJSValueValue(value);
Node* result = LoadStringLength(string);
Return(result);
}
TF_BUILTIN(KeyedLoadIC_IndexedString, CodeStubAssembler) { TF_BUILTIN(KeyedLoadIC_IndexedString, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* index = Parameter(Descriptor::kName); Node* index = Parameter(Descriptor::kName);
......
...@@ -339,14 +339,6 @@ TF_STUB(ElementsTransitionAndStoreStub, CodeStubAssembler) { ...@@ -339,14 +339,6 @@ TF_STUB(ElementsTransitionAndStoreStub, CodeStubAssembler) {
} }
} }
// TODO(ishell): move to builtins-handler-gen.
TF_STUB(StringLengthStub, CodeStubAssembler) {
Node* value = Parameter(Descriptor::kReceiver);
Node* string = LoadJSValueValue(value);
Node* result = LoadStringLength(string);
Return(result);
}
TF_STUB(TransitionElementsKindStub, CodeStubAssembler) { TF_STUB(TransitionElementsKindStub, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
......
...@@ -47,7 +47,6 @@ class Node; ...@@ -47,7 +47,6 @@ class Node;
V(ArrayNoArgumentConstructor) \ V(ArrayNoArgumentConstructor) \
V(ArraySingleArgumentConstructor) \ V(ArraySingleArgumentConstructor) \
V(ArrayNArgumentsConstructor) \ V(ArrayNArgumentsConstructor) \
V(StringLength) \
V(InternalArrayNoArgumentConstructor) \ V(InternalArrayNoArgumentConstructor) \
V(InternalArraySingleArgumentConstructor) \ V(InternalArraySingleArgumentConstructor) \
V(ElementsTransitionAndStore) \ V(ElementsTransitionAndStore) \
...@@ -462,14 +461,6 @@ class TurboFanCodeStub : public CodeStub { ...@@ -462,14 +461,6 @@ class TurboFanCodeStub : public CodeStub {
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class StringLengthStub : public TurboFanCodeStub {
public:
explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub);
};
class StoreInterceptorStub : public TurboFanCodeStub { class StoreInterceptorStub : public TurboFanCodeStub {
public: public:
explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
......
...@@ -867,7 +867,7 @@ class RuntimeCallTimer final { ...@@ -867,7 +867,7 @@ class RuntimeCallTimer final {
V(LoadIC_NonReceiver) \ V(LoadIC_NonReceiver) \
V(LoadIC_Premonomorphic) \ V(LoadIC_Premonomorphic) \
V(LoadIC_SlowStub) \ V(LoadIC_SlowStub) \
V(LoadIC_StringLengthStub) \ V(LoadIC_StringLength) \
V(StoreIC_HandlerCacheHit_Accessor) \ V(StoreIC_HandlerCacheHit_Accessor) \
V(StoreIC_NonReceiver) \ V(StoreIC_NonReceiver) \
V(StoreIC_Premonomorphic) \ V(StoreIC_Premonomorphic) \
......
...@@ -719,9 +719,8 @@ Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) { ...@@ -719,9 +719,8 @@ Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) {
if (receiver->IsStringWrapper() && if (receiver->IsStringWrapper() &&
*lookup->name() == isolate()->heap()->length_string()) { *lookup->name() == isolate()->heap()->length_string()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_StringLengthStub); TRACE_HANDLER_STATS(isolate(), LoadIC_StringLength);
StringLengthStub string_length_stub(isolate()); return BUILTIN_CODE(isolate(), LoadIC_StringLength);
return string_length_stub.GetCode();
} }
// Use specialized code for getting prototype of functions. // Use specialized code for getting prototype of functions.
......
...@@ -108,8 +108,7 @@ TEST(RunStringLengthStub) { ...@@ -108,8 +108,7 @@ TEST(RunStringLengthStub) {
Isolate* isolate = scope.main_isolate(); Isolate* isolate = scope.main_isolate();
Zone* zone = scope.main_zone(); Zone* zone = scope.main_zone();
StringLengthStub stub(isolate); StubTester tester(isolate, zone, Builtins::kLoadIC_StringLength);
StubTester tester(isolate, zone, &stub);
// Actuall call through to the stub, verifying its result. // Actuall call through to the stub, verifying its result.
const char* testString = "Und das Lamm schrie HURZ!"; const char* testString = "Und das Lamm schrie HURZ!";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment