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 15125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15136 #endif | 15136 #endif |
15137 } | 15137 } |
15138 | 15138 |
15139 void BytecodeArray::CopyBytecodesTo(BytecodeArray* to) { | 15139 void BytecodeArray::CopyBytecodesTo(BytecodeArray* to) { |
15140 BytecodeArray* from = this; | 15140 BytecodeArray* from = this; |
15141 DCHECK_EQ(from->length(), to->length()); | 15141 DCHECK_EQ(from->length(), to->length()); |
15142 CopyBytes(to->GetFirstBytecodeAddress(), from->GetFirstBytecodeAddress(), | 15142 CopyBytes(to->GetFirstBytecodeAddress(), from->GetFirstBytecodeAddress(), |
15143 from->length()); | 15143 from->length()); |
15144 } | 15144 } |
15145 | 15145 |
| 15146 void BytecodeArray::MakeOlder() { |
| 15147 Age age = bytecode_age(); |
| 15148 if (age < kLastBytecodeAge) { |
| 15149 set_bytecode_age(static_cast<Age>(age + 1)); |
| 15150 } |
| 15151 DCHECK_GE(bytecode_age(), kFirstBytecodeAge); |
| 15152 DCHECK_LE(bytecode_age(), kLastBytecodeAge); |
| 15153 } |
| 15154 |
| 15155 bool BytecodeArray::IsOld() const { |
| 15156 return bytecode_age() >= kIsOldBytecodeAge; |
| 15157 } |
| 15158 |
15146 // static | 15159 // static |
15147 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { | 15160 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { |
15148 DCHECK(capacity >= 0); | 15161 DCHECK(capacity >= 0); |
15149 array->GetIsolate()->factory()->NewJSArrayStorage( | 15162 array->GetIsolate()->factory()->NewJSArrayStorage( |
15150 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 15163 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
15151 } | 15164 } |
15152 | 15165 |
15153 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { | 15166 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { |
15154 // We should never end in here with a pixel or external array. | 15167 // We should never end in here with a pixel or external array. |
15155 DCHECK(array->AllowsSetLength()); | 15168 DCHECK(array->AllowsSetLength()); |
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18023 count = Smi::FromInt(count->value() - 1); | 18036 count = Smi::FromInt(count->value() - 1); |
18024 if (count->value() == 0) { | 18037 if (count->value() == 0) { |
18025 NoWriteBarrierSet(this, entry_index, the_hole_value); | 18038 NoWriteBarrierSet(this, entry_index, the_hole_value); |
18026 NoWriteBarrierSet(this, value_index, the_hole_value); | 18039 NoWriteBarrierSet(this, value_index, the_hole_value); |
18027 ElementRemoved(); | 18040 ElementRemoved(); |
18028 } else { | 18041 } else { |
18029 NoWriteBarrierSet(this, value_index, count); | 18042 NoWriteBarrierSet(this, value_index, count); |
18030 } | 18043 } |
18031 } else if (get(entry_index)->IsFixedArray()) { | 18044 } else if (get(entry_index)->IsFixedArray()) { |
18032 SharedFunctionInfo* info = SharedFunctionInfo::cast(get(value_index)); | 18045 SharedFunctionInfo* info = SharedFunctionInfo::cast(get(value_index)); |
18033 if (info->code()->kind() != Code::FUNCTION || info->code()->IsOld()) { | 18046 bool is_old = |
| 18047 info->IsInterpreted() |
| 18048 ? info->bytecode_array()->IsOld() |
| 18049 : info->code()->kind() != Code::FUNCTION || info->code()->IsOld(); |
| 18050 if (is_old) { |
18034 NoWriteBarrierSet(this, entry_index, the_hole_value); | 18051 NoWriteBarrierSet(this, entry_index, the_hole_value); |
18035 NoWriteBarrierSet(this, value_index, the_hole_value); | 18052 NoWriteBarrierSet(this, value_index, the_hole_value); |
18036 ElementRemoved(); | 18053 ElementRemoved(); |
18037 } | 18054 } |
18038 } | 18055 } |
18039 } | 18056 } |
18040 } | 18057 } |
18041 | 18058 |
18042 | 18059 |
18043 void CompilationCacheTable::Remove(Object* value) { | 18060 void CompilationCacheTable::Remove(Object* value) { |
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20499 // depend on this. | 20516 // depend on this. |
20500 return DICTIONARY_ELEMENTS; | 20517 return DICTIONARY_ELEMENTS; |
20501 } | 20518 } |
20502 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20519 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20503 return kind; | 20520 return kind; |
20504 } | 20521 } |
20505 } | 20522 } |
20506 | 20523 |
20507 } // namespace internal | 20524 } // namespace internal |
20508 } // namespace v8 | 20525 } // namespace v8 |
OLD | NEW |