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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
10 #include "src/natives.h" | 10 #include "src/natives.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 if (function->code()->is_turbofanned() && !FLAG_turbo_deoptimization) { | 23 if (function->code()->is_turbofanned() && !FLAG_turbo_deoptimization) { |
24 return isolate->heap()->undefined_value(); | 24 return isolate->heap()->undefined_value(); |
25 } | 25 } |
26 | 26 |
27 Deoptimizer::DeoptimizeFunction(*function); | 27 Deoptimizer::DeoptimizeFunction(*function); |
28 | 28 |
29 return isolate->heap()->undefined_value(); | 29 return isolate->heap()->undefined_value(); |
30 } | 30 } |
31 | 31 |
32 | 32 |
| 33 RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { |
| 34 HandleScope scope(isolate); |
| 35 DCHECK(args.length() == 0); |
| 36 |
| 37 Handle<JSFunction> function; |
| 38 |
| 39 // If the argument is 'undefined', deoptimize the topmost |
| 40 // function. |
| 41 JavaScriptFrameIterator it(isolate); |
| 42 while (!it.done()) { |
| 43 if (it.frame()->is_java_script()) { |
| 44 function = Handle<JSFunction>(it.frame()->function()); |
| 45 break; |
| 46 } |
| 47 } |
| 48 if (function.is_null()) return isolate->heap()->undefined_value(); |
| 49 |
| 50 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
| 51 |
| 52 // TODO(turbofan): Deoptimization is not supported yet. |
| 53 if (function->code()->is_turbofanned() && !FLAG_turbo_deoptimization) { |
| 54 return isolate->heap()->undefined_value(); |
| 55 } |
| 56 |
| 57 Deoptimizer::DeoptimizeFunction(*function); |
| 58 |
| 59 return isolate->heap()->undefined_value(); |
| 60 } |
| 61 |
| 62 |
33 RUNTIME_FUNCTION(Runtime_RunningInSimulator) { | 63 RUNTIME_FUNCTION(Runtime_RunningInSimulator) { |
34 SealHandleScope shs(isolate); | 64 SealHandleScope shs(isolate); |
35 DCHECK(args.length() == 0); | 65 DCHECK(args.length() == 0); |
36 #if defined(USE_SIMULATOR) | 66 #if defined(USE_SIMULATOR) |
37 return isolate->heap()->true_value(); | 67 return isolate->heap()->true_value(); |
38 #else | 68 #else |
39 return isolate->heap()->false_value(); | 69 return isolate->heap()->false_value(); |
40 #endif | 70 #endif |
41 } | 71 } |
42 | 72 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ | 467 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ |
438 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 468 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
439 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ | 469 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ |
440 } | 470 } |
441 | 471 |
442 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) | 472 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
443 | 473 |
444 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION | 474 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
445 } | 475 } |
446 } // namespace v8::internal | 476 } // namespace v8::internal |
OLD | NEW |