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

Unified Diff: src/hydrogen.cc

Issue 6084003: Implement %_CallFunction in hydrogen. (Closed)
Patch Set: Created 10 years 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/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 86b10363dcab101c1fb86a7a7d4be746a5318a72..9855c877618271f6991654554a9c09574a4b7dd8 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4284,12 +4284,6 @@ void HGraphBuilder::VisitCall(Call* expr) {
Variable* var = expr->expression()->AsVariableProxy()->AsVariable();
bool global_call = (var != NULL) && var->is_global() && !var->is_this();
- if (!global_call) {
- ++argument_count;
Kevin Millikin (Chromium) 2010/12/21 10:38:50 Please don't make this change. I'm currently refa
- VisitArgument(expr->expression());
- CHECK_BAILOUT;
- }
-
if (global_call) {
// If there is a global property cell for the name at compile time and
// access check is not enabled we assume that the function will not change
@@ -4344,8 +4338,12 @@ void HGraphBuilder::VisitCall(Call* expr) {
call = new HCallGlobal(var->name(), argument_count);
}
-
} else {
+ // Non-global call.
+ ++argument_count;
+ VisitArgument(expr->expression());
+ CHECK_BAILOUT;
+
PushAndAdd(new HGlobalReceiver);
VisitArgumentList(expr->arguments());
CHECK_BAILOUT;
@@ -5145,7 +5143,18 @@ void HGraphBuilder::GenerateSwapElements(int argument_count, int ast_id) {
// Fast call for custom callbacks.
void HGraphBuilder::GenerateCallFunction(int argument_count, int ast_id) {
- BAILOUT("inlined runtime function: CallFunction");
+ // BAILOUT("boo");
Lasse Reichstein 2010/12/21 10:19:21 I'll remove this :)
Søren Thygesen Gjesse 2010/12/21 10:25:03 Strange comment.
+ ASSERT(argument_count >= 2);
+ // Move function from top of stack to below arguments.
+ HValue* function = Pop();
+ int argc = argument_count - 1; // Don't count the function itself.
+ SmartPointer<HValue*> arguments(NewArray<HValue*>(argc));
+ for (int i = 0; i < argc; i++) { arguments[i] = Pop(); }
Søren Thygesen Gjesse 2010/12/21 10:25:03 We normally split for statements across three line
+ Push(function);
+ for (int i = argc - 1; i >= 0; i--) { Push(arguments[i]); }
Søren Thygesen Gjesse 2010/12/21 10:25:03 Ditto.
+ HCallFunction* result = new HCallFunction(argument_count);
+ ProcessCall(result);
+ ast_context()->ReturnInstruction(result, ast_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