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

Side by Side Diff: src/arm/fast-codegen-arm.cc

Issue 437081: Added fast compiler support for calling JS runtime functions.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ast.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); 1248 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
1249 1249
1250 // Replace function on TOS with result in r0, or pop it. 1250 // Replace function on TOS with result in r0, or pop it.
1251 DropAndMove(expr->context(), r0); 1251 DropAndMove(expr->context(), r0);
1252 } 1252 }
1253 1253
1254 1254
1255 void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 1255 void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
1256 Comment cmnt(masm_, "[ CallRuntime"); 1256 Comment cmnt(masm_, "[ CallRuntime");
1257 ZoneList<Expression*>* args = expr->arguments(); 1257 ZoneList<Expression*>* args = expr->arguments();
1258 Runtime::Function* function = expr->function();
1259 1258
1260 ASSERT(function != NULL); 1259 if (expr->is_jsruntime()) {
1260 // Prepare for calling JS runtime function.
1261 __ mov(r1, Operand(expr->name()));
1262 __ ldr(r0, CodeGenerator::GlobalObject());
1263 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kBuiltinsOffset));
1264 __ stm(db_w, sp, r1.bit() | r0.bit());
1265 }
1261 1266
1262 // Push the arguments ("left-to-right"). 1267 // Push the arguments ("left-to-right").
1263 int arg_count = args->length(); 1268 int arg_count = args->length();
1264 for (int i = 0; i < arg_count; i++) { 1269 for (int i = 0; i < arg_count; i++) {
1265 Visit(args->at(i)); 1270 Visit(args->at(i));
1266 ASSERT_EQ(Expression::kValue, args->at(i)->context()); 1271 ASSERT_EQ(Expression::kValue, args->at(i)->context());
1267 } 1272 }
1268 1273
1269 __ CallRuntime(function, arg_count); 1274 if (expr->is_jsruntime()) {
1270 Move(expr->context(), r0); 1275 // Call the JS runtime function.
1276 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count,
1277 NOT_IN_LOOP);
1278 __ Call(ic, RelocInfo::CODE_TARGET);
1279 // Restore context register.
1280 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1281 // Discard the function left on TOS.
1282 DropAndMove(expr->context(), r0);
1283 } else {
1284 // Call the C runtime function.
1285 __ CallRuntime(expr->function(), arg_count);
1286 Move(expr->context(), r0);
1287 }
1271 } 1288 }
1272 1289
1273 1290
1274 void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { 1291 void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1275 switch (expr->op()) { 1292 switch (expr->op()) {
1276 case Token::VOID: { 1293 case Token::VOID: {
1277 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); 1294 Comment cmnt(masm_, "[ UnaryOperation (VOID)");
1278 Visit(expr->expression()); 1295 Visit(expr->expression());
1279 ASSERT_EQ(Expression::kEffect, expr->expression()->context()); 1296 ASSERT_EQ(Expression::kEffect, expr->expression()->context());
1280 switch (expr->context()) { 1297 switch (expr->context()) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 true_label_ = saved_true; 1703 true_label_ = saved_true;
1687 false_label_ = saved_false; 1704 false_label_ = saved_false;
1688 // Convert current context to test context: End post-test code. 1705 // Convert current context to test context: End post-test code.
1689 } 1706 }
1690 1707
1691 1708
1692 #undef __ 1709 #undef __
1693 1710
1694 1711
1695 } } // namespace v8::internal 1712 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698