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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1306993003: Call JS functions via native context instead of js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: separated context slot lookup Created 5 years, 4 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
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 11dc456e3dba721637e06a9283906a6db530255c..0fb0e7e5f52c1e2597447c27cd76a73d4df03b57 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2538,20 +2538,18 @@ void AstGraphBuilder::VisitCallNew(CallNew* expr) {
void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
- Handle<String> name = expr->name();
-
// The callee and the receiver both have to be pushed onto the operand stack
// before arguments are being evaluated.
CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS;
- Node* receiver_value = BuildLoadBuiltinsObject();
- VectorSlotPair pair = CreateVectorSlotPair(expr->CallRuntimeFeedbackSlot());
- // TODO(jarin): bailout ids for runtime calls.
- FrameStateBeforeAndAfter states(this, BailoutId::None());
- Node* callee_value = BuildNamedLoad(receiver_value, name, pair);
- states.AddToNode(callee_value, BailoutId::None(),
- OutputFrameStateCombine::Push());
+ Node* global = BuildLoadGlobalObject();
+ Node* native_context =
+ BuildLoadObjectField(global, GlobalObject::kNativeContextOffset);
+ Node* callee_value =
+ NewNode(javascript()->LoadContext(0, expr->context_index(), true),
+ native_context);
+
environment()->Push(callee_value);
- environment()->Push(receiver_value);
+ environment()->Push(jsgraph()->UndefinedConstant());
Michael Starzinger 2015/08/26 09:43:21 nit: Let's add a trailing "// receiver" comment, o
Yang 2015/08/26 10:27:30 Done.
// Evaluate all arguments to the JS runtime call.
ZoneList<Expression*>* args = expr->arguments();
@@ -2567,15 +2565,14 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
- const Runtime::Function* function = expr->function();
-
// Handle calls to runtime functions implemented in JavaScript separately as
// the call follows JavaScript ABI and the callee is statically unknown.
if (expr->is_jsruntime()) {
- DCHECK(function == NULL && expr->name()->length() > 0);
return VisitCallJSRuntime(expr);
}
+ const Runtime::Function* function = expr->function();
+
// TODO(mstarzinger): This bailout is a gigantic hack, the owner is ashamed.
if (function->function_id == Runtime::kInlineGeneratorNext ||
function->function_id == Runtime::kInlineGeneratorThrow) {

Powered by Google App Engine
This is Rietveld 408576698