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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 8493008: Tighten the code for MacroAssembler::ThrowUncatchable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | « no previous file | src/ia32/macro-assembler-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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1251
1252 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type, 1252 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
1253 Register value) { 1253 Register value) {
1254 // Adjust this code if not the case. 1254 // Adjust this code if not the case.
1255 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); 1255 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize);
1256 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); 1256 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize);
1257 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); 1257 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize);
1258 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); 1258 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize);
1259 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); 1259 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize);
1260 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize); 1260 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize);
1261 // r0 is expected to hold the exception.
1262 if (!value.is(r0)) {
1263 mov(r0, value);
1264 }
1265 1261
1266 // Drop sp to the top stack handler. 1262 // The exception is expected in r0.
1267 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
1268 ldr(sp, MemOperand(r3));
1269
1270 // Unwind the handlers until the ENTRY handler is found.
1271 Label loop, done;
1272 bind(&loop);
1273 // Load the type of the current stack handler.
1274 const int kStateOffset = StackHandlerConstants::kStateOffset;
1275 ldr(r2, MemOperand(sp, kStateOffset));
1276 cmp(r2, Operand(StackHandler::ENTRY));
1277 b(eq, &done);
1278 // Fetch the next handler in the list.
1279 const int kNextOffset = StackHandlerConstants::kNextOffset;
1280 ldr(sp, MemOperand(sp, kNextOffset));
1281 jmp(&loop);
1282 bind(&done);
1283
1284 // Set the top handler address to next handler past the current ENTRY handler.
1285 pop(r2);
1286 str(r2, MemOperand(r3));
1287
1288 if (type == OUT_OF_MEMORY) { 1263 if (type == OUT_OF_MEMORY) {
1289 // Set external caught exception to false. 1264 // Set external caught exception to false.
1290 ExternalReference external_caught( 1265 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
1291 Isolate::kExternalCaughtExceptionAddress, isolate()); 1266 isolate());
1292 mov(r0, Operand(false, RelocInfo::NONE)); 1267 mov(r0, Operand(false, RelocInfo::NONE));
1293 mov(r2, Operand(external_caught)); 1268 mov(r2, Operand(external_caught));
1294 str(r0, MemOperand(r2)); 1269 str(r0, MemOperand(r2));
1295 1270
1296 // Set pending exception and r0 to out of memory exception. 1271 // Set pending exception and r0 to out of memory exception.
1297 Failure* out_of_memory = Failure::OutOfMemoryException(); 1272 Failure* out_of_memory = Failure::OutOfMemoryException();
1298 mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); 1273 mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory)));
1299 mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, 1274 mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
1300 isolate()))); 1275 isolate())));
1301 str(r0, MemOperand(r2)); 1276 str(r0, MemOperand(r2));
1277 } else if (!value.is(r0)) {
1278 mov(r0, value);
1302 } 1279 }
1303 1280
1304 // Stack layout at this point. See also StackHandlerConstants. 1281 // Drop the stack pointer to the top of the top stack handler.
1305 // sp -> state (ENTRY) 1282 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
1306 // cp 1283 ldr(sp, MemOperand(r3));
1307 // fp
1308 // lr
1309 1284
1310 // Restore context and frame pointer, discard state (r2). 1285 // Unwind the handlers until the top ENTRY handler is found.
1286 Label fetch_next, check_kind;
1287 jmp(&check_kind);
1288 bind(&fetch_next);
1289 ldr(sp, MemOperand(sp, StackHandlerConstants::kNextOffset));
1290
1291 bind(&check_kind);
1292 ldr(r2, MemOperand(sp, StackHandlerConstants::kStateOffset));
1293 cmp(r2, Operand(StackHandler::ENTRY));
1294 b(ne, &fetch_next);
1295
1296 // Set the top handler address to next handler past the top ENTRY handler.
1297 pop(r2);
1298 str(r2, MemOperand(r3));
1299
1300 // Clear the context and frame pointer (0 was saved in the handler), and
1301 // discard the state (r2).
1311 ldm(ia_w, sp, r2.bit() | cp.bit() | fp.bit()); 1302 ldm(ia_w, sp, r2.bit() | cp.bit() | fp.bit());
1312 #ifdef DEBUG 1303
1313 if (emit_debug_code()) {
1314 mov(lr, Operand(pc));
1315 }
1316 #endif
1317 pop(pc); 1304 pop(pc);
1318 } 1305 }
1319 1306
1320 1307
1321 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, 1308 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
1322 Register scratch, 1309 Register scratch,
1323 Label* miss) { 1310 Label* miss) {
1324 Label same_contexts; 1311 Label same_contexts;
1325 1312
1326 ASSERT(!holder_reg.is(scratch)); 1313 ASSERT(!holder_reg.is(scratch));
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3606 void CodePatcher::EmitCondition(Condition cond) { 3593 void CodePatcher::EmitCondition(Condition cond) {
3607 Instr instr = Assembler::instr_at(masm_.pc_); 3594 Instr instr = Assembler::instr_at(masm_.pc_);
3608 instr = (instr & ~kCondMask) | cond; 3595 instr = (instr & ~kCondMask) | cond;
3609 masm_.emit(instr); 3596 masm_.emit(instr);
3610 } 3597 }
3611 3598
3612 3599
3613 } } // namespace v8::internal 3600 } } // namespace v8::internal
3614 3601
3615 #endif // V8_TARGET_ARCH_ARM 3602 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698