[fullcodegen] Factor out VisitCallRuntime from archs.
This makes the aforementioned visitation function independent of the target architecture by leveraging existing abstractions. R=ishell@chromium.org Review URL: https://codereview.chromium.org/1807943002 Cr-Commit-Position: refs/heads/master@{#34833}
This commit is contained in:
parent
894bc100c3
commit
71ec6ecfff
@ -3375,55 +3375,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
|
||||
context()->DropAndPlug(1, r0);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(r0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3194,54 +3194,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRunTime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
|
||||
context()->DropAndPlug(1, x0);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(x0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1629,6 +1629,49 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
context()->DropAndPlug(1, result_register());
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(result_register());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FullCodeGenerator::VisitSpread(Spread* expr) { UNREACHABLE(); }
|
||||
|
||||
|
@ -3262,54 +3262,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
context()->DropAndPlug(1, eax);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(eax);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3385,55 +3385,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
|
||||
context()->DropAndPlug(1, v0);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(v0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3388,54 +3388,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
|
||||
context()->DropAndPlug(1, v0);
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(v0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3370,55 +3370,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
|
||||
context()->DropAndPlug(1, r3);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(r3);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3276,54 +3276,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
|
||||
context()->DropAndPlug(1, r2);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(r2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
|
||||
|
@ -3250,54 +3250,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
||||
context()->DropAndPlug(1, rax);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(function, arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(rax);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3254,54 +3254,9 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||
__ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
|
||||
RelocInfo::CODE_TARGET);
|
||||
OperandStackDepthDecrement(arg_count + 1);
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
|
||||
if (expr->is_jsruntime()) {
|
||||
Comment cmnt(masm_, "[ CallRuntime");
|
||||
EmitLoadJSRuntimeFunction(expr);
|
||||
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
EmitCallJSRuntimeFunction(expr);
|
||||
|
||||
// Restore context register.
|
||||
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
context()->DropAndPlug(1, eax);
|
||||
|
||||
} else {
|
||||
const Runtime::Function* function = expr->function();
|
||||
switch (function->function_id) {
|
||||
#define CALL_INTRINSIC_GENERATOR(Name) \
|
||||
case Runtime::kInline##Name: { \
|
||||
Comment cmnt(masm_, "[ Inline" #Name); \
|
||||
return Emit##Name(expr); \
|
||||
}
|
||||
FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR)
|
||||
#undef CALL_INTRINSIC_GENERATOR
|
||||
default: {
|
||||
Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic");
|
||||
// Push the arguments ("left-to-right").
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
VisitForStackValue(args->at(i));
|
||||
}
|
||||
|
||||
// Call the C runtime function.
|
||||
PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
|
||||
__ CallRuntime(expr->function(), arg_count);
|
||||
OperandStackDepthDecrement(arg_count);
|
||||
context()->Plug(eax);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore context register.
|
||||
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user