[crankshaft] Support calling JS runtime functions.
This should recover regression caused by 7f11fba720
(https://codereview.chromium.org/1739233002).
TBR=bmeurer@chromium.org
BUG=chromium:592692, chromium:595265
LOG=N
Review URL: https://codereview.chromium.org/1807913002
Cr-Commit-Position: refs/heads/master@{#34824}
This commit is contained in:
parent
648c2c12ce
commit
80779dc739
@ -266,10 +266,6 @@ void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) {
|
||||
void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
|
||||
IncrementNodeCount();
|
||||
ReserveFeedbackSlots(node);
|
||||
if (node->is_jsruntime()) {
|
||||
// Don't try to optimize JS runtime calls because we bailout on them.
|
||||
DisableCrankshaft(kCallToAJavaScriptRuntimeFunction);
|
||||
}
|
||||
node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
|
||||
VisitArguments(node->arguments());
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ namespace internal {
|
||||
V(kBailoutWasNotPrepared, "Bailout was not prepared") \
|
||||
V(kBothRegistersWereSmisInSelectNonSmi, \
|
||||
"Both registers were smis in SelectNonSmi") \
|
||||
V(kCallToAJavaScriptRuntimeFunction, \
|
||||
"Call to a JavaScript runtime function") \
|
||||
V(kClassLiteral, "Class literal") \
|
||||
V(kCodeGenerationFailed, "Code generation failed") \
|
||||
V(kCodeObjectNotProperlyPatched, "Code object not properly patched") \
|
||||
|
@ -10481,7 +10481,21 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
|
||||
DCHECK(current_block() != NULL);
|
||||
DCHECK(current_block()->HasPredecessor());
|
||||
if (expr->is_jsruntime()) {
|
||||
return Bailout(kCallToAJavaScriptRuntimeFunction);
|
||||
// The callee and the receiver both have to be pushed onto the operand stack
|
||||
// before arguments are being evaluated.
|
||||
HValue* function = AddLoadJSBuiltin(expr->context_index());
|
||||
HValue* receiver = graph()->GetConstantUndefined();
|
||||
Push(function);
|
||||
Push(receiver);
|
||||
|
||||
int argument_count = expr->arguments()->length() + 1; // Count receiver.
|
||||
CHECK_ALIVE(VisitExpressions(expr->arguments()));
|
||||
PushArgumentsFromEnvironment(argument_count);
|
||||
HInstruction* call = NewCallFunction(function, argument_count,
|
||||
ConvertReceiverMode::kNullOrUndefined,
|
||||
TailCallMode::kDisallow);
|
||||
Drop(1); // Function
|
||||
return ast_context()->ReturnInstruction(call, expr->id());
|
||||
}
|
||||
|
||||
const Runtime::Function* function = expr->function();
|
||||
|
Loading…
Reference in New Issue
Block a user