Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 8600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8611 if (number_of_deopt_points == 0) { | 8611 if (number_of_deopt_points == 0) { |
| 8612 result = isolate->factory()->empty_fixed_array(); | 8612 result = isolate->factory()->empty_fixed_array(); |
| 8613 } else { | 8613 } else { |
| 8614 result = isolate->factory()->NewFixedArray( | 8614 result = isolate->factory()->NewFixedArray( |
| 8615 LengthOfFixedArray(number_of_deopt_points), pretenure); | 8615 LengthOfFixedArray(number_of_deopt_points), pretenure); |
| 8616 } | 8616 } |
| 8617 return Handle<DeoptimizationOutputData>::cast(result); | 8617 return Handle<DeoptimizationOutputData>::cast(result); |
| 8618 } | 8618 } |
| 8619 | 8619 |
| 8620 | 8620 |
| 8621 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out) { | 8621 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, |
| 8622 CatchPrediction* prediction_out) { | |
| 8622 int innermost_handler = -1, innermost_start = -1; | 8623 int innermost_handler = -1, innermost_start = -1; |
| 8623 for (int i = 0; i < length(); i += kRangeEntrySize) { | 8624 for (int i = 0; i < length(); i += kRangeEntrySize) { |
| 8624 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); | 8625 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); |
| 8625 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); | 8626 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); |
| 8626 int handler_offset = Smi::cast(get(i + kRangeHandlerIndex))->value(); | 8627 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); |
| 8628 int handler_offset = HandlerOffsetField::decode(handler_field); | |
| 8629 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | |
| 8627 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); | 8630 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); |
| 8628 if (pc_offset > start_offset && pc_offset <= end_offset) { | 8631 if (pc_offset > start_offset && pc_offset <= end_offset) { |
| 8629 DCHECK_NE(start_offset, innermost_start); | 8632 DCHECK_NE(start_offset, innermost_start); |
| 8630 if (start_offset < innermost_start) continue; | 8633 if (start_offset < innermost_start) continue; |
| 8631 innermost_handler = handler_offset; | 8634 innermost_handler = handler_offset; |
| 8632 innermost_start = start_offset; | 8635 innermost_start = start_offset; |
| 8633 *stack_depth_out = stack_depth; | 8636 *stack_depth_out = stack_depth; |
| 8637 if (prediction_out) *prediction_out = prediction; | |
| 8634 } | 8638 } |
| 8635 } | 8639 } |
| 8636 return innermost_handler; | 8640 return innermost_handler; |
| 8637 } | 8641 } |
| 8638 | 8642 |
| 8639 | 8643 |
| 8640 // TODO(turbofan): Make sure table is sorted and use binary search. | 8644 // TODO(turbofan): Make sure table is sorted and use binary search. |
| 8641 int HandlerTable::LookupReturn(int pc_offset, CatchPrediction* prediction) { | 8645 int HandlerTable::LookupReturn(int pc_offset, CatchPrediction* prediction_out) { |
| 8642 for (int i = 0; i < length(); i += kReturnEntrySize) { | 8646 for (int i = 0; i < length(); i += kReturnEntrySize) { |
| 8643 int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); | 8647 int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); |
| 8644 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); | 8648 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); |
| 8645 if (pc_offset == return_offset) { | 8649 if (pc_offset == return_offset) { |
| 8646 *prediction = HandlerPredictionField::decode(handler_field); | 8650 if (prediction_out) { |
| 8651 *prediction_out = HandlerPredictionField::decode(handler_field); | |
| 8652 } | |
| 8647 return HandlerOffsetField::decode(handler_field); | 8653 return HandlerOffsetField::decode(handler_field); |
| 8648 } | 8654 } |
| 8649 } | 8655 } |
| 8650 return -1; | 8656 return -1; |
| 8651 } | 8657 } |
| 8652 | 8658 |
| 8653 | 8659 |
| 8654 #ifdef DEBUG | 8660 #ifdef DEBUG |
| 8655 bool DescriptorArray::IsEqualTo(DescriptorArray* other) { | 8661 bool DescriptorArray::IsEqualTo(DescriptorArray* other) { |
| 8656 if (IsEmpty()) return other->IsEmpty(); | 8662 if (IsEmpty()) return other->IsEmpty(); |
| (...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11828 FullCodeGenerator::StateField::decode(pc_and_state)) << "\n"; | 11834 FullCodeGenerator::StateField::decode(pc_and_state)) << "\n"; |
| 11829 } | 11835 } |
| 11830 } | 11836 } |
| 11831 | 11837 |
| 11832 | 11838 |
| 11833 void HandlerTable::HandlerTableRangePrint(std::ostream& os) { | 11839 void HandlerTable::HandlerTableRangePrint(std::ostream& os) { |
| 11834 os << " from to hdlr\n"; | 11840 os << " from to hdlr\n"; |
| 11835 for (int i = 0; i < length(); i += kRangeEntrySize) { | 11841 for (int i = 0; i < length(); i += kRangeEntrySize) { |
| 11836 int pc_start = Smi::cast(get(i + kRangeStartIndex))->value(); | 11842 int pc_start = Smi::cast(get(i + kRangeStartIndex))->value(); |
| 11837 int pc_end = Smi::cast(get(i + kRangeEndIndex))->value(); | 11843 int pc_end = Smi::cast(get(i + kRangeEndIndex))->value(); |
| 11838 int handler = Smi::cast(get(i + kRangeHandlerIndex))->value(); | 11844 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); |
| 11845 int handler_offset = HandlerOffsetField::decode(handler_field); | |
| 11846 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | |
| 11839 int depth = Smi::cast(get(i + kRangeDepthIndex))->value(); | 11847 int depth = Smi::cast(get(i + kRangeDepthIndex))->value(); |
| 11840 os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end | 11848 os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end |
| 11841 << ") -> " << std::setw(4) << handler << " (depth=" << depth << ")\n"; | 11849 << ") -> " << std::setw(4) << handler_offset |
| 11850 << " (prediction=" << prediction << ", depth=" << depth << ")\n"; | |
| 11842 } | 11851 } |
| 11843 } | 11852 } |
| 11844 | 11853 |
| 11845 | 11854 |
| 11846 void HandlerTable::HandlerTableReturnPrint(std::ostream& os) { | 11855 void HandlerTable::HandlerTableReturnPrint(std::ostream& os) { |
| 11847 os << " off hdlr (c)\n"; | 11856 os << " off hdlr (c)\n"; |
|
Michael Starzinger
2015/05/29 09:00:55
nit: I tried to be smart with the "(c)" in the hea
| |
| 11848 for (int i = 0; i < length(); i += kReturnEntrySize) { | 11857 for (int i = 0; i < length(); i += kReturnEntrySize) { |
| 11849 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); | 11858 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); |
| 11850 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); | 11859 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); |
| 11851 int handler_offset = HandlerOffsetField::decode(handler_field); | 11860 int handler_offset = HandlerOffsetField::decode(handler_field); |
| 11852 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | 11861 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); |
| 11853 os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4) | 11862 os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4) |
| 11854 << handler_offset << " (" << prediction << ")\n"; | 11863 << handler_offset << " (prediction=" << prediction << ")\n"; |
| 11855 } | 11864 } |
| 11856 } | 11865 } |
| 11857 | 11866 |
| 11858 | 11867 |
| 11859 const char* Code::ICState2String(InlineCacheState state) { | 11868 const char* Code::ICState2String(InlineCacheState state) { |
| 11860 switch (state) { | 11869 switch (state) { |
| 11861 case UNINITIALIZED: return "UNINITIALIZED"; | 11870 case UNINITIALIZED: return "UNINITIALIZED"; |
| 11862 case PREMONOMORPHIC: return "PREMONOMORPHIC"; | 11871 case PREMONOMORPHIC: return "PREMONOMORPHIC"; |
| 11863 case MONOMORPHIC: return "MONOMORPHIC"; | 11872 case MONOMORPHIC: return "MONOMORPHIC"; |
| 11864 case PROTOTYPE_FAILURE: | 11873 case PROTOTYPE_FAILURE: |
| (...skipping 5511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17376 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17385 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
| 17377 Handle<Object> new_value) { | 17386 Handle<Object> new_value) { |
| 17378 if (cell->value() != *new_value) { | 17387 if (cell->value() != *new_value) { |
| 17379 cell->set_value(*new_value); | 17388 cell->set_value(*new_value); |
| 17380 Isolate* isolate = cell->GetIsolate(); | 17389 Isolate* isolate = cell->GetIsolate(); |
| 17381 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17390 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 17382 isolate, DependentCode::kPropertyCellChangedGroup); | 17391 isolate, DependentCode::kPropertyCellChangedGroup); |
| 17383 } | 17392 } |
| 17384 } | 17393 } |
| 17385 } } // namespace v8::internal | 17394 } } // namespace v8::internal |
| OLD | NEW |