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

Side by Side Diff: src/mips/deoptimizer-mips.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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 24 matching lines...) Expand all
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 38
39 int Deoptimizer::patch_size() { 39 int Deoptimizer::patch_size() {
40 const int kCallInstructionSizeInWords = 4; 40 const int kCallInstructionSizeInWords = 4;
41 return kCallInstructionSizeInWords * Assembler::kInstrSize; 41 return kCallInstructionSizeInWords * Assembler::kInstrSize;
42 } 42 }
43 43
44 44
45 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 45 void Deoptimizer::DeoptimizeFunctionWithPreparedFunctionList(
46 HandleScope scope; 46 JSFunction* function) {
47 Isolate* isolate = function->GetIsolate();
48 HandleScope scope(isolate);
47 AssertNoAllocation no_allocation; 49 AssertNoAllocation no_allocation;
48 50
49 if (!function->IsOptimized()) return; 51 ASSERT(function->IsOptimized());
52 ASSERT(function->FunctionsInFunctionListShareSameCode());
50 53
51 // The optimized code is going to be patched, so we cannot use it 54 // The optimized code is going to be patched, so we cannot use it
52 // any more. Play safe and reset the whole cache. 55 // any more. Play safe and reset the whole cache.
53 function->shared()->ClearOptimizedCodeMap(); 56 function->shared()->ClearOptimizedCodeMap();
54 57
55 // Get the optimized code. 58 // Get the optimized code.
56 Code* code = function->code(); 59 Code* code = function->code();
57 Address code_start_address = code->instruction_start(); 60 Address code_start_address = code->instruction_start();
58 61
59 // Invalidate the relocation information, as it will become invalid by the 62 // Invalidate the relocation information, as it will become invalid by the
(...skipping 20 matching lines...) Expand all
80 patcher.masm()->Call(deopt_entry, RelocInfo::NONE); 83 patcher.masm()->Call(deopt_entry, RelocInfo::NONE);
81 ASSERT(prev_call_address == NULL || 84 ASSERT(prev_call_address == NULL ||
82 call_address >= prev_call_address + patch_size()); 85 call_address >= prev_call_address + patch_size());
83 ASSERT(call_address + patch_size() <= code->instruction_end()); 86 ASSERT(call_address + patch_size() <= code->instruction_end());
84 87
85 #ifdef DEBUG 88 #ifdef DEBUG
86 prev_call_address = call_address; 89 prev_call_address = call_address;
87 #endif 90 #endif
88 } 91 }
89 92
90 Isolate* isolate = code->GetIsolate();
91
92 // Add the deoptimizing code to the list. 93 // Add the deoptimizing code to the list.
93 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); 94 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
94 DeoptimizerData* data = isolate->deoptimizer_data(); 95 DeoptimizerData* data = isolate->deoptimizer_data();
95 node->set_next(data->deoptimizing_code_list_); 96 node->set_next(data->deoptimizing_code_list_);
96 data->deoptimizing_code_list_ = node; 97 data->deoptimizing_code_list_ = node;
97 98
98 // We might be in the middle of incremental marking with compaction. 99 // We might be in the middle of incremental marking with compaction.
99 // Tell collector to treat this code object in a special way and 100 // Tell collector to treat this code object in a special way and
100 // ignore all slots that might have been recorded on it. 101 // ignore all slots that might have been recorded on it.
101 isolate->heap()->mark_compact_collector()->InvalidateCode(code); 102 isolate->heap()->mark_compact_collector()->InvalidateCode(code);
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 } 1118 }
1118 1119
1119 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), 1120 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
1120 count() * table_entry_size_); 1121 count() * table_entry_size_);
1121 } 1122 }
1122 1123
1123 #undef __ 1124 #undef __
1124 1125
1125 1126
1126 } } // namespace v8::internal 1127 } } // namespace v8::internal
OLDNEW
« src/deoptimizer.h ('K') | « src/liveedit.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698