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

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

Issue 9372016: Simplify handler pushing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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/macro-assembler-arm.h ('k') | src/frames.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 void MacroAssembler::DebugBreak() { 1181 void MacroAssembler::DebugBreak() {
1182 mov(r0, Operand(0, RelocInfo::NONE)); 1182 mov(r0, Operand(0, RelocInfo::NONE));
1183 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); 1183 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate())));
1184 CEntryStub ces(1); 1184 CEntryStub ces(1);
1185 ASSERT(AllowThisStubCall(&ces)); 1185 ASSERT(AllowThisStubCall(&ces));
1186 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); 1186 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK);
1187 } 1187 }
1188 #endif 1188 #endif
1189 1189
1190 1190
1191 void MacroAssembler::PushTryHandler(CodeLocation try_location, 1191 void MacroAssembler::PushTryHandler(StackHandler::Kind kind,
1192 HandlerType type,
1193 int handler_index) { 1192 int handler_index) {
1194 // Adjust this code if not the case. 1193 // Adjust this code if not the case.
1195 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); 1194 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize);
1196 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); 1195 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize);
1197 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); 1196 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize);
1198 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); 1197 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize);
1199 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); 1198 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize);
1200 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); 1199 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize);
1201 1200
1202 // For the JSEntry handler, we must preserve r0-r4, r5-r7 are available. 1201 // For the JSEntry handler, we must preserve r0-r4, r5-r7 are available.
1203 // We will build up the handler from the bottom by pushing on the stack. 1202 // We will build up the handler from the bottom by pushing on the stack.
1204 // First compute the state.
1205 unsigned state = StackHandler::OffsetField::encode(handler_index);
1206 if (try_location == IN_JAVASCRIPT) {
1207 state |= (type == TRY_CATCH_HANDLER)
1208 ? StackHandler::KindField::encode(StackHandler::TRY_CATCH)
1209 : StackHandler::KindField::encode(StackHandler::TRY_FINALLY);
1210 } else {
1211 ASSERT(try_location == IN_JS_ENTRY);
1212 state |= StackHandler::KindField::encode(StackHandler::ENTRY);
1213 }
1214
1215 // Set up the code object (r5) and the state (r6) for pushing. 1203 // Set up the code object (r5) and the state (r6) for pushing.
1204 unsigned state =
1205 StackHandler::IndexField::encode(handler_index) |
1206 StackHandler::KindField::encode(kind);
1216 mov(r5, Operand(CodeObject())); 1207 mov(r5, Operand(CodeObject()));
1217 mov(r6, Operand(state)); 1208 mov(r6, Operand(state));
1218 1209
1219 // Push the frame pointer, context, state, and code object. 1210 // Push the frame pointer, context, state, and code object.
1220 if (try_location == IN_JAVASCRIPT) { 1211 if (kind == StackHandler::JS_ENTRY) {
1221 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit());
1222 } else {
1223 mov(r7, Operand(Smi::FromInt(0))); // Indicates no context. 1212 mov(r7, Operand(Smi::FromInt(0))); // Indicates no context.
1224 mov(ip, Operand(0, RelocInfo::NONE)); // NULL frame pointer. 1213 mov(ip, Operand(0, RelocInfo::NONE)); // NULL frame pointer.
1225 stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | ip.bit()); 1214 stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | ip.bit());
1215 } else {
1216 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit());
1226 } 1217 }
1227 1218
1228 // Link the current handler as the next handler. 1219 // Link the current handler as the next handler.
1229 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); 1220 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
1230 ldr(r5, MemOperand(r6)); 1221 ldr(r5, MemOperand(r6));
1231 push(r5); 1222 push(r5);
1232 // Set this new handler as the current one. 1223 // Set this new handler as the current one.
1233 str(sp, MemOperand(r6)); 1224 str(sp, MemOperand(r6));
1234 } 1225 }
1235 1226
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); 1314 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
1324 ldr(sp, MemOperand(r3)); 1315 ldr(sp, MemOperand(r3));
1325 1316
1326 // Unwind the handlers until the ENTRY handler is found. 1317 // Unwind the handlers until the ENTRY handler is found.
1327 Label fetch_next, check_kind; 1318 Label fetch_next, check_kind;
1328 jmp(&check_kind); 1319 jmp(&check_kind);
1329 bind(&fetch_next); 1320 bind(&fetch_next);
1330 ldr(sp, MemOperand(sp, StackHandlerConstants::kNextOffset)); 1321 ldr(sp, MemOperand(sp, StackHandlerConstants::kNextOffset));
1331 1322
1332 bind(&check_kind); 1323 bind(&check_kind);
1333 STATIC_ASSERT(StackHandler::ENTRY == 0); 1324 STATIC_ASSERT(StackHandler::JS_ENTRY == 0);
1334 ldr(r2, MemOperand(sp, StackHandlerConstants::kStateOffset)); 1325 ldr(r2, MemOperand(sp, StackHandlerConstants::kStateOffset));
1335 tst(r2, Operand(StackHandler::KindField::kMask)); 1326 tst(r2, Operand(StackHandler::KindField::kMask));
1336 b(ne, &fetch_next); 1327 b(ne, &fetch_next);
1337 1328
1338 // Set the top handler address to next handler past the top ENTRY handler. 1329 // Set the top handler address to next handler past the top ENTRY handler.
1339 pop(r2); 1330 pop(r2);
1340 str(r2, MemOperand(r3)); 1331 str(r2, MemOperand(r3));
1341 // Get the code object (r1) and state (r2). Clear the context and frame 1332 // Get the code object (r1) and state (r2). Clear the context and frame
1342 // pointer (0 was saved in the handler). 1333 // pointer (0 was saved in the handler).
1343 ldm(ia_w, sp, r1.bit() | r2.bit() | cp.bit() | fp.bit()); 1334 ldm(ia_w, sp, r1.bit() | r2.bit() | cp.bit() | fp.bit());
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
3735 void CodePatcher::EmitCondition(Condition cond) { 3726 void CodePatcher::EmitCondition(Condition cond) {
3736 Instr instr = Assembler::instr_at(masm_.pc_); 3727 Instr instr = Assembler::instr_at(masm_.pc_);
3737 instr = (instr & ~kCondMask) | cond; 3728 instr = (instr & ~kCondMask) | cond;
3738 masm_.emit(instr); 3729 masm_.emit(instr);
3739 } 3730 }
3740 3731
3741 3732
3742 } } // namespace v8::internal 3733 } } // namespace v8::internal
3743 3734
3744 #endif // V8_TARGET_ARCH_ARM 3735 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698