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

Side by Side Diff: src/objects.cc

Issue 1158563008: [turbofan] Introduce prediction for exception handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Architecture ports. Created 5 years, 6 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
« no previous file with comments | « src/objects.h ('k') | test/unittests/compiler/common-operator-unittest.cc » ('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 <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 8620 matching lines...) Expand 10 before | Expand all | Expand 10 after
8631 innermost_handler = handler_offset; 8631 innermost_handler = handler_offset;
8632 innermost_start = start_offset; 8632 innermost_start = start_offset;
8633 *stack_depth_out = stack_depth; 8633 *stack_depth_out = stack_depth;
8634 } 8634 }
8635 } 8635 }
8636 return innermost_handler; 8636 return innermost_handler;
8637 } 8637 }
8638 8638
8639 8639
8640 // TODO(turbofan): Make sure table is sorted and use binary search. 8640 // TODO(turbofan): Make sure table is sorted and use binary search.
8641 int HandlerTable::LookupReturn(int pc_offset) { 8641 int HandlerTable::LookupReturn(int pc_offset, CatchPrediction* prediction) {
8642 for (int i = 0; i < length(); i += kReturnEntrySize) { 8642 for (int i = 0; i < length(); i += kReturnEntrySize) {
8643 int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); 8643 int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value();
8644 int handler_offset = Smi::cast(get(i + kReturnHandlerIndex))->value(); 8644 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value();
8645 if (pc_offset == return_offset) return handler_offset; 8645 if (pc_offset == return_offset) {
8646 *prediction = HandlerPredictionField::decode(handler_field);
8647 return HandlerOffsetField::decode(handler_field);
8648 }
8646 } 8649 }
8647 return -1; 8650 return -1;
8648 } 8651 }
8649 8652
8650 8653
8651 #ifdef DEBUG 8654 #ifdef DEBUG
8652 bool DescriptorArray::IsEqualTo(DescriptorArray* other) { 8655 bool DescriptorArray::IsEqualTo(DescriptorArray* other) {
8653 if (IsEmpty()) return other->IsEmpty(); 8656 if (IsEmpty()) return other->IsEmpty();
8654 if (other->IsEmpty()) return false; 8657 if (other->IsEmpty()) return false;
8655 if (length() != other->length()) return false; 8658 if (length() != other->length()) return false;
(...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after
11827 int pc_end = Smi::cast(get(i + kRangeEndIndex))->value(); 11830 int pc_end = Smi::cast(get(i + kRangeEndIndex))->value();
11828 int handler = Smi::cast(get(i + kRangeHandlerIndex))->value(); 11831 int handler = Smi::cast(get(i + kRangeHandlerIndex))->value();
11829 int depth = Smi::cast(get(i + kRangeDepthIndex))->value(); 11832 int depth = Smi::cast(get(i + kRangeDepthIndex))->value();
11830 os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end 11833 os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end
11831 << ") -> " << std::setw(4) << handler << " (depth=" << depth << ")\n"; 11834 << ") -> " << std::setw(4) << handler << " (depth=" << depth << ")\n";
11832 } 11835 }
11833 } 11836 }
11834 11837
11835 11838
11836 void HandlerTable::HandlerTableReturnPrint(std::ostream& os) { 11839 void HandlerTable::HandlerTableReturnPrint(std::ostream& os) {
11837 os << " off hdlr\n"; 11840 os << " off hdlr (c)\n";
11838 for (int i = 0; i < length(); i += kReturnEntrySize) { 11841 for (int i = 0; i < length(); i += kReturnEntrySize) {
11839 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); 11842 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value();
11840 int handler = Smi::cast(get(i + kReturnHandlerIndex))->value(); 11843 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value();
11844 int handler_offset = HandlerOffsetField::decode(handler_field);
11845 CatchPrediction prediction = HandlerPredictionField::decode(handler_field);
11841 os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4) 11846 os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4)
11842 << handler << "\n"; 11847 << handler_offset << " (" << prediction << ")\n";
11843 } 11848 }
11844 } 11849 }
11845 11850
11846 11851
11847 const char* Code::ICState2String(InlineCacheState state) { 11852 const char* Code::ICState2String(InlineCacheState state) {
11848 switch (state) { 11853 switch (state) {
11849 case UNINITIALIZED: return "UNINITIALIZED"; 11854 case UNINITIALIZED: return "UNINITIALIZED";
11850 case PREMONOMORPHIC: return "PREMONOMORPHIC"; 11855 case PREMONOMORPHIC: return "PREMONOMORPHIC";
11851 case MONOMORPHIC: return "MONOMORPHIC"; 11856 case MONOMORPHIC: return "MONOMORPHIC";
11852 case PROTOTYPE_FAILURE: 11857 case PROTOTYPE_FAILURE:
(...skipping 5511 matching lines...) Expand 10 before | Expand all | Expand 10 after
17364 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, 17369 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell,
17365 Handle<Object> new_value) { 17370 Handle<Object> new_value) {
17366 if (cell->value() != *new_value) { 17371 if (cell->value() != *new_value) {
17367 cell->set_value(*new_value); 17372 cell->set_value(*new_value);
17368 Isolate* isolate = cell->GetIsolate(); 17373 Isolate* isolate = cell->GetIsolate();
17369 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17374 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17370 isolate, DependentCode::kPropertyCellChangedGroup); 17375 isolate, DependentCode::kPropertyCellChangedGroup);
17371 } 17376 }
17372 } 17377 }
17373 } } // namespace v8::internal 17378 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/unittests/compiler/common-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698