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

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

Issue 9320: Semi-weekly merge from bleeding_edge to the toiger branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years, 1 month 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/codegen.cc ('k') | src/codegen-ia32.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 SwitchStatement* node, 1240 SwitchStatement* node,
1241 int min_index, 1241 int min_index,
1242 int range, 1242 int range,
1243 Label* fail_label, 1243 Label* fail_label,
1244 Vector<Label*> case_targets, 1244 Vector<Label*> case_targets,
1245 Vector<Label> case_labels) { 1245 Vector<Label> case_labels) {
1246 1246
1247 ASSERT(kSmiTag == 0 && kSmiTagSize <= 2); 1247 ASSERT(kSmiTag == 0 && kSmiTagSize <= 2);
1248 1248
1249 __ pop(r0); 1249 __ pop(r0);
1250
1251 // Test for a Smi value in a HeapNumber.
1252 Label is_smi;
1253 __ tst(r0, Operand(kSmiTagMask));
1254 __ b(eq, &is_smi);
1255 __ ldr(r1, MemOperand(r0, HeapObject::kMapOffset - kHeapObjectTag));
1256 __ ldrb(r1, MemOperand(r1, Map::kInstanceTypeOffset - kHeapObjectTag));
1257 __ cmp(r1, Operand(HEAP_NUMBER_TYPE));
1258 __ b(ne, fail_label);
1259 __ push(r0);
1260 __ CallRuntime(Runtime::kNumberToSmi, 1);
1261 __ bind(&is_smi);
1262
1250 if (min_index != 0) { 1263 if (min_index != 0) {
1251 // small positive numbers can be immediate operands. 1264 // Small positive numbers can be immediate operands.
1252 if (min_index < 0) { 1265 if (min_index < 0) {
1253 __ add(r0, r0, Operand(Smi::FromInt(-min_index))); 1266 // If min_index is Smi::kMinValue, -min_index is not a Smi.
1267 if (Smi::IsValid(-min_index)) {
1268 __ add(r0, r0, Operand(Smi::FromInt(-min_index)));
1269 } else {
1270 __ add(r0, r0, Operand(Smi::FromInt(-min_index - 1)));
1271 __ add(r0, r0, Operand(Smi::FromInt(1)));
1272 }
1254 } else { 1273 } else {
1255 __ sub(r0, r0, Operand(Smi::FromInt(min_index))); 1274 __ sub(r0, r0, Operand(Smi::FromInt(min_index)));
1256 } 1275 }
1257 } 1276 }
1258 __ tst(r0, Operand(0x80000000 | kSmiTagMask)); 1277 __ tst(r0, Operand(0x80000000 | kSmiTagMask));
1259 __ b(ne, fail_label); 1278 __ b(ne, fail_label);
1260 __ cmp(r0, Operand(Smi::FromInt(range))); 1279 __ cmp(r0, Operand(Smi::FromInt(range)));
1261 __ b(ge, fail_label); 1280 __ b(ge, fail_label);
1262 __ add(pc, pc, Operand(r0, LSL, 2 - kSmiTagSize)); 1281 __ add(pc, pc, Operand(r0, LSL, 2 - kSmiTagSize));
1263 // One extra instruction offsets the table, so the table's start address is 1282 // One extra instruction offsets the table, so the table's start address is
1264 // the pc-register at the above add. 1283 // the pc-register at the above add.
1265 __ stop("Unreachable: Switch table alignment"); 1284 __ stop("Unreachable: Switch table alignment");
1266 1285
1267 // table containing branch operations. 1286 // Table containing branch operations.
1268 for (int i = 0; i < range; i++) { 1287 for (int i = 0; i < range; i++) {
1269 __ b(case_targets[i]); 1288 __ b(case_targets[i]);
1270 } 1289 }
1271 1290
1272 GenerateFastCaseSwitchCases(node, case_labels); 1291 GenerateFastCaseSwitchCases(node, case_labels);
1273 } 1292 }
1274 1293
1275 1294
1276 void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) { 1295 void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) {
1277 Comment cmnt(masm_, "[ SwitchStatement"); 1296 Comment cmnt(masm_, "[ SwitchStatement");
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after
4210 // Slow-case: Non-function called. 4229 // Slow-case: Non-function called.
4211 __ bind(&slow); 4230 __ bind(&slow);
4212 __ mov(r0, Operand(argc_)); // Setup the number of arguments. 4231 __ mov(r0, Operand(argc_)); // Setup the number of arguments.
4213 __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS); 4232 __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS);
4214 } 4233 }
4215 4234
4216 4235
4217 #undef __ 4236 #undef __
4218 4237
4219 } } // namespace v8::internal 4238 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698