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

Side by Side Diff: src/objects.cc

Issue 2534763003: [Interpreter] Add bytecode aging and use it enable CompilationCache for bytecode (Closed)
Patch Set: Created 4 years 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 | « src/objects.h ('k') | src/objects-inl.h » ('j') | 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 <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 15157 matching lines...) Expand 10 before | Expand all | Expand 10 after
15168 from->length()); 15168 from->length());
15169 } 15169 }
15170 15170
15171 int BytecodeArray::LookupRangeInHandlerTable( 15171 int BytecodeArray::LookupRangeInHandlerTable(
15172 int code_offset, int* data, HandlerTable::CatchPrediction* prediction) { 15172 int code_offset, int* data, HandlerTable::CatchPrediction* prediction) {
15173 HandlerTable* table = HandlerTable::cast(handler_table()); 15173 HandlerTable* table = HandlerTable::cast(handler_table());
15174 code_offset++; // Point after current bytecode. 15174 code_offset++; // Point after current bytecode.
15175 return table->LookupRange(code_offset, data, prediction); 15175 return table->LookupRange(code_offset, data, prediction);
15176 } 15176 }
15177 15177
15178 void BytecodeArray::MakeOlder() {
15179 Age age = bytecode_age();
15180 if (age < kLastBytecodeAge) {
15181 set_bytecode_age(static_cast<Age>(age + 1));
15182 }
15183 DCHECK_GE(age, kFirstBytecodeAge);
15184 DCHECK_LE(age, kLastBytecodeAge);
Michael Starzinger 2016/11/28 14:21:30 nit: Shouldn't these DCHECKs be applied on the _ne
rmcilroy 2016/11/28 14:29:04 Yes the should, updated to check bytecode_age() in
15185 }
15186
15187 bool BytecodeArray::IsOld() const {
15188 return bytecode_age() >= kIsOldBytecodeAge;
15189 }
15190
15178 // static 15191 // static
15179 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { 15192 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) {
15180 DCHECK(capacity >= 0); 15193 DCHECK(capacity >= 0);
15181 array->GetIsolate()->factory()->NewJSArrayStorage( 15194 array->GetIsolate()->factory()->NewJSArrayStorage(
15182 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); 15195 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
15183 } 15196 }
15184 15197
15185 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { 15198 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) {
15186 // We should never end in here with a pixel or external array. 15199 // We should never end in here with a pixel or external array.
15187 DCHECK(array->AllowsSetLength()); 15200 DCHECK(array->AllowsSetLength());
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after
17963 count = Smi::FromInt(count->value() - 1); 17976 count = Smi::FromInt(count->value() - 1);
17964 if (count->value() == 0) { 17977 if (count->value() == 0) {
17965 NoWriteBarrierSet(this, entry_index, the_hole_value); 17978 NoWriteBarrierSet(this, entry_index, the_hole_value);
17966 NoWriteBarrierSet(this, value_index, the_hole_value); 17979 NoWriteBarrierSet(this, value_index, the_hole_value);
17967 ElementRemoved(); 17980 ElementRemoved();
17968 } else { 17981 } else {
17969 NoWriteBarrierSet(this, value_index, count); 17982 NoWriteBarrierSet(this, value_index, count);
17970 } 17983 }
17971 } else if (get(entry_index)->IsFixedArray()) { 17984 } else if (get(entry_index)->IsFixedArray()) {
17972 SharedFunctionInfo* info = SharedFunctionInfo::cast(get(value_index)); 17985 SharedFunctionInfo* info = SharedFunctionInfo::cast(get(value_index));
17973 if (info->code()->kind() != Code::FUNCTION || info->code()->IsOld()) { 17986 bool is_old =
17987 info->IsInterpreted()
17988 ? info->bytecode_array()->IsOld()
17989 : info->code()->kind() != Code::FUNCTION || info->code()->IsOld();
17990 if (is_old) {
17974 NoWriteBarrierSet(this, entry_index, the_hole_value); 17991 NoWriteBarrierSet(this, entry_index, the_hole_value);
17975 NoWriteBarrierSet(this, value_index, the_hole_value); 17992 NoWriteBarrierSet(this, value_index, the_hole_value);
17976 ElementRemoved(); 17993 ElementRemoved();
17977 } 17994 }
17978 } 17995 }
17979 } 17996 }
17980 } 17997 }
17981 17998
17982 17999
17983 void CompilationCacheTable::Remove(Object* value) { 18000 void CompilationCacheTable::Remove(Object* value) {
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after
20439 // depend on this. 20456 // depend on this.
20440 return DICTIONARY_ELEMENTS; 20457 return DICTIONARY_ELEMENTS;
20441 } 20458 }
20442 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20459 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20443 return kind; 20460 return kind;
20444 } 20461 }
20445 } 20462 }
20446 20463
20447 } // namespace internal 20464 } // namespace internal
20448 } // namespace v8 20465 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698