From: bmeurer@chromium.org Date: Fri, 19 Jul 2013 09:42:15 +0000 (+0000) Subject: Consistently use HStringAdd instead of HCallStub with CodeStub::StringAdd. X-Git-Tag: upstream/4.7.83~13294 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d750a6dcd86563ab06a136fb417623c41bf9b487;p=platform%2Fupstream%2Fv8.git Consistently use HStringAdd instead of HCallStub with CodeStub::StringAdd. Previously there were two ways to actually use the StringAddStub from Hydrogen: - Either using HStringAdd (which implied NO_STRING_CHECK_IN_STUB and and does the argument handling internally), - or using HCallStub with CodeStub::StringAdd (which implied NO_STRING_ADD_FLAGS and expected the arguments to be on the stack already). R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/19541003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15771 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 9900a1e..d46de82 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -1041,11 +1041,6 @@ void LCodeGen::DoCallStub(LCallStub* instr) { CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); break; } - case CodeStub::StringAdd: { - StringAddStub stub(NO_STRING_ADD_FLAGS); - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); - break; - } case CodeStub::StringCompare: { StringCompareStub stub; CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); @@ -4539,7 +4534,7 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { void LCodeGen::DoStringAdd(LStringAdd* instr) { __ push(ToRegister(instr->left())); __ push(ToRegister(instr->right())); - StringAddStub stub(NO_STRING_CHECK_IN_STUB); + StringAddStub stub(instr->hydrogen()->flags()); CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); } diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 16f502d..bd7beec 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -3451,8 +3451,11 @@ DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR -HInstruction* HStringAdd::New( - Zone* zone, HValue* context, HValue* left, HValue* right) { +HInstruction* HStringAdd::New(Zone* zone, + HValue* context, + HValue* left, + HValue* right, + StringAddFlags flags) { if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { HConstant* c_right = HConstant::cast(right); HConstant* c_left = HConstant::cast(left); @@ -3462,7 +3465,7 @@ HInstruction* HStringAdd::New( return new(zone) HConstant(concat, Representation::Tagged()); } } - return new(zone) HStringAdd(context, left, right); + return new(zone) HStringAdd(context, left, right, flags); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index a006c44..6ab02dc 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -6181,7 +6181,10 @@ class HStringAdd: public HBinaryOperation { static HInstruction* New(Zone* zone, HValue* context, HValue* left, - HValue* right); + HValue* right, + StringAddFlags flags = NO_STRING_CHECK_IN_STUB); + + StringAddFlags flags() const { return flags_; } virtual Representation RequiredInputRepresentation(int index) { return Representation::Tagged(); @@ -6196,10 +6199,9 @@ class HStringAdd: public HBinaryOperation { protected: virtual bool DataEquals(HValue* other) { return true; } - private: - HStringAdd(HValue* context, HValue* left, HValue* right) - : HBinaryOperation(context, left, right) { + HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) + : HBinaryOperation(context, left, right), flags_(flags) { set_representation(Representation::Tagged()); SetFlag(kUseGVN); SetGVNFlag(kDependsOnMaps); @@ -6208,6 +6210,8 @@ class HStringAdd: public HBinaryOperation { // TODO(svenpanne) Might be safe, but leave it out until we know for sure. // virtual bool IsDeletable() const { return true; } + + const StringAddFlags flags_; }; diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 53847b6..2802773 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -9077,10 +9077,13 @@ void HOptimizedGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) { // Fast support for StringAdd. void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { ASSERT_EQ(2, call->arguments()->length()); - CHECK_ALIVE(VisitArgumentList(call->arguments())); + CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); + CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); + HValue* right = Pop(); + HValue* left = Pop(); HValue* context = environment()->LookupContext(); - HCallStub* result = new(zone()) HCallStub(context, CodeStub::StringAdd, 2); - Drop(2); + HInstruction* result = HStringAdd::New( + zone(), context, left, right, NO_STRING_ADD_FLAGS); return ast_context()->ReturnInstruction(result, call->id()); } diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 54fb187..77d166f 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -1222,11 +1222,6 @@ void LCodeGen::DoCallStub(LCallStub* instr) { CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); break; } - case CodeStub::StringAdd: { - StringAddStub stub(NO_STRING_ADD_FLAGS); - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); - break; - } case CodeStub::StringCompare: { StringCompareStub stub; CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); @@ -4873,7 +4868,7 @@ void LCodeGen::DoStringLength(LStringLength* instr) { void LCodeGen::DoStringAdd(LStringAdd* instr) { EmitPushTaggedOperand(instr->left()); EmitPushTaggedOperand(instr->right()); - StringAddStub stub(NO_STRING_CHECK_IN_STUB); + StringAddStub stub(instr->hydrogen()->flags()); CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); } diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 2ee70ff..f162664 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -1024,11 +1024,6 @@ void LCodeGen::DoCallStub(LCallStub* instr) { CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); break; } - case CodeStub::StringAdd: { - StringAddStub stub(NO_STRING_ADD_FLAGS); - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); - break; - } case CodeStub::StringCompare: { StringCompareStub stub; CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); @@ -4478,7 +4473,7 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { void LCodeGen::DoStringAdd(LStringAdd* instr) { __ push(ToRegister(instr->left())); __ push(ToRegister(instr->right())); - StringAddStub stub(NO_STRING_CHECK_IN_STUB); + StringAddStub stub(instr->hydrogen()->flags()); CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); } diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index e52dfff..5186ce0 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -921,11 +921,6 @@ void LCodeGen::DoCallStub(LCallStub* instr) { CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); break; } - case CodeStub::StringAdd: { - StringAddStub stub(NO_STRING_ADD_FLAGS); - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); - break; - } case CodeStub::StringCompare: { StringCompareStub stub; CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); @@ -4324,7 +4319,7 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { void LCodeGen::DoStringAdd(LStringAdd* instr) { EmitPushTaggedOperand(instr->left()); EmitPushTaggedOperand(instr->right()); - StringAddStub stub(NO_STRING_CHECK_IN_STUB); + StringAddStub stub(instr->hydrogen()->flags()); CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); }