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

Side by Side Diff: src/objects.cc

Issue 1010883002: Switch full-codegen from StackHandlers to handler table. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-isolate-dead-code
Patch Set: Minor cleanup. Created 5 years, 9 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
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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 8517 matching lines...) Expand 10 before | Expand all | Expand 10 after
8528 if (number_of_deopt_points == 0) { 8528 if (number_of_deopt_points == 0) {
8529 result = isolate->factory()->empty_fixed_array(); 8529 result = isolate->factory()->empty_fixed_array();
8530 } else { 8530 } else {
8531 result = isolate->factory()->NewFixedArray( 8531 result = isolate->factory()->NewFixedArray(
8532 LengthOfFixedArray(number_of_deopt_points), pretenure); 8532 LengthOfFixedArray(number_of_deopt_points), pretenure);
8533 } 8533 }
8534 return Handle<DeoptimizationOutputData>::cast(result); 8534 return Handle<DeoptimizationOutputData>::cast(result);
8535 } 8535 }
8536 8536
8537 8537
8538 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out) {
8539 int innermost_handler = -1, innermost_start = -1;
8540 for (int i = 0; i < length(); i += kRangeEntrySize) {
Yang 2015/03/17 10:21:22 The handler table should be sorted by start_offset
Michael Starzinger 2015/03/18 10:42:35 Acknowledged. Unfortunately the start offsets are
8541 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value();
8542 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value();
8543 int handler_offset = Smi::cast(get(i + kRangeHandlerIndex))->value();
8544 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value();
8545 if (pc_offset > start_offset && pc_offset <= end_offset) {
8546 DCHECK_NE(start_offset, innermost_start);
8547 if (start_offset < innermost_start) continue;
Yang 2015/03/17 10:21:22 This assumes that for nested try-catch, the start_
Michael Starzinger 2015/03/18 10:42:35 Acknowledged. Yes, this should hold on all archite
8548 innermost_handler = handler_offset;
8549 innermost_start = start_offset;
8550 *stack_depth_out = stack_depth;
8551 }
8552 }
8553 return innermost_handler;
8554 }
8555
8556
8557 // TODO(turbofan): Make sure table is sorted and use binary search.
8558 int HandlerTable::LookupReturn(int pc_offset) {
8559 for (int i = 0; i < length(); i += kReturnEntrySize) {
8560 int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value();
8561 int handler_offset = Smi::cast(get(i + kReturnHandlerIndex))->value();
8562 if (pc_offset == return_offset) return handler_offset;
8563 }
8564 return -1;
8565 }
8566
8567
8538 #ifdef DEBUG 8568 #ifdef DEBUG
8539 bool DescriptorArray::IsEqualTo(DescriptorArray* other) { 8569 bool DescriptorArray::IsEqualTo(DescriptorArray* other) {
8540 if (IsEmpty()) return other->IsEmpty(); 8570 if (IsEmpty()) return other->IsEmpty();
8541 if (other->IsEmpty()) return false; 8571 if (other->IsEmpty()) return false;
8542 if (length() != other->length()) return false; 8572 if (length() != other->length()) return false;
8543 for (int i = 0; i < length(); ++i) { 8573 for (int i = 0; i < length(); ++i) {
8544 if (get(i) != other->get(i)) return false; 8574 if (get(i) != other->get(i)) return false;
8545 } 8575 }
8546 return true; 8576 return true;
8547 } 8577 }
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after
11546 for (int i = 0; i < this->DeoptPoints(); i++) { 11576 for (int i = 0; i < this->DeoptPoints(); i++) {
11547 int pc_and_state = this->PcAndState(i)->value(); 11577 int pc_and_state = this->PcAndState(i)->value();
11548 os << std::setw(6) << this->AstId(i).ToInt() << " " << std::setw(8) 11578 os << std::setw(6) << this->AstId(i).ToInt() << " " << std::setw(8)
11549 << FullCodeGenerator::PcField::decode(pc_and_state) << " " 11579 << FullCodeGenerator::PcField::decode(pc_and_state) << " "
11550 << FullCodeGenerator::State2String( 11580 << FullCodeGenerator::State2String(
11551 FullCodeGenerator::StateField::decode(pc_and_state)) << "\n"; 11581 FullCodeGenerator::StateField::decode(pc_and_state)) << "\n";
11552 } 11582 }
11553 } 11583 }
11554 11584
11555 11585
11586 void HandlerTable::HandlerTableRangePrint(std::ostream& os) {
11587 os << " from to hdlr\n";
11588 for (int i = 0; i < length(); i += kRangeEntrySize) {
11589 int pc_start = Smi::cast(get(i + kRangeStartIndex))->value();
11590 int pc_end = Smi::cast(get(i + kRangeEndIndex))->value();
11591 int handler = Smi::cast(get(i + kRangeHandlerIndex))->value();
11592 int depth = Smi::cast(get(i + kRangeDepthIndex))->value();
11593 os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end
11594 << ") -> " << std::setw(4) << handler << " (depth=" << depth << ")\n";
11595 }
11596 }
11597
11598
11599 void HandlerTable::HandlerTableReturnPrint(std::ostream& os) {
11600 os << " off hdlr\n";
11601 for (int i = 0; i < length(); i += kReturnEntrySize) {
11602 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value();
11603 int handler = Smi::cast(get(i + kReturnHandlerIndex))->value();
11604 os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4)
11605 << handler << "\n";
11606 }
11607 }
11608
11609
11556 const char* Code::ICState2String(InlineCacheState state) { 11610 const char* Code::ICState2String(InlineCacheState state) {
11557 switch (state) { 11611 switch (state) {
11558 case UNINITIALIZED: return "UNINITIALIZED"; 11612 case UNINITIALIZED: return "UNINITIALIZED";
11559 case PREMONOMORPHIC: return "PREMONOMORPHIC"; 11613 case PREMONOMORPHIC: return "PREMONOMORPHIC";
11560 case MONOMORPHIC: return "MONOMORPHIC"; 11614 case MONOMORPHIC: return "MONOMORPHIC";
11561 case PROTOTYPE_FAILURE: 11615 case PROTOTYPE_FAILURE:
11562 return "PROTOTYPE_FAILURE"; 11616 return "PROTOTYPE_FAILURE";
11563 case POLYMORPHIC: return "POLYMORPHIC"; 11617 case POLYMORPHIC: return "POLYMORPHIC";
11564 case MEGAMORPHIC: return "MEGAMORPHIC"; 11618 case MEGAMORPHIC: return "MEGAMORPHIC";
11565 case GENERIC: return "GENERIC"; 11619 case GENERIC: return "GENERIC";
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
11692 } 11746 }
11693 #ifdef OBJECT_PRINT 11747 #ifdef OBJECT_PRINT
11694 if (!type_feedback_info()->IsUndefined()) { 11748 if (!type_feedback_info()->IsUndefined()) {
11695 OFStream os(stdout); 11749 OFStream os(stdout);
11696 TypeFeedbackInfo::cast(type_feedback_info())->TypeFeedbackInfoPrint(os); 11750 TypeFeedbackInfo::cast(type_feedback_info())->TypeFeedbackInfoPrint(os);
11697 os << "\n"; 11751 os << "\n";
11698 } 11752 }
11699 #endif 11753 #endif
11700 } 11754 }
11701 11755
11702 if (handler_table()->length() > 0 && is_turbofanned()) { 11756 if (handler_table()->length() > 0) {
11703 os << "Handler Table (size = " << handler_table()->Size() << ")\n"; 11757 os << "Handler Table (size = " << handler_table()->Size() << ")\n";
11704 for (int i = 0; i < handler_table()->length(); i += 2) { 11758 if (kind() == FUNCTION) {
11705 int pc_offset = Smi::cast(handler_table()->get(i))->value(); 11759 HandlerTable::cast(handler_table())->HandlerTableRangePrint(os);
11706 int handler = Smi::cast(handler_table()->get(i + 1))->value(); 11760 } else if (kind() == OPTIMIZED_FUNCTION) {
11707 os << static_cast<const void*>(instruction_start() + pc_offset) << " " 11761 HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os);
11708 << std::setw(4) << pc_offset << " " << std::setw(4) << handler << "\n";
11709 } 11762 }
11710 os << "\n"; 11763 os << "\n";
11711 } 11764 }
11712 11765
11713 os << "RelocInfo (size = " << relocation_size() << ")\n"; 11766 os << "RelocInfo (size = " << relocation_size() << ")\n";
11714 for (RelocIterator it(this); !it.done(); it.next()) { 11767 for (RelocIterator it(this); !it.done(); it.next()) {
11715 it.rinfo()->Print(GetIsolate(), os); 11768 it.rinfo()->Print(GetIsolate(), os);
11716 } 11769 }
11717 os << "\n"; 11770 os << "\n";
11718 11771
(...skipping 5432 matching lines...) Expand 10 before | Expand all | Expand 10 after
17151 CompilationInfo* info) { 17204 CompilationInfo* info) {
17152 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17205 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17153 handle(cell->dependent_code(), info->isolate()), 17206 handle(cell->dependent_code(), info->isolate()),
17154 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17207 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17155 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17208 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17156 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17209 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17157 cell, info->zone()); 17210 cell, info->zone());
17158 } 17211 }
17159 17212
17160 } } // namespace v8::internal 17213 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698