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

Side by Side Diff: src/deoptimizer.cc

Issue 192513002: Checking for stack height equality between full codegen and hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 7 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/deoptimizer.h ('k') | src/full-codegen.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "codegen.h" 8 #include "codegen.h"
9 #include "deoptimizer.h" 9 #include "deoptimizer.h"
10 #include "disasm.h" 10 #include "disasm.h"
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 addr < start || 680 addr < start ||
681 addr >= start + (kMaxNumberOfEntries * table_entry_size_)) { 681 addr >= start + (kMaxNumberOfEntries * table_entry_size_)) {
682 return kNotDeoptimizationEntry; 682 return kNotDeoptimizationEntry;
683 } 683 }
684 ASSERT_EQ(0, 684 ASSERT_EQ(0,
685 static_cast<int>(addr - start) % table_entry_size_); 685 static_cast<int>(addr - start) % table_entry_size_);
686 return static_cast<int>(addr - start) / table_entry_size_; 686 return static_cast<int>(addr - start) / table_entry_size_;
687 } 687 }
688 688
689 689
690 int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data, 690 int Deoptimizer::GetOutputInfoIndex(
691 BailoutId id, 691 DeoptimizationOutputData* data,
692 SharedFunctionInfo* shared) { 692 BailoutId id,
693 SharedFunctionInfo* shared) {
693 // TODO(kasperl): For now, we do a simple linear search for the PC 694 // TODO(kasperl): For now, we do a simple linear search for the PC
694 // offset associated with the given node id. This should probably be 695 // offset associated with the given node id. This should probably be
695 // changed to a binary search. 696 // changed to a binary search.
696 int length = data->DeoptPoints(); 697 int length = data->DeoptPoints();
697 for (int i = 0; i < length; i++) { 698 for (int i = 0; i < length; i++) {
698 if (data->AstId(i) == id) { 699 if (data->AstId(i) == id) {
699 return data->PcAndState(i)->value(); 700 return i;
700 } 701 }
701 } 702 }
702 PrintF(stderr, "[couldn't find pc offset for node=%d]\n", id.ToInt()); 703 PrintF(stderr, "[couldn't find pc offset for node=%d]\n", id.ToInt());
703 PrintF(stderr, "[method: %s]\n", shared->DebugName()->ToCString().get()); 704 PrintF(stderr, "[method: %s]\n", shared->DebugName()->ToCString().get());
704 // Print the source code if available. 705 // Print the source code if available.
705 HeapStringAllocator string_allocator; 706 HeapStringAllocator string_allocator;
706 StringStream stream(&string_allocator); 707 StringStream stream(&string_allocator);
707 shared->SourceCodePrint(&stream, -1); 708 shared->SourceCodePrint(&stream, -1);
708 PrintF(stderr, "[source:\n%s\n]", stream.ToCString().get()); 709 PrintF(stderr, "[source:\n%s\n]", stream.ToCString().get());
709 710
710 FATAL("unable to find pc offset during deoptimization"); 711 FATAL("unable to find pc offset during deoptimization");
711 return -1; 712 return -1;
712 } 713 }
713 714
714 715
716 int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data,
717 BailoutId id,
718 SharedFunctionInfo* shared) {
719 int idx = GetOutputInfoIndex(data, id, shared);
720 ASSERT(idx >= 0 && data->AstId(idx) == id);
721 return data->PcAndState(idx)->value();
722 }
723
724
725 #if defined(COMPARE_OPT_STACK_HEIGHT)
726 int Deoptimizer::GetOutputInfoStackHeight(
727 DeoptimizationOutputData* data,
728 BailoutId id,
729 SharedFunctionInfo* shared) {
730 int idx = GetOutputInfoIndex(data, id, shared);
731 ASSERT(idx >= 0 && data->AstId(idx) == id);
732 return data->StackHeight(idx)->value();
733 }
734 #endif
735
736
715 int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) { 737 int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) {
716 int length = 0; 738 int length = 0;
717 // Count all entries in the deoptimizing code list of every context. 739 // Count all entries in the deoptimizing code list of every context.
718 Object* context = isolate->heap()->native_contexts_list(); 740 Object* context = isolate->heap()->native_contexts_list();
719 while (!context->IsUndefined()) { 741 while (!context->IsUndefined()) {
720 Context* native_context = Context::cast(context); 742 Context* native_context = Context::cast(context);
721 Object* element = native_context->DeoptimizedCodeListHead(); 743 Object* element = native_context->DeoptimizedCodeListHead();
722 while (!element->IsUndefined()) { 744 while (!element->IsUndefined()) {
723 Code* code = Code::cast(element); 745 Code* code = Code::cast(element);
724 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); 746 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION);
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after
3581 } 3603 }
3582 3604
3583 3605
3584 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3606 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3585 v->VisitPointer(BitCast<Object**>(&function_)); 3607 v->VisitPointer(BitCast<Object**>(&function_));
3586 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3608 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3587 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3609 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3588 } 3610 }
3589 3611
3590 } } // namespace v8::internal 3612 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698