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

Side by Side Diff: src/x64/deoptimizer-x64.cc

Issue 11547015: Use a filter instead of a visitor to deoptimize selected functions in a context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
« src/deoptimizer.h ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 28 matching lines...) Expand all
39 39
40 40
41 const int Deoptimizer::table_entry_size_ = 10; 41 const int Deoptimizer::table_entry_size_ = 10;
42 42
43 43
44 int Deoptimizer::patch_size() { 44 int Deoptimizer::patch_size() {
45 return Assembler::kCallInstructionLength; 45 return Assembler::kCallInstructionLength;
46 } 46 }
47 47
48 48
49 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 49 void Deoptimizer::DeoptimizeFunctionWithPreparedFunctionList(
50 HandleScope scope; 50 JSFunction* function) {
51 Isolate* isolate = function->GetIsolate();
52 HandleScope scope(isolate);
51 AssertNoAllocation no_allocation; 53 AssertNoAllocation no_allocation;
52 54
53 if (!function->IsOptimized()) return; 55 ASSERT(function->IsOptimized());
56 ASSERT(function->FunctionsInFunctionListShareSameCode());
54 57
55 // The optimized code is going to be patched, so we cannot use it 58 // The optimized code is going to be patched, so we cannot use it
56 // any more. Play safe and reset the whole cache. 59 // any more. Play safe and reset the whole cache.
57 function->shared()->ClearOptimizedCodeMap(); 60 function->shared()->ClearOptimizedCodeMap();
58 61
59 // Get the optimized code. 62 // Get the optimized code.
60 Code* code = function->code(); 63 Code* code = function->code();
61 64
62 // Invalidate the relocation information, as it will become invalid by the 65 // Invalidate the relocation information, as it will become invalid by the
63 // code patching below, and is not needed any more. 66 // code patching below, and is not needed any more.
(...skipping 20 matching lines...) Expand all
84 CodePatcher patcher(call_address, Assembler::kCallInstructionLength); 87 CodePatcher patcher(call_address, Assembler::kCallInstructionLength);
85 patcher.masm()->Call(GetDeoptimizationEntry(i, LAZY), RelocInfo::NONE); 88 patcher.masm()->Call(GetDeoptimizationEntry(i, LAZY), RelocInfo::NONE);
86 ASSERT(prev_call_address == NULL || 89 ASSERT(prev_call_address == NULL ||
87 call_address >= prev_call_address + patch_size()); 90 call_address >= prev_call_address + patch_size());
88 ASSERT(call_address + patch_size() <= code->instruction_end()); 91 ASSERT(call_address + patch_size() <= code->instruction_end());
89 #ifdef DEBUG 92 #ifdef DEBUG
90 prev_call_address = call_address; 93 prev_call_address = call_address;
91 #endif 94 #endif
92 } 95 }
93 96
94 Isolate* isolate = code->GetIsolate();
95
96 // Add the deoptimizing code to the list. 97 // Add the deoptimizing code to the list.
97 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); 98 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
98 DeoptimizerData* data = isolate->deoptimizer_data(); 99 DeoptimizerData* data = isolate->deoptimizer_data();
99 node->set_next(data->deoptimizing_code_list_); 100 node->set_next(data->deoptimizing_code_list_);
100 data->deoptimizing_code_list_ = node; 101 data->deoptimizing_code_list_ = node;
101 102
102 // We might be in the middle of incremental marking with compaction. 103 // We might be in the middle of incremental marking with compaction.
103 // Tell collector to treat this code object in a special way and 104 // Tell collector to treat this code object in a special way and
104 // ignore all slots that might have been recorded on it. 105 // ignore all slots that might have been recorded on it.
105 isolate->heap()->mark_compact_collector()->InvalidateCode(code); 106 isolate->heap()->mark_compact_collector()->InvalidateCode(code);
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 } 1094 }
1094 __ bind(&done); 1095 __ bind(&done);
1095 } 1096 }
1096 1097
1097 #undef __ 1098 #undef __
1098 1099
1099 1100
1100 } } // namespace v8::internal 1101 } } // namespace v8::internal
1101 1102
1102 #endif // V8_TARGET_ARCH_X64 1103 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/deoptimizer.h ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698