Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1807003002: [crankshaft] Specialize JS runtime calls to the native context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 0a4b4f99a25fa368ca387677dbcc64dbbbd57032..e64b121930e58ca1513f5d172dc77f867882c339 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -10481,19 +10481,26 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
DCHECK(current_block() != NULL);
DCHECK(current_block()->HasPredecessor());
if (expr->is_jsruntime()) {
+ // Crankshaft always specializes to the native context, so we can just grab
+ // the constant function from the current native context and embed that into
+ // the code object.
+ Handle<JSFunction> known_function(
+ JSFunction::cast(
+ current_info()->native_context()->get(expr->context_index())),
+ isolate());
+
// 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();
+ HConstant* function = Add<HConstant>(known_function);
+ HValue* receiver = ImplicitReceiverFor(function, known_function);
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);
+ HInstruction* call = NewCallConstantFunction(known_function, argument_count,
+ TailCallMode::kDisallow);
Drop(1); // Function
return ast_context()->ReturnInstruction(call, expr->id());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698