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