OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 | 187 |
188 // Get the stack check stub code object to match against. We aren't | 188 // Get the stack check stub code object to match against. We aren't |
189 // prepared to generate it, but we don't expect to have to. | 189 // prepared to generate it, but we don't expect to have to. |
190 StackCheckStub check_stub; | 190 StackCheckStub check_stub; |
191 Object* check_code; | 191 Object* check_code; |
192 MaybeObject* maybe_check_code = check_stub.TryGetCode(); | 192 MaybeObject* maybe_check_code = check_stub.TryGetCode(); |
193 if (maybe_check_code->ToObject(&check_code)) { | 193 if (maybe_check_code->ToObject(&check_code)) { |
194 Code* replacement_code = Builtins::builtin(Builtins::OnStackReplacement); | 194 Code* replacement_code = Builtins::builtin(Builtins::OnStackReplacement); |
195 Code* unoptimized_code = shared->code(); | 195 Code* unoptimized_code = shared->code(); |
196 // Iterate the unoptimized code and patch every stack check except at | 196 Deoptimizer::PatchStackCheckCode(unoptimized_code, |
197 // the function entry. This code assumes the function entry stack | 197 Code::cast(check_code), |
198 // check appears first i.e., is not deferred or otherwise reordered. | 198 replacement_code); |
199 bool first = true; | |
200 for (RelocIterator it(unoptimized_code, RelocInfo::kCodeTargetMask); | |
201 !it.done(); | |
202 it.next()) { | |
203 RelocInfo* rinfo = it.rinfo(); | |
204 if (rinfo->target_address() == Code::cast(check_code)->entry()) { | |
205 if (first) { | |
206 first = false; | |
207 } else { | |
208 Deoptimizer::PatchStackCheckCode(rinfo, replacement_code); | |
209 } | |
210 } | |
211 } | |
212 } | 199 } |
213 } | 200 } |
214 | 201 |
215 | 202 |
216 static void ClearSampleBuffer() { | 203 static void ClearSampleBuffer() { |
217 for (int i = 0; i < kSamplerWindowSize; i++) { | 204 for (int i = 0; i < kSamplerWindowSize; i++) { |
218 sampler_window[i] = NULL; | 205 sampler_window[i] = NULL; |
219 sampler_window_weight[i] = 0; | 206 sampler_window_weight[i] = 0; |
220 } | 207 } |
221 } | 208 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 if (Top::WaitForJSState()) return true; | 439 if (Top::WaitForJSState()) return true; |
453 } | 440 } |
454 } | 441 } |
455 } | 442 } |
456 #endif | 443 #endif |
457 return false; | 444 return false; |
458 } | 445 } |
459 | 446 |
460 | 447 |
461 } } // namespace v8::internal | 448 } } // namespace v8::internal |
OLD | NEW |