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 10211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10222 #endif | 10222 #endif |
10223 if (data_out) *data_out = handler_data; | 10223 if (data_out) *data_out = handler_data; |
10224 if (prediction_out) *prediction_out = prediction; | 10224 if (prediction_out) *prediction_out = prediction; |
10225 } | 10225 } |
10226 } | 10226 } |
10227 return innermost_handler; | 10227 return innermost_handler; |
10228 } | 10228 } |
10229 | 10229 |
10230 | 10230 |
10231 // TODO(turbofan): Make sure table is sorted and use binary search. | 10231 // TODO(turbofan): Make sure table is sorted and use binary search. |
10232 int HandlerTable::LookupReturn(int pc_offset, CatchPrediction* prediction_out) { | 10232 int HandlerTable::LookupReturn(int pc_offset) { |
10233 for (int i = 0; i < length(); i += kReturnEntrySize) { | 10233 for (int i = 0; i < length(); i += kReturnEntrySize) { |
10234 int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); | 10234 int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); |
10235 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); | 10235 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); |
10236 if (pc_offset == return_offset) { | 10236 if (pc_offset == return_offset) { |
10237 if (prediction_out) { | |
10238 *prediction_out = HandlerPredictionField::decode(handler_field); | |
10239 } | |
10240 return HandlerOffsetField::decode(handler_field); | 10237 return HandlerOffsetField::decode(handler_field); |
10241 } | 10238 } |
10242 } | 10239 } |
10243 return -1; | 10240 return -1; |
10244 } | 10241 } |
10245 | 10242 |
10246 | 10243 |
10247 #ifdef DEBUG | 10244 #ifdef DEBUG |
10248 bool DescriptorArray::IsEqualTo(DescriptorArray* other) { | 10245 bool DescriptorArray::IsEqualTo(DescriptorArray* other) { |
10249 if (IsEmpty()) return other->IsEmpty(); | 10246 if (IsEmpty()) return other->IsEmpty(); |
(...skipping 3466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13716 DisallowHeapAllocation no_gc; | 13713 DisallowHeapAllocation no_gc; |
13717 DCHECK(kind() == FUNCTION); | 13714 DCHECK(kind() == FUNCTION); |
13718 BackEdgeTable back_edges(this, &no_gc); | 13715 BackEdgeTable back_edges(this, &no_gc); |
13719 for (uint32_t i = 0; i < back_edges.length(); i++) { | 13716 for (uint32_t i = 0; i < back_edges.length(); i++) { |
13720 if (back_edges.ast_id(i) == ast_id) return back_edges.pc_offset(i); | 13717 if (back_edges.ast_id(i) == ast_id) return back_edges.pc_offset(i); |
13721 } | 13718 } |
13722 UNREACHABLE(); // We expect to find the back edge. | 13719 UNREACHABLE(); // We expect to find the back edge. |
13723 return 0; | 13720 return 0; |
13724 } | 13721 } |
13725 | 13722 |
| 13723 int Code::LookupRangeInHandlerTable(int code_offset, int* data, |
| 13724 HandlerTable::CatchPrediction* prediction) { |
| 13725 DCHECK(!is_optimized_code()); |
| 13726 HandlerTable* table = HandlerTable::cast(handler_table()); |
| 13727 return table->LookupRange(code_offset, data, prediction); |
| 13728 } |
13726 | 13729 |
13727 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { | 13730 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { |
13728 PatchPlatformCodeAge(isolate, sequence, kNoAgeCodeAge, NO_MARKING_PARITY); | 13731 PatchPlatformCodeAge(isolate, sequence, kNoAgeCodeAge, NO_MARKING_PARITY); |
13729 } | 13732 } |
13730 | 13733 |
13731 | 13734 |
13732 void Code::MarkCodeAsExecuted(byte* sequence, Isolate* isolate) { | 13735 void Code::MarkCodeAsExecuted(byte* sequence, Isolate* isolate) { |
13733 PatchPlatformCodeAge(isolate, sequence, kExecutedOnceCodeAge, | 13736 PatchPlatformCodeAge(isolate, sequence, kExecutedOnceCodeAge, |
13734 NO_MARKING_PARITY); | 13737 NO_MARKING_PARITY); |
13735 } | 13738 } |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14470 #endif | 14473 #endif |
14471 } | 14474 } |
14472 | 14475 |
14473 void BytecodeArray::CopyBytecodesTo(BytecodeArray* to) { | 14476 void BytecodeArray::CopyBytecodesTo(BytecodeArray* to) { |
14474 BytecodeArray* from = this; | 14477 BytecodeArray* from = this; |
14475 DCHECK_EQ(from->length(), to->length()); | 14478 DCHECK_EQ(from->length(), to->length()); |
14476 CopyBytes(to->GetFirstBytecodeAddress(), from->GetFirstBytecodeAddress(), | 14479 CopyBytes(to->GetFirstBytecodeAddress(), from->GetFirstBytecodeAddress(), |
14477 from->length()); | 14480 from->length()); |
14478 } | 14481 } |
14479 | 14482 |
| 14483 int BytecodeArray::LookupRangeInHandlerTable( |
| 14484 int code_offset, int* data, HandlerTable::CatchPrediction* prediction) { |
| 14485 HandlerTable* table = HandlerTable::cast(handler_table()); |
| 14486 code_offset++; // Point after current bytecode. |
| 14487 return table->LookupRange(code_offset, data, prediction); |
| 14488 } |
| 14489 |
14480 // static | 14490 // static |
14481 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { | 14491 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { |
14482 DCHECK(capacity >= 0); | 14492 DCHECK(capacity >= 0); |
14483 array->GetIsolate()->factory()->NewJSArrayStorage( | 14493 array->GetIsolate()->factory()->NewJSArrayStorage( |
14484 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 14494 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
14485 } | 14495 } |
14486 | 14496 |
14487 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { | 14497 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { |
14488 // We should never end in here with a pixel or external array. | 14498 // We should never end in here with a pixel or external array. |
14489 DCHECK(array->AllowsSetLength()); | 14499 DCHECK(array->AllowsSetLength()); |
(...skipping 4537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19027 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 19037 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
19028 PrototypeIterator::END_AT_NULL); | 19038 PrototypeIterator::END_AT_NULL); |
19029 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 19039 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
19030 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 19040 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
19031 } | 19041 } |
19032 return false; | 19042 return false; |
19033 } | 19043 } |
19034 | 19044 |
19035 } // namespace internal | 19045 } // namespace internal |
19036 } // namespace v8 | 19046 } // namespace v8 |
OLD | NEW |