Commit 812bcd44 authored by bmeurer's avatar bmeurer Committed by Commit bot

[fullcodegen] Add support for %_GetSuperConstructor.

Since the parser now desugars super constructor calls to simple
primitives, we can also easily optimize those in fullcodegen w/
just a few simple lines of native code per architecture.  This
code in particular should be fast, so it seems worth the code
in fullcodegen.

BUG=v8:3330
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#32823}
parent 17bbadbe
...@@ -3742,6 +3742,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3742,6 +3742,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(r0);
__ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset));
__ ldr(r0, FieldMemOperand(r0, Map::kPrototypeOffset));
context()->Plug(r0);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, done, one_char_separator, long_separator, non_trivial_array, Label bailout, done, one_char_separator, long_separator, non_trivial_array,
not_size_one_array, loop, empty_separator_loop, one_char_separator_loop, not_size_one_array, loop, empty_separator_loop, one_char_separator_loop,
......
...@@ -3454,6 +3454,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3454,6 +3454,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(x0);
__ Ldr(x0, FieldMemOperand(x0, HeapObject::kMapOffset));
__ Ldr(x0, FieldMemOperand(x0, Map::kPrototypeOffset));
context()->Plug(x0);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
ASM_LOCATION("FullCodeGenerator::EmitFastOneByteArrayJoin"); ASM_LOCATION("FullCodeGenerator::EmitFastOneByteArrayJoin");
......
...@@ -495,6 +495,7 @@ class FullCodeGenerator: public AstVisitor { ...@@ -495,6 +495,7 @@ class FullCodeGenerator: public AstVisitor {
F(IsMinusZero) \ F(IsMinusZero) \
F(HasCachedArrayIndex) \ F(HasCachedArrayIndex) \
F(GetCachedArrayIndex) \ F(GetCachedArrayIndex) \
F(GetSuperConstructor) \
F(FastOneByteArrayJoin) \ F(FastOneByteArrayJoin) \
F(GeneratorNext) \ F(GeneratorNext) \
F(GeneratorThrow) \ F(GeneratorThrow) \
......
...@@ -3635,6 +3635,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3635,6 +3635,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(eax);
__ mov(eax, FieldOperand(eax, HeapObject::kMapOffset));
__ mov(eax, FieldOperand(eax, Map::kPrototypeOffset));
context()->Plug(eax);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, done, one_char_separator, long_separator, Label bailout, done, one_char_separator, long_separator,
non_trivial_array, not_size_one_array, loop, non_trivial_array, not_size_one_array, loop,
......
...@@ -3751,6 +3751,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3751,6 +3751,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(v0);
__ lw(v0, FieldMemOperand(v0, HeapObject::kMapOffset));
__ lw(v0, FieldMemOperand(v0, Map::kPrototypeOffset));
context()->Plug(v0);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, done, one_char_separator, long_separator, Label bailout, done, one_char_separator, long_separator,
non_trivial_array, not_size_one_array, loop, non_trivial_array, not_size_one_array, loop,
......
...@@ -3758,6 +3758,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3758,6 +3758,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(v0);
__ ld(v0, FieldMemOperand(v0, HeapObject::kMapOffset));
__ ld(v0, FieldMemOperand(v0, Map::kPrototypeOffset));
context()->Plug(v0);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, done, one_char_separator, long_separator, Label bailout, done, one_char_separator, long_separator,
non_trivial_array, not_size_one_array, loop, non_trivial_array, not_size_one_array, loop,
......
...@@ -3734,6 +3734,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3734,6 +3734,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(r3);
__ ld(r3, FieldMemOperand(r3, HeapObject::kMapOffset));
__ ld(r3, FieldMemOperand(r3, Map::kPrototypeOffset));
context()->Plug(r3);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, done, one_char_separator, long_separator, non_trivial_array, Label bailout, done, one_char_separator, long_separator, non_trivial_array,
not_size_one_array, loop, empty_separator_loop, one_char_separator_loop, not_size_one_array, loop, empty_separator_loop, one_char_separator_loop,
......
...@@ -3626,6 +3626,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3626,6 +3626,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(rax);
__ movp(rax, FieldOperand(rax, HeapObject::kMapOffset));
__ movp(rax, FieldOperand(rax, Map::kPrototypeOffset));
context()->Plug(rax);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, return_result, done, one_char_separator, long_separator, Label bailout, return_result, done, one_char_separator, long_separator,
non_trivial_array, not_size_one_array, loop, non_trivial_array, not_size_one_array, loop,
......
...@@ -3628,6 +3628,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { ...@@ -3628,6 +3628,17 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
} }
void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
VisitForAccumulatorValue(args->at(0));
__ AssertFunction(eax);
__ mov(eax, FieldOperand(eax, HeapObject::kMapOffset));
__ mov(eax, FieldOperand(eax, Map::kPrototypeOffset));
context()->Plug(eax);
}
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) { void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, done, one_char_separator, long_separator, Label bailout, done, one_char_separator, long_separator,
non_trivial_array, not_size_one_array, loop, non_trivial_array, not_size_one_array, loop,
......
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