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

Side by Side Diff: src/objects.cc

Issue 1639743002: Simplify HandlerTable::LookupRange search. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10933 matching lines...) Expand 10 before | Expand all | Expand 10 after
10944 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( 10944 Handle<FixedArray> literals = isolate->factory()->NewFixedArray(
10945 number_of_literals + kFirstLiteralIndex, pretenure); 10945 number_of_literals + kFirstLiteralIndex, pretenure);
10946 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); 10946 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals);
10947 casted_literals->set_feedback_vector(*vector); 10947 casted_literals->set_feedback_vector(*vector);
10948 return casted_literals; 10948 return casted_literals;
10949 } 10949 }
10950 10950
10951 10951
10952 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, 10952 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out,
10953 CatchPrediction* prediction_out) { 10953 CatchPrediction* prediction_out) {
10954 int innermost_handler = -1, innermost_start = -1; 10954 int innermost_handler = -1;
10955 #ifdef DEBUG 10955 #ifdef DEBUG
10956 // Assuming that ranges are well nested, we don't need to track the innermost 10956 // Assuming that ranges are well nested, we don't need to track the innermost
10957 // end offset. This is just to verify that the table is actually well nested. 10957 // offsets. This is just to verify that the table is actually well nested.
10958 int innermost_start = std::numeric_limits<int>::min();
10958 int innermost_end = std::numeric_limits<int>::max(); 10959 int innermost_end = std::numeric_limits<int>::max();
10959 #endif 10960 #endif
10960 for (int i = 0; i < length(); i += kRangeEntrySize) { 10961 for (int i = 0; i < length(); i += kRangeEntrySize) {
10961 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); 10962 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value();
10962 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); 10963 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value();
10963 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); 10964 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value();
10964 int handler_offset = HandlerOffsetField::decode(handler_field); 10965 int handler_offset = HandlerOffsetField::decode(handler_field);
10965 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); 10966 CatchPrediction prediction = HandlerPredictionField::decode(handler_field);
10966 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); 10967 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value();
10967 if (pc_offset > start_offset && pc_offset <= end_offset) { 10968 if (pc_offset > start_offset && pc_offset <= end_offset) {
10968 if (start_offset < innermost_start) continue; 10969 DCHECK_GE(start_offset, innermost_start);
10969 DCHECK_LT(end_offset, innermost_end); 10970 DCHECK_LT(end_offset, innermost_end);
10970 innermost_handler = handler_offset; 10971 innermost_handler = handler_offset;
10972 #ifdef DEBUG
10971 innermost_start = start_offset; 10973 innermost_start = start_offset;
10972 #ifdef DEBUG
10973 innermost_end = end_offset; 10974 innermost_end = end_offset;
10974 #endif 10975 #endif
10975 *stack_depth_out = stack_depth; 10976 *stack_depth_out = stack_depth;
10976 if (prediction_out) *prediction_out = prediction; 10977 if (prediction_out) *prediction_out = prediction;
10977 } 10978 }
10978 } 10979 }
10979 return innermost_handler; 10980 return innermost_handler;
10980 } 10981 }
10981 10982
10982 10983
(...skipping 8761 matching lines...) Expand 10 before | Expand all | Expand 10 after
19744 if (cell->value() != *new_value) { 19745 if (cell->value() != *new_value) {
19745 cell->set_value(*new_value); 19746 cell->set_value(*new_value);
19746 Isolate* isolate = cell->GetIsolate(); 19747 Isolate* isolate = cell->GetIsolate();
19747 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19748 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19748 isolate, DependentCode::kPropertyCellChangedGroup); 19749 isolate, DependentCode::kPropertyCellChangedGroup);
19749 } 19750 }
19750 } 19751 }
19751 19752
19752 } // namespace internal 19753 } // namespace internal
19753 } // namespace v8 19754 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698