| 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 <memory> | 9 #include <memory> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 10626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10637 int innermost_start = std::numeric_limits<int>::min(); | 10637 int innermost_start = std::numeric_limits<int>::min(); |
| 10638 int innermost_end = std::numeric_limits<int>::max(); | 10638 int innermost_end = std::numeric_limits<int>::max(); |
| 10639 #endif | 10639 #endif |
| 10640 for (int i = 0; i < length(); i += kRangeEntrySize) { | 10640 for (int i = 0; i < length(); i += kRangeEntrySize) { |
| 10641 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); | 10641 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); |
| 10642 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); | 10642 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); |
| 10643 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); | 10643 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); |
| 10644 int handler_offset = HandlerOffsetField::decode(handler_field); | 10644 int handler_offset = HandlerOffsetField::decode(handler_field); |
| 10645 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | 10645 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); |
| 10646 int handler_data = Smi::cast(get(i + kRangeDataIndex))->value(); | 10646 int handler_data = Smi::cast(get(i + kRangeDataIndex))->value(); |
| 10647 if (pc_offset > start_offset && pc_offset <= end_offset) { | 10647 if (pc_offset >= start_offset && pc_offset < end_offset) { |
| 10648 DCHECK_GE(start_offset, innermost_start); | 10648 DCHECK_GE(start_offset, innermost_start); |
| 10649 DCHECK_LT(end_offset, innermost_end); | 10649 DCHECK_LT(end_offset, innermost_end); |
| 10650 innermost_handler = handler_offset; | 10650 innermost_handler = handler_offset; |
| 10651 #ifdef DEBUG | 10651 #ifdef DEBUG |
| 10652 innermost_start = start_offset; | 10652 innermost_start = start_offset; |
| 10653 innermost_end = end_offset; | 10653 innermost_end = end_offset; |
| 10654 #endif | 10654 #endif |
| 10655 if (data_out) *data_out = handler_data; | 10655 if (data_out) *data_out = handler_data; |
| 10656 if (prediction_out) *prediction_out = prediction; | 10656 if (prediction_out) *prediction_out = prediction; |
| 10657 } | 10657 } |
| (...skipping 4499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15157 #endif | 15157 #endif |
| 15158 } | 15158 } |
| 15159 | 15159 |
| 15160 void BytecodeArray::CopyBytecodesTo(BytecodeArray* to) { | 15160 void BytecodeArray::CopyBytecodesTo(BytecodeArray* to) { |
| 15161 BytecodeArray* from = this; | 15161 BytecodeArray* from = this; |
| 15162 DCHECK_EQ(from->length(), to->length()); | 15162 DCHECK_EQ(from->length(), to->length()); |
| 15163 CopyBytes(to->GetFirstBytecodeAddress(), from->GetFirstBytecodeAddress(), | 15163 CopyBytes(to->GetFirstBytecodeAddress(), from->GetFirstBytecodeAddress(), |
| 15164 from->length()); | 15164 from->length()); |
| 15165 } | 15165 } |
| 15166 | 15166 |
| 15167 int BytecodeArray::LookupRangeInHandlerTable( | |
| 15168 int code_offset, int* data, HandlerTable::CatchPrediction* prediction) { | |
| 15169 HandlerTable* table = HandlerTable::cast(handler_table()); | |
| 15170 code_offset++; // Point after current bytecode. | |
| 15171 return table->LookupRange(code_offset, data, prediction); | |
| 15172 } | |
| 15173 | |
| 15174 // static | 15167 // static |
| 15175 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { | 15168 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { |
| 15176 DCHECK(capacity >= 0); | 15169 DCHECK(capacity >= 0); |
| 15177 array->GetIsolate()->factory()->NewJSArrayStorage( | 15170 array->GetIsolate()->factory()->NewJSArrayStorage( |
| 15178 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 15171 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
| 15179 } | 15172 } |
| 15180 | 15173 |
| 15181 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { | 15174 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { |
| 15182 // We should never end in here with a pixel or external array. | 15175 // We should never end in here with a pixel or external array. |
| 15183 DCHECK(array->AllowsSetLength()); | 15176 DCHECK(array->AllowsSetLength()); |
| (...skipping 5251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20435 // depend on this. | 20428 // depend on this. |
| 20436 return DICTIONARY_ELEMENTS; | 20429 return DICTIONARY_ELEMENTS; |
| 20437 } | 20430 } |
| 20438 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20431 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
| 20439 return kind; | 20432 return kind; |
| 20440 } | 20433 } |
| 20441 } | 20434 } |
| 20442 | 20435 |
| 20443 } // namespace internal | 20436 } // namespace internal |
| 20444 } // namespace v8 | 20437 } // namespace v8 |
| OLD | NEW |