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

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

Issue 598065: Change CallIC interface on ARM. Remove name from the stack, and pass it in r... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/ic-arm.cc » ('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 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 DropAndApply(1, context_, r0); 1083 DropAndApply(1, context_, r0);
1084 } else { 1084 } else {
1085 VisitForValue(expr->key(), kStack); 1085 VisitForValue(expr->key(), kStack);
1086 EmitKeyedPropertyLoad(expr); 1086 EmitKeyedPropertyLoad(expr);
1087 // Drop key and receiver left on the stack by IC. 1087 // Drop key and receiver left on the stack by IC.
1088 DropAndApply(2, context_, r0); 1088 DropAndApply(2, context_, r0);
1089 } 1089 }
1090 } 1090 }
1091 1091
1092 void FullCodeGenerator::EmitCallWithIC(Call* expr, 1092 void FullCodeGenerator::EmitCallWithIC(Call* expr,
1093 Handle<Object> ignored, 1093 Handle<Object> name,
1094 RelocInfo::Mode mode) { 1094 RelocInfo::Mode mode) {
1095 // Code common for calls using the IC. 1095 // Code common for calls using the IC.
1096 ZoneList<Expression*>* args = expr->arguments(); 1096 ZoneList<Expression*>* args = expr->arguments();
1097 int arg_count = args->length(); 1097 int arg_count = args->length();
1098 for (int i = 0; i < arg_count; i++) { 1098 for (int i = 0; i < arg_count; i++) {
1099 VisitForValue(args->at(i), kStack); 1099 VisitForValue(args->at(i), kStack);
1100 } 1100 }
1101 __ mov(r2, Operand(name));
1101 // Record source position for debugger. 1102 // Record source position for debugger.
1102 SetSourcePosition(expr->position()); 1103 SetSourcePosition(expr->position());
1103 // Call the IC initialization code. 1104 // Call the IC initialization code.
1104 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, 1105 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1105 NOT_IN_LOOP); 1106 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop);
1106 __ Call(ic, mode); 1107 __ Call(ic, mode);
1107 // Restore context register. 1108 // Restore context register.
1108 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1109 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1109 // Discard the function left on TOS. 1110 Apply(context_, r0);
1110 DropAndApply(1, context_, r0);
1111 } 1111 }
1112 1112
1113 1113
1114 void FullCodeGenerator::EmitCallWithStub(Call* expr) { 1114 void FullCodeGenerator::EmitCallWithStub(Call* expr) {
1115 // Code common for calls using the call stub. 1115 // Code common for calls using the call stub.
1116 ZoneList<Expression*>* args = expr->arguments(); 1116 ZoneList<Expression*>* args = expr->arguments();
1117 int arg_count = args->length(); 1117 int arg_count = args->length();
1118 for (int i = 0; i < arg_count; i++) { 1118 for (int i = 0; i < arg_count; i++) {
1119 VisitForValue(args->at(i), kStack); 1119 VisitForValue(args->at(i), kStack);
1120 } 1120 }
1121 // Record source position for debugger. 1121 // Record source position for debugger.
1122 SetSourcePosition(expr->position()); 1122 SetSourcePosition(expr->position());
1123 CallFunctionStub stub(arg_count, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE); 1123 CallFunctionStub stub(arg_count, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE);
1124 __ CallStub(&stub); 1124 __ CallStub(&stub);
1125 // Restore context register. 1125 // Restore context register.
1126 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1126 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1127 // Discard the function left on TOS.
1128 DropAndApply(1, context_, r0); 1127 DropAndApply(1, context_, r0);
1129 } 1128 }
1130 1129
1131 1130
1132 void FullCodeGenerator::VisitCall(Call* expr) { 1131 void FullCodeGenerator::VisitCall(Call* expr) {
1133 Comment cmnt(masm_, "[ Call"); 1132 Comment cmnt(masm_, "[ Call");
1134 Expression* fun = expr->expression(); 1133 Expression* fun = expr->expression();
1135 Variable* var = fun->AsVariableProxy()->AsVariable(); 1134 Variable* var = fun->AsVariableProxy()->AsVariable();
1136 1135
1137 if (var != NULL && var->is_possibly_eval()) { 1136 if (var != NULL && var->is_possibly_eval()) {
1138 // Call to the identifier 'eval'. 1137 // Call to the identifier 'eval'.
1139 UNREACHABLE(); 1138 UNREACHABLE();
1140 } else if (var != NULL && !var->is_this() && var->is_global()) { 1139 } else if (var != NULL && !var->is_this() && var->is_global()) {
1141 // Call to a global variable. 1140 // Push global object as receiver for the call IC.
1142 __ mov(r1, Operand(var->name()));
1143 // Push global object as receiver for the call IC lookup.
1144 __ ldr(r0, CodeGenerator::GlobalObject()); 1141 __ ldr(r0, CodeGenerator::GlobalObject());
1145 __ stm(db_w, sp, r1.bit() | r0.bit()); 1142 __ push(r0);
1146 EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT); 1143 EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT);
1147 } else if (var != NULL && var->slot() != NULL && 1144 } else if (var != NULL && var->slot() != NULL &&
1148 var->slot()->type() == Slot::LOOKUP) { 1145 var->slot()->type() == Slot::LOOKUP) {
1149 // Call to a lookup slot. 1146 // Call to a lookup slot.
1150 UNREACHABLE(); 1147 UNREACHABLE();
1151 } else if (fun->AsProperty() != NULL) { 1148 } else if (fun->AsProperty() != NULL) {
1152 // Call to an object property. 1149 // Call to an object property.
1153 Property* prop = fun->AsProperty(); 1150 Property* prop = fun->AsProperty();
1154 Literal* key = prop->key()->AsLiteral(); 1151 Literal* key = prop->key()->AsLiteral();
1155 if (key != NULL && key->handle()->IsSymbol()) { 1152 if (key != NULL && key->handle()->IsSymbol()) {
1156 // Call to a named property, use call IC. 1153 // Call to a named property, use call IC.
1157 __ mov(r0, Operand(key->handle()));
1158 __ push(r0);
1159 VisitForValue(prop->obj(), kStack); 1154 VisitForValue(prop->obj(), kStack);
1160 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); 1155 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET);
1161 } else { 1156 } else {
1162 // Call to a keyed property, use keyed load IC followed by function 1157 // Call to a keyed property, use keyed load IC followed by function
1163 // call. 1158 // call.
1164 VisitForValue(prop->obj(), kStack); 1159 VisitForValue(prop->obj(), kStack);
1165 VisitForValue(prop->key(), kStack); 1160 VisitForValue(prop->key(), kStack);
1166 // Record source code position for IC call. 1161 // Record source code position for IC call.
1167 SetSourcePosition(prop->position()); 1162 SetSourcePosition(prop->position());
1168 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1163 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 DropAndApply(1, context_, r0); 1229 DropAndApply(1, context_, r0);
1235 } 1230 }
1236 1231
1237 1232
1238 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 1233 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
1239 Comment cmnt(masm_, "[ CallRuntime"); 1234 Comment cmnt(masm_, "[ CallRuntime");
1240 ZoneList<Expression*>* args = expr->arguments(); 1235 ZoneList<Expression*>* args = expr->arguments();
1241 1236
1242 if (expr->is_jsruntime()) { 1237 if (expr->is_jsruntime()) {
1243 // Prepare for calling JS runtime function. 1238 // Prepare for calling JS runtime function.
1244 __ mov(r1, Operand(expr->name()));
1245 __ ldr(r0, CodeGenerator::GlobalObject()); 1239 __ ldr(r0, CodeGenerator::GlobalObject());
1246 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kBuiltinsOffset)); 1240 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kBuiltinsOffset));
1247 __ stm(db_w, sp, r1.bit() | r0.bit()); 1241 __ push(r0);
1248 } 1242 }
1249 1243
1250 // Push the arguments ("left-to-right"). 1244 // Push the arguments ("left-to-right").
1251 int arg_count = args->length(); 1245 int arg_count = args->length();
1252 for (int i = 0; i < arg_count; i++) { 1246 for (int i = 0; i < arg_count; i++) {
1253 VisitForValue(args->at(i), kStack); 1247 VisitForValue(args->at(i), kStack);
1254 } 1248 }
1255 1249
1256 if (expr->is_jsruntime()) { 1250 if (expr->is_jsruntime()) {
1257 // Call the JS runtime function. 1251 // Call the JS runtime function.
1252 __ mov(r2, Operand(expr->name()));
1258 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, 1253 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count,
1259 NOT_IN_LOOP); 1254 NOT_IN_LOOP);
1260 __ Call(ic, RelocInfo::CODE_TARGET); 1255 __ Call(ic, RelocInfo::CODE_TARGET);
1261 // Restore context register. 1256 // Restore context register.
1262 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1257 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1263 // Discard the function left on TOS.
1264 DropAndApply(1, context_, r0);
1265 } else { 1258 } else {
1266 // Call the C runtime function. 1259 // Call the C runtime function.
1267 __ CallRuntime(expr->function(), arg_count); 1260 __ CallRuntime(expr->function(), arg_count);
1268 Apply(context_, r0);
1269 } 1261 }
1262 Apply(context_, r0);
1270 } 1263 }
1271 1264
1272 1265
1273 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { 1266 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
1274 switch (expr->op()) { 1267 switch (expr->op()) {
1275 case Token::VOID: { 1268 case Token::VOID: {
1276 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); 1269 Comment cmnt(masm_, "[ UnaryOperation (VOID)");
1277 VisitForEffect(expr->expression()); 1270 VisitForEffect(expr->expression());
1278 switch (context_) { 1271 switch (context_) {
1279 case Expression::kUninitialized: 1272 case Expression::kUninitialized:
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 __ pop(result_register()); 1770 __ pop(result_register());
1778 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); 1771 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize);
1779 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 1772 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
1780 __ add(pc, r1, Operand(masm_->CodeObject())); 1773 __ add(pc, r1, Operand(masm_->CodeObject()));
1781 } 1774 }
1782 1775
1783 1776
1784 #undef __ 1777 #undef __
1785 1778
1786 } } // namespace v8::internal 1779 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698