| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 10959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10970 Handle<TypeFeedbackVector> vector, | 10970 Handle<TypeFeedbackVector> vector, |
| 10971 int number_of_literals, | 10971 int number_of_literals, |
| 10972 PretenureFlag pretenure) { | 10972 PretenureFlag pretenure) { |
| 10973 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( | 10973 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( |
| 10974 number_of_literals + kFirstLiteralIndex, pretenure); | 10974 number_of_literals + kFirstLiteralIndex, pretenure); |
| 10975 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); | 10975 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); |
| 10976 casted_literals->set_feedback_vector(*vector); | 10976 casted_literals->set_feedback_vector(*vector); |
| 10977 return casted_literals; | 10977 return casted_literals; |
| 10978 } | 10978 } |
| 10979 | 10979 |
| 10980 | 10980 int HandlerTable::LookupRange(int pc_offset, int* data_out, |
| 10981 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, | |
| 10982 CatchPrediction* prediction_out) { | 10981 CatchPrediction* prediction_out) { |
| 10983 int innermost_handler = -1; | 10982 int innermost_handler = -1; |
| 10984 #ifdef DEBUG | 10983 #ifdef DEBUG |
| 10985 // Assuming that ranges are well nested, we don't need to track the innermost | 10984 // Assuming that ranges are well nested, we don't need to track the innermost |
| 10986 // offsets. This is just to verify that the table is actually well nested. | 10985 // offsets. This is just to verify that the table is actually well nested. |
| 10987 int innermost_start = std::numeric_limits<int>::min(); | 10986 int innermost_start = std::numeric_limits<int>::min(); |
| 10988 int innermost_end = std::numeric_limits<int>::max(); | 10987 int innermost_end = std::numeric_limits<int>::max(); |
| 10989 #endif | 10988 #endif |
| 10990 for (int i = 0; i < length(); i += kRangeEntrySize) { | 10989 for (int i = 0; i < length(); i += kRangeEntrySize) { |
| 10991 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); | 10990 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); |
| 10992 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); | 10991 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); |
| 10993 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); | 10992 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); |
| 10994 int handler_offset = HandlerOffsetField::decode(handler_field); | 10993 int handler_offset = HandlerOffsetField::decode(handler_field); |
| 10995 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | 10994 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); |
| 10996 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); | 10995 int handler_data = Smi::cast(get(i + kRangeDataIndex))->value(); |
| 10997 if (pc_offset > start_offset && pc_offset <= end_offset) { | 10996 if (pc_offset > start_offset && pc_offset <= end_offset) { |
| 10998 DCHECK_GE(start_offset, innermost_start); | 10997 DCHECK_GE(start_offset, innermost_start); |
| 10999 DCHECK_LT(end_offset, innermost_end); | 10998 DCHECK_LT(end_offset, innermost_end); |
| 11000 innermost_handler = handler_offset; | 10999 innermost_handler = handler_offset; |
| 11001 #ifdef DEBUG | 11000 #ifdef DEBUG |
| 11002 innermost_start = start_offset; | 11001 innermost_start = start_offset; |
| 11003 innermost_end = end_offset; | 11002 innermost_end = end_offset; |
| 11004 #endif | 11003 #endif |
| 11005 *stack_depth_out = stack_depth; | 11004 if (data_out) *data_out = handler_data; |
| 11006 if (prediction_out) *prediction_out = prediction; | 11005 if (prediction_out) *prediction_out = prediction; |
| 11007 } | 11006 } |
| 11008 } | 11007 } |
| 11009 return innermost_handler; | 11008 return innermost_handler; |
| 11010 } | 11009 } |
| 11011 | 11010 |
| 11012 | 11011 |
| 11013 // TODO(turbofan): Make sure table is sorted and use binary search. | 11012 // TODO(turbofan): Make sure table is sorted and use binary search. |
| 11014 int HandlerTable::LookupReturn(int pc_offset, CatchPrediction* prediction_out) { | 11013 int HandlerTable::LookupReturn(int pc_offset, CatchPrediction* prediction_out) { |
| 11015 for (int i = 0; i < length(); i += kReturnEntrySize) { | 11014 for (int i = 0; i < length(); i += kReturnEntrySize) { |
| (...skipping 3808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14824 | 14823 |
| 14825 | 14824 |
| 14826 void HandlerTable::HandlerTableRangePrint(std::ostream& os) { | 14825 void HandlerTable::HandlerTableRangePrint(std::ostream& os) { |
| 14827 os << " from to hdlr\n"; | 14826 os << " from to hdlr\n"; |
| 14828 for (int i = 0; i < length(); i += kRangeEntrySize) { | 14827 for (int i = 0; i < length(); i += kRangeEntrySize) { |
| 14829 int pc_start = Smi::cast(get(i + kRangeStartIndex))->value(); | 14828 int pc_start = Smi::cast(get(i + kRangeStartIndex))->value(); |
| 14830 int pc_end = Smi::cast(get(i + kRangeEndIndex))->value(); | 14829 int pc_end = Smi::cast(get(i + kRangeEndIndex))->value(); |
| 14831 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); | 14830 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); |
| 14832 int handler_offset = HandlerOffsetField::decode(handler_field); | 14831 int handler_offset = HandlerOffsetField::decode(handler_field); |
| 14833 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | 14832 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); |
| 14834 int depth = Smi::cast(get(i + kRangeDepthIndex))->value(); | 14833 int data = Smi::cast(get(i + kRangeDataIndex))->value(); |
| 14835 os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end | 14834 os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end |
| 14836 << ") -> " << std::setw(4) << handler_offset | 14835 << ") -> " << std::setw(4) << handler_offset |
| 14837 << " (prediction=" << prediction << ", depth=" << depth << ")\n"; | 14836 << " (prediction=" << prediction << ", data=" << data << ")\n"; |
| 14838 } | 14837 } |
| 14839 } | 14838 } |
| 14840 | 14839 |
| 14841 | 14840 |
| 14842 void HandlerTable::HandlerTableReturnPrint(std::ostream& os) { | 14841 void HandlerTable::HandlerTableReturnPrint(std::ostream& os) { |
| 14843 os << " off hdlr (c)\n"; | 14842 os << " off hdlr (c)\n"; |
| 14844 for (int i = 0; i < length(); i += kReturnEntrySize) { | 14843 for (int i = 0; i < length(); i += kReturnEntrySize) { |
| 14845 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); | 14844 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); |
| 14846 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); | 14845 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); |
| 14847 int handler_offset = HandlerOffsetField::decode(handler_field); | 14846 int handler_offset = HandlerOffsetField::decode(handler_field); |
| (...skipping 4952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19800 if (cell->value() != *new_value) { | 19799 if (cell->value() != *new_value) { |
| 19801 cell->set_value(*new_value); | 19800 cell->set_value(*new_value); |
| 19802 Isolate* isolate = cell->GetIsolate(); | 19801 Isolate* isolate = cell->GetIsolate(); |
| 19803 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19802 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19804 isolate, DependentCode::kPropertyCellChangedGroup); | 19803 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19805 } | 19804 } |
| 19806 } | 19805 } |
| 19807 | 19806 |
| 19808 } // namespace internal | 19807 } // namespace internal |
| 19809 } // namespace v8 | 19808 } // namespace v8 |
| OLD | NEW |