Commit 33f6db6a authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Add initial hydrogenized NewStringAddStub.

Port r17635 (14180b1)

Original commit message:
The new stub is enabled via the --new-string-add flag, which is
disabled by default. For now, it's only a stripped down version
of the native StringAddStub, it's still work-in-progress.

BUG=v8:2990
R=plind44@gmail.com

Review URL: https://codereview.chromium.org/69953005

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17664 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 41db9af6
......@@ -291,6 +291,17 @@ void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
}
void NewStringAddStub::InitializeInterfaceDescriptor(
Isolate* isolate,
CodeStubInterfaceDescriptor* descriptor) {
static Register registers[] = { a1, a0 };
descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ =
Runtime::FunctionForId(Runtime::kStringAdd)->entry;
}
#define __ ACCESS_MASM(masm)
......
......@@ -3740,11 +3740,20 @@ void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) {
void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
ASSERT_EQ(2, args->length());
VisitForStackValue(args->at(0));
VisitForStackValue(args->at(1));
if (FLAG_new_string_add) {
VisitForStackValue(args->at(0));
VisitForAccumulatorValue(args->at(1));
StringAddStub stub(STRING_ADD_CHECK_BOTH);
__ CallStub(&stub);
__ pop(a1);
NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
__ CallStub(&stub);
} else {
VisitForStackValue(args->at(0));
VisitForStackValue(args->at(1));
StringAddStub stub(STRING_ADD_CHECK_BOTH);
__ CallStub(&stub);
}
context()->Plug(v0);
}
......
......@@ -4480,10 +4480,18 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
void LCodeGen::DoStringAdd(LStringAdd* instr) {
ASSERT(ToRegister(instr->context()).is(cp));
__ push(ToRegister(instr->left()));
__ push(ToRegister(instr->right()));
StringAddStub stub(instr->hydrogen()->flags());
CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
if (FLAG_new_string_add) {
ASSERT(ToRegister(instr->left()).is(a1));
ASSERT(ToRegister(instr->right()).is(a0));
NewStringAddStub stub(instr->hydrogen()->flags(),
isolate()->heap()->GetPretenureMode());
CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
} else {
__ push(ToRegister(instr->left()));
__ push(ToRegister(instr->right()));
StringAddStub stub(instr->hydrogen()->flags());
CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
}
}
......
......@@ -2335,8 +2335,12 @@ LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
LOperand* context = UseFixed(instr->context(), cp);
LOperand* left = UseRegisterAtStart(instr->left());
LOperand* right = UseRegisterAtStart(instr->right());
LOperand* left = FLAG_new_string_add
? UseFixed(instr->left(), a1)
: UseRegisterAtStart(instr->left());
LOperand* right = FLAG_new_string_add
? UseFixed(instr->right(), a0)
: UseRegisterAtStart(instr->right());
return MarkAsCall(
DefineFixed(new(zone()) LStringAdd(context, left, right), v0),
instr);
......
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