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

Side by Side Diff: src/frames.cc

Issue 10910161: Partial ia32 implementation of optimized try/catch (by Kevin Millikin) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed build. Created 8 years, 3 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/frames.h ('k') | src/frames-inl.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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 bool StandardFrame::IsExpressionInsideHandler(int n) const { 611 bool StandardFrame::IsExpressionInsideHandler(int n) const {
612 Address address = GetExpressionAddress(n); 612 Address address = GetExpressionAddress(n);
613 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) { 613 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) {
614 if (it.handler()->includes(address)) return true; 614 if (it.handler()->includes(address)) return true;
615 } 615 }
616 return false; 616 return false;
617 } 617 }
618 618
619 619
620 void OptimizedFrame::Iterate(ObjectVisitor* v) const { 620 void OptimizedFrame::Iterate(ObjectVisitor* v) const {
621 #ifdef DEBUG
622 // Make sure that optimized frames do not contain any stack handlers.
623 StackHandlerIterator it(this, top_handler());
624 ASSERT(it.done());
625 #endif
626
627 // Make sure that we're not doing "safe" stack frame iteration. We cannot 621 // Make sure that we're not doing "safe" stack frame iteration. We cannot
628 // possibly find pointers in optimized frames in that state. 622 // possibly find pointers in optimized frames in that state.
629 ASSERT(!SafeStackFrameIterator::is_active(isolate())); 623 ASSERT(!SafeStackFrameIterator::is_active(isolate()));
630 624
631 // Compute the safepoint information. 625 // Compute the safepoint information.
632 unsigned stack_slots = 0; 626 unsigned stack_slots = 0;
633 SafepointEntry safepoint_entry; 627 SafepointEntry safepoint_entry;
634 Code* code = StackFrame::GetSafepointData( 628 Code* code = StackFrame::GetSafepointData(
635 isolate(), pc(), &safepoint_entry, &stack_slots); 629 isolate(), pc(), &safepoint_entry, &stack_slots);
636 unsigned slot_space = stack_slots * kPointerSize; 630 unsigned slot_space = stack_slots * kPointerSize;
(...skipping 25 matching lines...) Expand all
662 } 656 }
663 } 657 }
664 // Skip the words containing the register values. 658 // Skip the words containing the register values.
665 parameters_base += kNumSafepointRegisters; 659 parameters_base += kNumSafepointRegisters;
666 } 660 }
667 661
668 // We're done dealing with the register bits. 662 // We're done dealing with the register bits.
669 uint8_t* safepoint_bits = safepoint_entry.bits(); 663 uint8_t* safepoint_bits = safepoint_entry.bits();
670 safepoint_bits += kNumSafepointRegisters >> kBitsPerByteLog2; 664 safepoint_bits += kNumSafepointRegisters >> kBitsPerByteLog2;
671 665
672 // Visit the rest of the parameters. 666 // Visit the rest of the parameters and the exception handlers.
673 v->VisitPointers(parameters_base, parameters_limit); 667 StackHandlerIterator handler_iterator(this, top_handler());
668 Object** next_parameter = parameters_base;
669 while (!handler_iterator.done()) {
670 // For each handler, visit the parameters down to the top of the handler
671 // and the handler itself.
672 StackHandler* handler = handler_iterator.handler();
673 Address handler_top = handler->address();
674 v->VisitPointers(next_parameter, reinterpret_cast<Object**>(handler_top));
675 handler->Iterate(v, code);
676 next_parameter =
677 reinterpret_cast<Object**>(handler_top + StackHandlerConstants::kSize);
678 handler_iterator.Advance();
679 }
680 // And visit all remaining parameters.
681 v->VisitPointers(next_parameter, parameters_limit);
674 682
675 // Visit pointer spill slots and locals. 683 // Visit pointer spill slots and locals.
676 for (unsigned index = 0; index < stack_slots; index++) { 684 for (unsigned index = 0; index < stack_slots; index++) {
677 int byte_index = index >> kBitsPerByteLog2; 685 int byte_index = index >> kBitsPerByteLog2;
678 int bit_index = index & (kBitsPerByte - 1); 686 int bit_index = index & (kBitsPerByte - 1);
679 if ((safepoint_bits[byte_index] & (1U << bit_index)) != 0) { 687 if ((safepoint_bits[byte_index] & (1U << bit_index)) != 0) {
680 v->VisitPointer(parameters_limit + index); 688 v->VisitPointer(parameters_limit + index);
681 } 689 }
682 } 690 }
683 691
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 // in the deoptimization translation are ordered bottom-to-top. 879 // in the deoptimization translation are ordered bottom-to-top.
872 bool is_constructor = IsConstructor(); 880 bool is_constructor = IsConstructor();
873 int i = jsframe_count; 881 int i = jsframe_count;
874 while (i > 0) { 882 while (i > 0) {
875 opcode = static_cast<Translation::Opcode>(it.Next()); 883 opcode = static_cast<Translation::Opcode>(it.Next());
876 if (opcode == Translation::JS_FRAME) { 884 if (opcode == Translation::JS_FRAME) {
877 i--; 885 i--;
878 BailoutId ast_id = BailoutId(it.Next()); 886 BailoutId ast_id = BailoutId(it.Next());
879 JSFunction* function = LiteralAt(literal_array, it.Next()); 887 JSFunction* function = LiteralAt(literal_array, it.Next());
880 it.Next(); // Skip height. 888 it.Next(); // Skip height.
889 it.Next(); // Skip handler count.
881 890
882 // The translation commands are ordered and the receiver is always 891 // The translation commands are ordered and the receiver is always
883 // at the first position. Since we are always at a call when we need 892 // at the first position. Since we are always at a call when we need
884 // to construct a stack trace, the receiver is always in a stack slot. 893 // to construct a stack trace, the receiver is always in a stack slot.
885 opcode = static_cast<Translation::Opcode>(it.Next()); 894 opcode = static_cast<Translation::Opcode>(it.Next());
886 ASSERT(opcode == Translation::STACK_SLOT || 895 ASSERT(opcode == Translation::STACK_SLOT ||
887 opcode == Translation::LITERAL); 896 opcode == Translation::LITERAL);
888 int index = it.Next(); 897 int index = it.Next();
889 898
890 // Get the correct receiver in the optimized frame. 899 // Get the correct receiver in the optimized frame.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 1004
996 // We insert the frames in reverse order because the frames 1005 // We insert the frames in reverse order because the frames
997 // in the deoptimization translation are ordered bottom-to-top. 1006 // in the deoptimization translation are ordered bottom-to-top.
998 while (jsframe_count > 0) { 1007 while (jsframe_count > 0) {
999 opcode = static_cast<Translation::Opcode>(it.Next()); 1008 opcode = static_cast<Translation::Opcode>(it.Next());
1000 if (opcode == Translation::JS_FRAME) { 1009 if (opcode == Translation::JS_FRAME) {
1001 jsframe_count--; 1010 jsframe_count--;
1002 it.Next(); // Skip ast id. 1011 it.Next(); // Skip ast id.
1003 JSFunction* function = LiteralAt(literal_array, it.Next()); 1012 JSFunction* function = LiteralAt(literal_array, it.Next());
1004 it.Next(); // Skip height. 1013 it.Next(); // Skip height.
1014 it.Next(); // Skip handler count;
1005 functions->Add(function); 1015 functions->Add(function);
1006 } else { 1016 } else {
1007 // Skip over operands to advance to the next opcode. 1017 // Skip over operands to advance to the next opcode.
1008 it.Skip(Translation::NumberOfOperandsFor(opcode)); 1018 it.Skip(Translation::NumberOfOperandsFor(opcode));
1009 } 1019 }
1010 } 1020 }
1011 } 1021 }
1012 1022
1013 1023
1014 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { 1024 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 ZoneList<StackFrame*> list(10, zone); 1446 ZoneList<StackFrame*> list(10, zone);
1437 for (StackFrameIterator it; !it.done(); it.Advance()) { 1447 for (StackFrameIterator it; !it.done(); it.Advance()) {
1438 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1448 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1439 list.Add(frame, zone); 1449 list.Add(frame, zone);
1440 } 1450 }
1441 return list.ToVector(); 1451 return list.ToVector();
1442 } 1452 }
1443 1453
1444 1454
1445 } } // namespace v8::internal 1455 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698