| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 55 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 56 // The following two assertions are lifted from the DCHECKs inside | 56 // The following two assertions are lifted from the DCHECKs inside |
| 57 // JSFunction::MarkForOptimization(). | 57 // JSFunction::MarkForOptimization(). |
| 58 RUNTIME_ASSERT(!function->shared()->is_generator()); | 58 RUNTIME_ASSERT(!function->shared()->is_generator()); |
| 59 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || | 59 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || |
| 60 (function->code()->kind() == Code::FUNCTION && | 60 (function->code()->kind() == Code::FUNCTION && |
| 61 function->code()->optimizable())); | 61 function->code()->optimizable())); |
| 62 | 62 |
| 63 if (!isolate->use_crankshaft()) return isolate->heap()->undefined_value(); | 63 if (!isolate->use_crankshaft()) return isolate->heap()->undefined_value(); |
| 64 | 64 |
| 65 // If the function is optimized, just return. | 65 // If the function is already optimized, just return. |
| 66 if (function->IsOptimized()) return isolate->heap()->undefined_value(); | 66 if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
| 67 | 67 |
| 68 // If the function cannot optimized, just return. |
| 69 if (function->shared()->optimization_disabled()) { |
| 70 return isolate->heap()->undefined_value(); |
| 71 } |
| 72 |
| 68 function->MarkForOptimization(); | 73 function->MarkForOptimization(); |
| 69 | 74 |
| 70 Code* unoptimized = function->shared()->code(); | 75 Code* unoptimized = function->shared()->code(); |
| 71 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { | 76 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { |
| 72 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 77 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
| 73 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("osr")) && FLAG_use_osr) { | 78 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("osr")) && FLAG_use_osr) { |
| 74 // Start patching from the currently patched loop nesting level. | 79 // Start patching from the currently patched loop nesting level. |
| 75 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); | 80 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); |
| 76 isolate->runtime_profiler()->AttemptOnStackReplacement( | 81 isolate->runtime_profiler()->AttemptOnStackReplacement( |
| 77 *function, Code::kMaxLoopNestingMarker); | 82 *function, Code::kMaxLoopNestingMarker); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ | 408 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ |
| 404 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 409 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
| 405 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ | 410 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ |
| 406 } | 411 } |
| 407 | 412 |
| 408 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) | 413 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
| 409 | 414 |
| 410 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION | 415 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
| 411 } | 416 } |
| 412 } // namespace v8::internal | 417 } // namespace v8::internal |
| OLD | NEW |