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

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

Issue 21063002: Out-of-line constant pool on Arm: Stage 1 - Free up r7 for use as constant pool pointer register (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix typo Created 7 years, 4 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
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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, 1306 void MacroAssembler::PushTryHandler(StackHandler::Kind kind,
1307 int handler_index) { 1307 int handler_index) {
1308 // Adjust this code if not the case. 1308 // Adjust this code if not the case.
1309 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); 1309 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize);
1310 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); 1310 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize);
1311 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); 1311 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize);
1312 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); 1312 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize);
1313 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); 1313 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize);
1314 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); 1314 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize);
1315 1315
1316 // For the JSEntry handler, we must preserve r0-r4, r5-r7 are available. 1316 // For the JSEntry handler, we must preserve r0-r4, r5-r6 are available.
1317 // We will build up the handler from the bottom by pushing on the stack. 1317 // We will build up the handler from the bottom by pushing on the stack.
1318 // Set up the code object (r5) and the state (r6) for pushing. 1318 // Set up the code object (r5) and the state (r6) for pushing.
1319 unsigned state = 1319 unsigned state =
1320 StackHandler::IndexField::encode(handler_index) | 1320 StackHandler::IndexField::encode(handler_index) |
1321 StackHandler::KindField::encode(kind); 1321 StackHandler::KindField::encode(kind);
1322 mov(r5, Operand(CodeObject())); 1322 mov(r5, Operand(CodeObject()));
1323 mov(r6, Operand(state)); 1323 mov(r6, Operand(state));
1324 1324
1325 // Push the frame pointer, context, state, and code object. 1325 // Push the frame pointer, context, state, and code object.
1326 if (kind == StackHandler::JS_ENTRY) { 1326 if (kind == StackHandler::JS_ENTRY) {
1327 mov(r7, Operand(Smi::FromInt(0))); // Indicates no context. 1327 mov(cp, Operand(Smi::FromInt(0))); // Indicates no context.
1328 mov(ip, Operand::Zero()); // NULL frame pointer. 1328 mov(ip, Operand::Zero()); // NULL frame pointer.
1329 stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | ip.bit()); 1329 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | ip.bit());
1330 } else { 1330 } else {
1331 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit()); 1331 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit());
1332 } 1332 }
1333 1333
1334 // Link the current handler as the next handler. 1334 // Link the current handler as the next handler.
1335 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); 1335 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
1336 ldr(r5, MemOperand(r6)); 1336 ldr(r5, MemOperand(r6));
1337 push(r5); 1337 push(r5);
1338 // Set this new handler as the current one. 1338 // Set this new handler as the current one.
1339 str(sp, MemOperand(r6)); 1339 str(sp, MemOperand(r6));
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 ExternalReference next_address = 2255 ExternalReference next_address =
2256 ExternalReference::handle_scope_next_address(isolate()); 2256 ExternalReference::handle_scope_next_address(isolate());
2257 const int kNextOffset = 0; 2257 const int kNextOffset = 0;
2258 const int kLimitOffset = AddressOffset( 2258 const int kLimitOffset = AddressOffset(
2259 ExternalReference::handle_scope_limit_address(isolate()), 2259 ExternalReference::handle_scope_limit_address(isolate()),
2260 next_address); 2260 next_address);
2261 const int kLevelOffset = AddressOffset( 2261 const int kLevelOffset = AddressOffset(
2262 ExternalReference::handle_scope_level_address(isolate()), 2262 ExternalReference::handle_scope_level_address(isolate()),
2263 next_address); 2263 next_address);
2264 2264
2265 ASSERT(!thunk_last_arg.is(r3));
2266
2265 // Allocate HandleScope in callee-save registers. 2267 // Allocate HandleScope in callee-save registers.
2266 mov(r7, Operand(next_address)); 2268 mov(r3, Operand(next_address));
2267 ldr(r4, MemOperand(r7, kNextOffset)); 2269 ldr(r4, MemOperand(r3, kNextOffset));
2268 ldr(r5, MemOperand(r7, kLimitOffset)); 2270 ldr(r5, MemOperand(r3, kLimitOffset));
2269 ldr(r6, MemOperand(r7, kLevelOffset)); 2271 ldr(r6, MemOperand(r3, kLevelOffset));
2270 add(r6, r6, Operand(1)); 2272 add(r6, r6, Operand(1));
2271 str(r6, MemOperand(r7, kLevelOffset)); 2273 str(r6, MemOperand(r3, kLevelOffset));
2272 2274
2273 if (FLAG_log_timer_events) { 2275 if (FLAG_log_timer_events) {
2274 FrameScope frame(this, StackFrame::MANUAL); 2276 FrameScope frame(this, StackFrame::MANUAL);
2275 PushSafepointRegisters(); 2277 PushSafepointRegisters();
2276 PrepareCallCFunction(1, r0); 2278 PrepareCallCFunction(1, r0);
2277 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); 2279 mov(r0, Operand(ExternalReference::isolate_address(isolate())));
2278 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); 2280 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1);
2279 PopSafepointRegisters(); 2281 PopSafepointRegisters();
2280 } 2282 }
2281 2283
2282 ASSERT(!thunk_last_arg.is(r3));
2283 Label profiler_disabled; 2284 Label profiler_disabled;
2284 Label end_profiler_check; 2285 Label end_profiler_check;
2285 bool* is_profiling_flag = 2286 bool* is_profiling_flag =
2286 isolate()->cpu_profiler()->is_profiling_address(); 2287 isolate()->cpu_profiler()->is_profiling_address();
2287 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); 2288 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
2288 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag))); 2289 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag)));
2289 ldrb(r3, MemOperand(r3, 0)); 2290 ldrb(r3, MemOperand(r3, 0));
2290 cmp(r3, Operand(0)); 2291 cmp(r3, Operand(0));
2291 b(eq, &profiler_disabled); 2292 b(eq, &profiler_disabled);
2292 2293
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 // derefernce returned value 2327 // derefernce returned value
2327 ldr(r0, MemOperand(r0)); 2328 ldr(r0, MemOperand(r0));
2328 b(&return_value_loaded); 2329 b(&return_value_loaded);
2329 bind(&load_return_value); 2330 bind(&load_return_value);
2330 } 2331 }
2331 // load value from ReturnValue 2332 // load value from ReturnValue
2332 ldr(r0, MemOperand(fp, return_value_offset*kPointerSize)); 2333 ldr(r0, MemOperand(fp, return_value_offset*kPointerSize));
2333 bind(&return_value_loaded); 2334 bind(&return_value_loaded);
2334 // No more valid handles (the result handle was the last one). Restore 2335 // No more valid handles (the result handle was the last one). Restore
2335 // previous handle scope. 2336 // previous handle scope.
2336 str(r4, MemOperand(r7, kNextOffset)); 2337 mov(r3, Operand(next_address));
2338 str(r4, MemOperand(r3, kNextOffset));
2337 if (emit_debug_code()) { 2339 if (emit_debug_code()) {
2338 ldr(r1, MemOperand(r7, kLevelOffset)); 2340 ldr(r1, MemOperand(r3, kLevelOffset));
2339 cmp(r1, r6); 2341 cmp(r1, r6);
2340 Check(eq, "Unexpected level after return from api call"); 2342 Check(eq, "Unexpected level after return from api call");
2341 } 2343 }
2342 sub(r6, r6, Operand(1)); 2344 sub(r6, r6, Operand(1));
2343 str(r6, MemOperand(r7, kLevelOffset)); 2345 str(r6, MemOperand(r3, kLevelOffset));
2344 ldr(ip, MemOperand(r7, kLimitOffset)); 2346 ldr(ip, MemOperand(r3, kLimitOffset));
2345 cmp(r5, ip); 2347 cmp(r5, ip);
2346 b(ne, &delete_allocated_handles); 2348 b(ne, &delete_allocated_handles);
2347 2349
2348 // Check if the function scheduled an exception. 2350 // Check if the function scheduled an exception.
2349 bind(&leave_exit_frame); 2351 bind(&leave_exit_frame);
2350 LoadRoot(r4, Heap::kTheHoleValueRootIndex); 2352 LoadRoot(r4, Heap::kTheHoleValueRootIndex);
2351 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); 2353 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate())));
2352 ldr(r5, MemOperand(ip)); 2354 ldr(r5, MemOperand(ip));
2353 cmp(r4, r5); 2355 cmp(r4, r5);
2354 b(ne, &promote_scheduled_exception); 2356 b(ne, &promote_scheduled_exception);
2355 2357
2356 // LeaveExitFrame expects unwind space to be in a register. 2358 // LeaveExitFrame expects unwind space to be in a register.
2357 mov(r4, Operand(stack_space)); 2359 mov(r4, Operand(stack_space));
2358 LeaveExitFrame(false, r4); 2360 LeaveExitFrame(false, r4);
2359 mov(pc, lr); 2361 mov(pc, lr);
2360 2362
2361 bind(&promote_scheduled_exception); 2363 bind(&promote_scheduled_exception);
2362 TailCallExternalReference( 2364 TailCallExternalReference(
2363 ExternalReference(Runtime::kPromoteScheduledException, isolate()), 2365 ExternalReference(Runtime::kPromoteScheduledException, isolate()),
2364 0, 2366 0,
2365 1); 2367 1);
2366 2368
2367 // HandleScope limit has changed. Delete allocated extensions. 2369 // HandleScope limit has changed. Delete allocated extensions.
2368 bind(&delete_allocated_handles); 2370 bind(&delete_allocated_handles);
2369 str(r5, MemOperand(r7, kLimitOffset)); 2371 str(r5, MemOperand(r3, kLimitOffset));
2370 mov(r4, r0); 2372 mov(r4, r0);
2371 PrepareCallCFunction(1, r5); 2373 PrepareCallCFunction(1, r5);
2372 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); 2374 mov(r0, Operand(ExternalReference::isolate_address(isolate())));
2373 CallCFunction( 2375 CallCFunction(
2374 ExternalReference::delete_handle_scope_extensions(isolate()), 1); 2376 ExternalReference::delete_handle_scope_extensions(isolate()), 1);
2375 mov(r0, r4); 2377 mov(r0, r4);
2376 jmp(&leave_exit_frame); 2378 jmp(&leave_exit_frame);
2377 } 2379 }
2378 2380
2379 2381
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
3833 void CodePatcher::EmitCondition(Condition cond) { 3835 void CodePatcher::EmitCondition(Condition cond) {
3834 Instr instr = Assembler::instr_at(masm_.pc_); 3836 Instr instr = Assembler::instr_at(masm_.pc_);
3835 instr = (instr & ~kCondMask) | cond; 3837 instr = (instr & ~kCondMask) | cond;
3836 masm_.emit(instr); 3838 masm_.emit(instr);
3837 } 3839 }
3838 3840
3839 3841
3840 } } // namespace v8::internal 3842 } } // namespace v8::internal
3841 3843
3842 #endif // V8_TARGET_ARCH_ARM 3844 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698