OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/asmjs/asm-js.h" | 8 #include "src/asmjs/asm-js.h" |
9 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" | 9 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
11 #include "src/deoptimizer.h" | 11 #include "src/deoptimizer.h" |
12 #include "src/frames-inl.h" | 12 #include "src/frames-inl.h" |
13 #include "src/full-codegen/full-codegen.h" | 13 #include "src/full-codegen/full-codegen.h" |
| 14 #include "src/interpreter/bytecode-array-iterator.h" |
14 #include "src/isolate-inl.h" | 15 #include "src/isolate-inl.h" |
15 #include "src/messages.h" | 16 #include "src/messages.h" |
16 #include "src/v8threads.h" | 17 #include "src/v8threads.h" |
17 #include "src/vm-state-inl.h" | 18 #include "src/vm-state-inl.h" |
18 | 19 |
19 namespace v8 { | 20 namespace v8 { |
20 namespace internal { | 21 namespace internal { |
21 | 22 |
22 RUNTIME_FUNCTION(Runtime_CompileLazy) { | 23 RUNTIME_FUNCTION(Runtime_CompileLazy) { |
23 HandleScope scope(isolate); | 24 HandleScope scope(isolate); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 Handle<BytecodeArray> bytecode(iframe->GetBytecodeArray()); | 286 Handle<BytecodeArray> bytecode(iframe->GetBytecodeArray()); |
286 | 287 |
287 DCHECK(frame->LookupCode()->is_interpreter_trampoline_builtin()); | 288 DCHECK(frame->LookupCode()->is_interpreter_trampoline_builtin()); |
288 DCHECK(frame->function()->shared()->HasBytecodeArray()); | 289 DCHECK(frame->function()->shared()->HasBytecodeArray()); |
289 DCHECK(frame->is_interpreted()); | 290 DCHECK(frame->is_interpreted()); |
290 DCHECK(FLAG_ignition_osr); | 291 DCHECK(FLAG_ignition_osr); |
291 | 292 |
292 // Reset the OSR loop nesting depth to disarm back edges. | 293 // Reset the OSR loop nesting depth to disarm back edges. |
293 bytecode->set_osr_loop_nesting_level(0); | 294 bytecode->set_osr_loop_nesting_level(0); |
294 | 295 |
295 return BailoutId(iframe->GetBytecodeOffset()); | 296 // Translate the offset of the jump instruction to the jump target offset of |
| 297 // that instruction so that the derived BailoutId points to the loop header. |
| 298 // TODO(mstarzinger): This can be merged with {BytecodeBranchAnalysis} which |
| 299 // already performs a pre-pass over the bytecode stream anyways. |
| 300 int jump_offset = iframe->GetBytecodeOffset(); |
| 301 interpreter::BytecodeArrayIterator iterator(bytecode); |
| 302 while (iterator.current_offset() + iterator.current_prefix_offset() < |
| 303 jump_offset) { |
| 304 iterator.Advance(); |
| 305 } |
| 306 DCHECK(interpreter::Bytecodes::IsJump(iterator.current_bytecode())); |
| 307 int jump_target_offset = iterator.GetJumpTargetOffset(); |
| 308 |
| 309 return BailoutId(jump_target_offset); |
296 } | 310 } |
297 | 311 |
298 } // namespace | 312 } // namespace |
299 | 313 |
300 RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { | 314 RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { |
301 HandleScope scope(isolate); | 315 HandleScope scope(isolate); |
302 DCHECK(args.length() == 1); | 316 DCHECK(args.length() == 1); |
303 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 317 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
304 | 318 |
305 // We're not prepared to handle a function with arguments object. | 319 // We're not prepared to handle a function with arguments object. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 DCHECK(is_valid_language_mode(args.smi_at(3))); | 475 DCHECK(is_valid_language_mode(args.smi_at(3))); |
462 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 476 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
463 DCHECK(args[4]->IsSmi()); | 477 DCHECK(args[4]->IsSmi()); |
464 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 478 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
465 isolate); | 479 isolate); |
466 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 480 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
467 language_mode, args.smi_at(4), args.smi_at(5)); | 481 language_mode, args.smi_at(4), args.smi_at(5)); |
468 } | 482 } |
469 } // namespace internal | 483 } // namespace internal |
470 } // namespace v8 | 484 } // namespace v8 |
OLD | NEW |