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

Side by Side Diff: src/objects.cc

Issue 19638014: Factor out common code from platform-specific deoptimization. Fix Deoptimizer not to need to partit… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanups post-review. Created 7 years, 5 months 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 | Annotate | Revision Log
« 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 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 11330 matching lines...) Expand 10 before | Expand all | Expand 10 after
11341 bool DependentCode::Contains(DependencyGroup group, Code* code) { 11341 bool DependentCode::Contains(DependencyGroup group, Code* code) {
11342 GroupStartIndexes starts(this); 11342 GroupStartIndexes starts(this);
11343 int number_of_entries = starts.number_of_entries(); 11343 int number_of_entries = starts.number_of_entries();
11344 for (int i = 0; i < number_of_entries; i++) { 11344 for (int i = 0; i < number_of_entries; i++) {
11345 if (object_at(i) == code) return true; 11345 if (object_at(i) == code) return true;
11346 } 11346 }
11347 return false; 11347 return false;
11348 } 11348 }
11349 11349
11350 11350
11351 class DeoptimizeDependentCodeFilter : public OptimizedFunctionFilter {
11352 public:
11353 virtual bool TakeFunction(JSFunction* function) {
11354 return function->code()->marked_for_deoptimization();
11355 }
11356 };
11357
11358
11359 void DependentCode::DeoptimizeDependentCodeGroup( 11351 void DependentCode::DeoptimizeDependentCodeGroup(
11360 Isolate* isolate, 11352 Isolate* isolate,
11361 DependentCode::DependencyGroup group) { 11353 DependentCode::DependencyGroup group) {
11362 DisallowHeapAllocation no_allocation_scope; 11354 DisallowHeapAllocation no_allocation_scope;
11363 DependentCode::GroupStartIndexes starts(this); 11355 DependentCode::GroupStartIndexes starts(this);
11364 int start = starts.at(group); 11356 int start = starts.at(group);
11365 int end = starts.at(group + 1); 11357 int end = starts.at(group + 1);
11366 int code_entries = starts.number_of_entries(); 11358 int code_entries = starts.number_of_entries();
11367 if (start == end) return; 11359 if (start == end) return;
11360
11361 // Collect all the code to deoptimize.
11362 Zone zone(isolate);
11363 ZoneList<Code*> codes(end - start, &zone);
11368 for (int i = start; i < end; i++) { 11364 for (int i = start; i < end; i++) {
11369 if (is_code_at(i)) { 11365 if (is_code_at(i)) {
11370 Code* code = code_at(i); 11366 Code* code = code_at(i);
11371 code->set_marked_for_deoptimization(true); 11367 if (!code->marked_for_deoptimization()) codes.Add(code, &zone);
11372 } else { 11368 } else {
11373 CompilationInfo* info = compilation_info_at(i); 11369 CompilationInfo* info = compilation_info_at(i);
11374 info->AbortDueToDependencyChange(); 11370 info->AbortDueToDependencyChange();
11375 } 11371 }
11376 } 11372 }
11377 // Compact the array by moving all subsequent groups to fill in the new holes. 11373 // Compact the array by moving all subsequent groups to fill in the new holes.
11378 for (int src = end, dst = start; src < code_entries; src++, dst++) { 11374 for (int src = end, dst = start; src < code_entries; src++, dst++) {
11379 copy(src, dst); 11375 copy(src, dst);
11380 } 11376 }
11381 // Now the holes are at the end of the array, zap them for heap-verifier. 11377 // Now the holes are at the end of the array, zap them for heap-verifier.
11382 int removed = end - start; 11378 int removed = end - start;
11383 for (int i = code_entries - removed; i < code_entries; i++) { 11379 for (int i = code_entries - removed; i < code_entries; i++) {
11384 clear_at(i); 11380 clear_at(i);
11385 } 11381 }
11386 set_number_of_entries(group, 0); 11382 set_number_of_entries(group, 0);
11387 DeoptimizeDependentCodeFilter filter; 11383 Deoptimizer::DeoptimizeCodeList(isolate, &codes);
11388 Deoptimizer::DeoptimizeAllFunctionsWith(isolate, &filter);
11389 } 11384 }
11390 11385
11391 11386
11392 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object, 11387 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object,
11393 Handle<Object> value, 11388 Handle<Object> value,
11394 bool skip_hidden_prototypes) { 11389 bool skip_hidden_prototypes) {
11395 #ifdef DEBUG 11390 #ifdef DEBUG
11396 int size = object->Size(); 11391 int size = object->Size();
11397 #endif 11392 #endif
11398 11393
(...skipping 4568 matching lines...) Expand 10 before | Expand all | Expand 10 after
15967 15962
15968 void PropertyCell::AddDependentCode(Handle<Code> code) { 15963 void PropertyCell::AddDependentCode(Handle<Code> code) {
15969 Handle<DependentCode> codes = DependentCode::Insert( 15964 Handle<DependentCode> codes = DependentCode::Insert(
15970 Handle<DependentCode>(dependent_code()), 15965 Handle<DependentCode>(dependent_code()),
15971 DependentCode::kPropertyCellChangedGroup, code); 15966 DependentCode::kPropertyCellChangedGroup, code);
15972 if (*codes != dependent_code()) set_dependent_code(*codes); 15967 if (*codes != dependent_code()) set_dependent_code(*codes);
15973 } 15968 }
15974 15969
15975 15970
15976 } } // namespace v8::internal 15971 } } // namespace v8::internal
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