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

Side by Side Diff: src/x64/macro-assembler-x64.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/x64/macro-assembler-x64.h ('k') | no next file » | 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 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 void MacroAssembler::LoadFromSafepointRegisterSlot(Register dst, Register src) { 2446 void MacroAssembler::LoadFromSafepointRegisterSlot(Register dst, Register src) {
2447 movq(dst, SafepointRegisterSlot(src)); 2447 movq(dst, SafepointRegisterSlot(src));
2448 } 2448 }
2449 2449
2450 2450
2451 Operand MacroAssembler::SafepointRegisterSlot(Register reg) { 2451 Operand MacroAssembler::SafepointRegisterSlot(Register reg) {
2452 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); 2452 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize);
2453 } 2453 }
2454 2454
2455 2455
2456 void MacroAssembler::PushTryHandler(CodeLocation try_location, 2456 void MacroAssembler::PushTryHandler(StackHandler::Kind kind,
2457 HandlerType type,
2458 int handler_index) { 2457 int handler_index) {
2459 // Adjust this code if not the case. 2458 // Adjust this code if not the case.
2460 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); 2459 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize);
2461 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); 2460 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
2462 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); 2461 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize);
2463 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); 2462 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize);
2464 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); 2463 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize);
2465 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); 2464 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize);
2466 2465
2467 // We will build up the handler from the bottom by pushing on the stack. 2466 // We will build up the handler from the bottom by pushing on the stack.
2468 // First compute the state and push the frame pointer and context. 2467 // First push the frame pointer and context.
2469 unsigned state = StackHandler::OffsetField::encode(handler_index); 2468 if (kind == StackHandler::JS_ENTRY) {
2470 if (try_location == IN_JAVASCRIPT) {
2471 push(rbp);
2472 push(rsi);
2473 state |= (type == TRY_CATCH_HANDLER)
2474 ? StackHandler::KindField::encode(StackHandler::TRY_CATCH)
2475 : StackHandler::KindField::encode(StackHandler::TRY_FINALLY);
2476 } else {
2477 ASSERT(try_location == IN_JS_ENTRY);
2478 // The frame pointer does not point to a JS frame so we save NULL for 2469 // The frame pointer does not point to a JS frame so we save NULL for
2479 // rbp. We expect the code throwing an exception to check rbp before 2470 // rbp. We expect the code throwing an exception to check rbp before
2480 // dereferencing it to restore the context. 2471 // dereferencing it to restore the context.
2481 push(Immediate(0)); // NULL frame pointer. 2472 push(Immediate(0)); // NULL frame pointer.
2482 Push(Smi::FromInt(0)); // No context. 2473 Push(Smi::FromInt(0)); // No context.
2483 state |= StackHandler::KindField::encode(StackHandler::ENTRY); 2474 } else {
2475 push(rbp);
2476 push(rsi);
2484 } 2477 }
2485 2478
2486 // Push the state and the code object. 2479 // Push the state and the code object.
2480 unsigned state =
2481 StackHandler::IndexField::encode(handler_index) |
2482 StackHandler::KindField::encode(kind);
2487 push(Immediate(state)); 2483 push(Immediate(state));
2488 Push(CodeObject()); 2484 Push(CodeObject());
2489 2485
2490 // Link the current handler as the next handler. 2486 // Link the current handler as the next handler.
2491 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); 2487 ExternalReference handler_address(Isolate::kHandlerAddress, isolate());
2492 push(ExternalOperand(handler_address)); 2488 push(ExternalOperand(handler_address));
2493 // Set this new handler as the current one. 2489 // Set this new handler as the current one.
2494 movq(ExternalOperand(handler_address), rsp); 2490 movq(ExternalOperand(handler_address), rsp);
2495 } 2491 }
2496 2492
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); 2583 ExternalReference handler_address(Isolate::kHandlerAddress, isolate());
2588 Load(rsp, handler_address); 2584 Load(rsp, handler_address);
2589 2585
2590 // Unwind the handlers until the top ENTRY handler is found. 2586 // Unwind the handlers until the top ENTRY handler is found.
2591 Label fetch_next, check_kind; 2587 Label fetch_next, check_kind;
2592 jmp(&check_kind, Label::kNear); 2588 jmp(&check_kind, Label::kNear);
2593 bind(&fetch_next); 2589 bind(&fetch_next);
2594 movq(rsp, Operand(rsp, StackHandlerConstants::kNextOffset)); 2590 movq(rsp, Operand(rsp, StackHandlerConstants::kNextOffset));
2595 2591
2596 bind(&check_kind); 2592 bind(&check_kind);
2597 STATIC_ASSERT(StackHandler::ENTRY == 0); 2593 STATIC_ASSERT(StackHandler::JS_ENTRY == 0);
2598 testl(Operand(rsp, StackHandlerConstants::kStateOffset), 2594 testl(Operand(rsp, StackHandlerConstants::kStateOffset),
2599 Immediate(StackHandler::KindField::kMask)); 2595 Immediate(StackHandler::KindField::kMask));
2600 j(not_zero, &fetch_next); 2596 j(not_zero, &fetch_next);
2601 2597
2602 // Set the top handler address to next handler past the top ENTRY handler. 2598 // Set the top handler address to next handler past the top ENTRY handler.
2603 pop(ExternalOperand(handler_address)); 2599 pop(ExternalOperand(handler_address));
2604 2600
2605 // Remove the code object and state, compute the handler address in rdi. 2601 // Remove the code object and state, compute the handler address in rdi.
2606 pop(rdi); // Code object. 2602 pop(rdi); // Code object.
2607 pop(rdx); // Offset and state. 2603 pop(rdx); // Offset and state.
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 4374
4379 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); 4375 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask));
4380 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); 4376 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length);
4381 4377
4382 bind(&done); 4378 bind(&done);
4383 } 4379 }
4384 4380
4385 } } // namespace v8::internal 4381 } } // namespace v8::internal
4386 4382
4387 #endif // V8_TARGET_ARCH_X64 4383 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698