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 11317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11328 bool DependentCode::Contains(DependencyGroup group, Code* code) { | 11328 bool DependentCode::Contains(DependencyGroup group, Code* code) { |
11329 GroupStartIndexes starts(this); | 11329 GroupStartIndexes starts(this); |
11330 int number_of_entries = starts.number_of_entries(); | 11330 int number_of_entries = starts.number_of_entries(); |
11331 for (int i = 0; i < number_of_entries; i++) { | 11331 for (int i = 0; i < number_of_entries; i++) { |
11332 if (object_at(i) == code) return true; | 11332 if (object_at(i) == code) return true; |
11333 } | 11333 } |
11334 return false; | 11334 return false; |
11335 } | 11335 } |
11336 | 11336 |
11337 | 11337 |
11338 class DeoptimizeDependentCodeFilter : public OptimizedFunctionFilter { | |
11339 public: | |
11340 virtual bool TakeFunction(JSFunction* function) { | |
11341 return function->code()->marked_for_deoptimization(); | |
11342 } | |
11343 }; | |
11344 | |
11345 | |
11346 void DependentCode::DeoptimizeDependentCodeGroup( | 11338 void DependentCode::DeoptimizeDependentCodeGroup( |
11347 Isolate* isolate, | 11339 Isolate* isolate, |
11348 DependentCode::DependencyGroup group) { | 11340 DependentCode::DependencyGroup group) { |
11349 DisallowHeapAllocation no_allocation_scope; | 11341 DisallowHeapAllocation no_allocation_scope; |
11350 DependentCode::GroupStartIndexes starts(this); | 11342 DependentCode::GroupStartIndexes starts(this); |
11351 int start = starts.at(group); | 11343 int start = starts.at(group); |
11352 int end = starts.at(group + 1); | 11344 int end = starts.at(group + 1); |
11353 int code_entries = starts.number_of_entries(); | 11345 int code_entries = starts.number_of_entries(); |
11354 if (start == end) return; | 11346 if (start == end) return; |
11347 | |
11348 // Collect all the code to deoptimize. | |
11349 Zone zone(isolate); | |
11350 ZoneList<Code*> codes(end - start, &zone); | |
11355 for (int i = start; i < end; i++) { | 11351 for (int i = start; i < end; i++) { |
11356 if (is_code_at(i)) { | 11352 if (is_code_at(i)) { |
11357 Code* code = code_at(i); | 11353 Code* code = code_at(i); |
11358 code->set_marked_for_deoptimization(true); | 11354 if (!code->marked_for_deoptimization()) codes.Add(code, &zone); |
ulan
2013/07/22 09:23:08
code->set_marked_for_deoptimization(true) after ad
titzer
2013/07/23 12:41:00
Done.
| |
11359 } else { | 11355 } else { |
11360 CompilationInfo* info = compilation_info_at(i); | 11356 CompilationInfo* info = compilation_info_at(i); |
11361 info->AbortDueToDependencyChange(); | 11357 info->AbortDueToDependencyChange(); |
11362 } | 11358 } |
11363 } | 11359 } |
11364 // Compact the array by moving all subsequent groups to fill in the new holes. | 11360 // Compact the array by moving all subsequent groups to fill in the new holes. |
11365 for (int src = end, dst = start; src < code_entries; src++, dst++) { | 11361 for (int src = end, dst = start; src < code_entries; src++, dst++) { |
11366 copy(src, dst); | 11362 copy(src, dst); |
11367 } | 11363 } |
11368 // Now the holes are at the end of the array, zap them for heap-verifier. | 11364 // Now the holes are at the end of the array, zap them for heap-verifier. |
11369 int removed = end - start; | 11365 int removed = end - start; |
11370 for (int i = code_entries - removed; i < code_entries; i++) { | 11366 for (int i = code_entries - removed; i < code_entries; i++) { |
11371 clear_at(i); | 11367 clear_at(i); |
11372 } | 11368 } |
11373 set_number_of_entries(group, 0); | 11369 set_number_of_entries(group, 0); |
11374 DeoptimizeDependentCodeFilter filter; | 11370 Deoptimizer::DeoptimizeCodeList(isolate, &codes); |
11375 Deoptimizer::DeoptimizeAllFunctionsWith(isolate, &filter); | |
11376 } | 11371 } |
11377 | 11372 |
11378 | 11373 |
11379 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object, | 11374 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object, |
11380 Handle<Object> value, | 11375 Handle<Object> value, |
11381 bool skip_hidden_prototypes) { | 11376 bool skip_hidden_prototypes) { |
11382 #ifdef DEBUG | 11377 #ifdef DEBUG |
11383 int size = object->Size(); | 11378 int size = object->Size(); |
11384 #endif | 11379 #endif |
11385 | 11380 |
(...skipping 4569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15955 | 15950 |
15956 void PropertyCell::AddDependentCode(Handle<Code> code) { | 15951 void PropertyCell::AddDependentCode(Handle<Code> code) { |
15957 Handle<DependentCode> codes = DependentCode::Insert( | 15952 Handle<DependentCode> codes = DependentCode::Insert( |
15958 Handle<DependentCode>(dependent_code()), | 15953 Handle<DependentCode>(dependent_code()), |
15959 DependentCode::kPropertyCellChangedGroup, code); | 15954 DependentCode::kPropertyCellChangedGroup, code); |
15960 if (*codes != dependent_code()) set_dependent_code(*codes); | 15955 if (*codes != dependent_code()) set_dependent_code(*codes); |
15961 } | 15956 } |
15962 | 15957 |
15963 | 15958 |
15964 } } // namespace v8::internal | 15959 } } // namespace v8::internal |
OLD | NEW |