OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 9016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9027 Code* code = Code::cast(code_map->get(index)); | 9027 Code* code = Code::cast(code_map->get(index)); |
9028 ASSERT(code != NULL); | 9028 ASSERT(code != NULL); |
9029 ASSERT(function->context()->native_context() == code_map->get(index - 1)); | 9029 ASSERT(function->context()->native_context() == code_map->get(index - 1)); |
9030 function->ReplaceCode(code); | 9030 function->ReplaceCode(code); |
9031 } | 9031 } |
9032 | 9032 |
9033 | 9033 |
9034 void SharedFunctionInfo::ClearOptimizedCodeMap(const char* reason) { | 9034 void SharedFunctionInfo::ClearOptimizedCodeMap(const char* reason) { |
9035 if (!optimized_code_map()->IsSmi()) { | 9035 if (!optimized_code_map()->IsSmi()) { |
9036 if (FLAG_trace_opt) { | 9036 if (FLAG_trace_opt) { |
9037 PrintF("[clearing optimizing code map (%s) for ", reason); | 9037 PrintF("[clearing entire optimizing code map (%s) for ", reason); |
9038 ShortPrint(); | 9038 ShortPrint(); |
9039 PrintF("]\n"); | 9039 PrintF("]\n"); |
9040 } | 9040 } |
9041 set_optimized_code_map(Smi::FromInt(0)); | 9041 set_optimized_code_map(Smi::FromInt(0)); |
9042 } | 9042 } |
9043 } | 9043 } |
9044 | 9044 |
9045 | 9045 |
9046 void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code, | |
9047 const char* reason) { | |
9048 if (optimized_code_map()->IsSmi()) return; | |
9049 | |
9050 int i; | |
9051 bool removed_entry = false; | |
9052 FixedArray* code_map = FixedArray::cast(optimized_code_map()); | |
9053 for (i = 0; i < code_map->length(); i += kEntryLength) { | |
9054 ASSERT(code_map->get(i)->IsNativeContext()); | |
9055 if (Code::cast(code_map->get(i + 1)) == optimized_code) { | |
9056 if (FLAG_trace_opt) { | |
9057 PrintF("[clearing optimizing code map (%s) for ", reason); | |
9058 ShortPrint(); | |
9059 PrintF("]\n"); | |
9060 } | |
9061 removed_entry = true; | |
9062 break; | |
9063 } | |
9064 } | |
9065 while (i < (code_map->length() - kEntryLength)) { | |
9066 code_map->set(i, code_map->get(i + 1 + kEntryLength)); | |
Michael Starzinger
2013/05/13 14:26:46
The indices look suspiciously off in this loop!
danno
2013/05/13 15:23:10
Done.
| |
9067 code_map->set(i + 1, code_map->get(i + 2 + kEntryLength)); | |
9068 code_map->set(i + 2, code_map->get(i + 3 + kEntryLength)); | |
9069 i += kEntryLength; | |
9070 } | |
9071 if (removed_entry) { | |
9072 Heap* heap = GetHeap(); | |
9073 int new_length = code_map->length() - kEntryLength; | |
9074 if (new_length == 0) { | |
9075 ClearOptimizedCodeMap(reason); | |
9076 return; | |
9077 } | |
9078 Address filler_start = reinterpret_cast<Address>( | |
9079 code_map->GetFirstElementAddress() + new_length); | |
9080 heap->CreateFillerObjectAt(filler_start, | |
Michael Starzinger
2013/05/13 14:26:46
This will destroy live-bytes count if incremental
danno
2013/05/13 15:23:10
Done.
danno
2013/05/13 15:23:10
Oh, this is much better! Thanks!
On 2013/05/13 14:
| |
9081 kEntryLength * kPointerSize); | |
9082 code_map->set_length(new_length); | |
9083 } | |
9084 } | |
9085 | |
9086 | |
9046 bool JSFunction::CompileLazy(Handle<JSFunction> function, | 9087 bool JSFunction::CompileLazy(Handle<JSFunction> function, |
9047 ClearExceptionFlag flag) { | 9088 ClearExceptionFlag flag) { |
9048 bool result = true; | 9089 bool result = true; |
9049 if (function->shared()->is_compiled()) { | 9090 if (function->shared()->is_compiled()) { |
9050 function->ReplaceCode(function->shared()->code()); | 9091 function->ReplaceCode(function->shared()->code()); |
9051 function->shared()->set_code_age(0); | 9092 function->shared()->set_code_age(0); |
9052 } else { | 9093 } else { |
9053 ASSERT(function->shared()->allows_lazy_compilation()); | 9094 ASSERT(function->shared()->allows_lazy_compilation()); |
9054 CompilationInfoWithZone info(function); | 9095 CompilationInfoWithZone info(function); |
9055 result = CompileLazyHelper(&info, flag); | 9096 result = CompileLazyHelper(&info, flag); |
(...skipping 6298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15354 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 15395 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
15355 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 15396 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
15356 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 15397 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
15357 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 15398 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
15358 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 15399 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
15359 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 15400 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
15360 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 15401 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
15361 } | 15402 } |
15362 | 15403 |
15363 } } // namespace v8::internal | 15404 } } // namespace v8::internal |
OLD | NEW |