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/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
11 #include "src/snapshot/natives.h" | 11 #include "src/snapshot/natives.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { | 16 RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { |
17 HandleScope scope(isolate); | 17 HandleScope scope(isolate); |
18 DCHECK(args.length() == 1); | 18 DCHECK(args.length() == 1); |
19 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 19 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
20 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); | 20 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
21 | 21 |
22 // TODO(turbofan): Deoptimization is not supported yet. | 22 // TODO(turbofan): Deoptimization is not supported yet. |
23 if (function->code()->is_turbofanned() && !FLAG_turbo_deoptimization) { | 23 if (function->code()->is_turbofanned() && |
| 24 function->shared()->asm_function() && !FLAG_turbo_asm_deoptimization) { |
24 return isolate->heap()->undefined_value(); | 25 return isolate->heap()->undefined_value(); |
25 } | 26 } |
26 | 27 |
27 Deoptimizer::DeoptimizeFunction(*function); | 28 Deoptimizer::DeoptimizeFunction(*function); |
28 | 29 |
29 return isolate->heap()->undefined_value(); | 30 return isolate->heap()->undefined_value(); |
30 } | 31 } |
31 | 32 |
32 | 33 |
33 RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { | 34 RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { |
34 HandleScope scope(isolate); | 35 HandleScope scope(isolate); |
35 DCHECK(args.length() == 0); | 36 DCHECK(args.length() == 0); |
36 | 37 |
37 Handle<JSFunction> function; | 38 Handle<JSFunction> function; |
38 | 39 |
39 // If the argument is 'undefined', deoptimize the topmost | 40 // If the argument is 'undefined', deoptimize the topmost |
40 // function. | 41 // function. |
41 JavaScriptFrameIterator it(isolate); | 42 JavaScriptFrameIterator it(isolate); |
42 while (!it.done()) { | 43 while (!it.done()) { |
43 if (it.frame()->is_java_script()) { | 44 if (it.frame()->is_java_script()) { |
44 function = Handle<JSFunction>(it.frame()->function()); | 45 function = Handle<JSFunction>(it.frame()->function()); |
45 break; | 46 break; |
46 } | 47 } |
47 } | 48 } |
48 if (function.is_null()) return isolate->heap()->undefined_value(); | 49 if (function.is_null()) return isolate->heap()->undefined_value(); |
49 | 50 |
50 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); | 51 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
51 | 52 |
52 // TODO(turbofan): Deoptimization is not supported yet. | 53 // TODO(turbofan): Deoptimization is not supported yet. |
53 if (function->code()->is_turbofanned() && !FLAG_turbo_deoptimization) { | 54 if (function->code()->is_turbofanned() && |
| 55 function->shared()->asm_function() && !FLAG_turbo_asm_deoptimization) { |
54 return isolate->heap()->undefined_value(); | 56 return isolate->heap()->undefined_value(); |
55 } | 57 } |
56 | 58 |
57 Deoptimizer::DeoptimizeFunction(*function); | 59 Deoptimizer::DeoptimizeFunction(*function); |
58 | 60 |
59 return isolate->heap()->undefined_value(); | 61 return isolate->heap()->undefined_value(); |
60 } | 62 } |
61 | 63 |
62 | 64 |
63 RUNTIME_FUNCTION(Runtime_RunningInSimulator) { | 65 RUNTIME_FUNCTION(Runtime_RunningInSimulator) { |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ | 496 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ |
495 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 497 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
496 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ | 498 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ |
497 } | 499 } |
498 | 500 |
499 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) | 501 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
500 | 502 |
501 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION | 503 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
502 } // namespace internal | 504 } // namespace internal |
503 } // namespace v8 | 505 } // namespace v8 |
OLD | NEW |