OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2950 | 2950 |
2951 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); | 2951 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); |
2952 Handle<Object> code = args.at<Object>(1); | 2952 Handle<Object> code = args.at<Object>(1); |
2953 | 2953 |
2954 if (code->IsNull()) return *target; | 2954 if (code->IsNull()) return *target; |
2955 RUNTIME_ASSERT(code->IsJSFunction()); | 2955 RUNTIME_ASSERT(code->IsJSFunction()); |
2956 Handle<JSFunction> source = Handle<JSFunction>::cast(code); | 2956 Handle<JSFunction> source = Handle<JSFunction>::cast(code); |
2957 Handle<SharedFunctionInfo> target_shared(target->shared()); | 2957 Handle<SharedFunctionInfo> target_shared(target->shared()); |
2958 Handle<SharedFunctionInfo> source_shared(source->shared()); | 2958 Handle<SharedFunctionInfo> source_shared(source->shared()); |
2959 | 2959 |
2960 if (!JSFunction::EnsureCompiled(source, KEEP_EXCEPTION)) { | 2960 if (!Compiler::EnsureCompiled(source, KEEP_EXCEPTION)) { |
2961 return Failure::Exception(); | 2961 return Failure::Exception(); |
2962 } | 2962 } |
2963 | 2963 |
2964 // Mark both, the source and the target, as un-flushable because the | 2964 // Mark both, the source and the target, as un-flushable because the |
2965 // shared unoptimized code makes them impossible to enqueue in a list. | 2965 // shared unoptimized code makes them impossible to enqueue in a list. |
2966 ASSERT(target_shared->code()->gc_metadata() == NULL); | 2966 ASSERT(target_shared->code()->gc_metadata() == NULL); |
2967 ASSERT(source_shared->code()->gc_metadata() == NULL); | 2967 ASSERT(source_shared->code()->gc_metadata() == NULL); |
2968 target_shared->set_dont_flush(true); | 2968 target_shared->set_dont_flush(true); |
2969 source_shared->set_dont_flush(true); | 2969 source_shared->set_dont_flush(true); |
2970 | 2970 |
(...skipping 5287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8258 // ignored anyway, we use the global object as the receiver | 8258 // ignored anyway, we use the global object as the receiver |
8259 // instead of a new JSFunction object. This way, errors are | 8259 // instead of a new JSFunction object. This way, errors are |
8260 // reported the same way whether or not 'Function' is called | 8260 // reported the same way whether or not 'Function' is called |
8261 // using 'new'. | 8261 // using 'new'. |
8262 return isolate->context()->global_object(); | 8262 return isolate->context()->global_object(); |
8263 } | 8263 } |
8264 } | 8264 } |
8265 | 8265 |
8266 // The function should be compiled for the optimization hints to be | 8266 // The function should be compiled for the optimization hints to be |
8267 // available. | 8267 // available. |
8268 JSFunction::EnsureCompiled(function, CLEAR_EXCEPTION); | 8268 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION); |
8269 | 8269 |
8270 Handle<SharedFunctionInfo> shared(function->shared(), isolate); | 8270 Handle<SharedFunctionInfo> shared(function->shared(), isolate); |
8271 if (!function->has_initial_map() && | 8271 if (!function->has_initial_map() && |
8272 shared->IsInobjectSlackTrackingInProgress()) { | 8272 shared->IsInobjectSlackTrackingInProgress()) { |
8273 // The tracking is already in progress for another function. We can only | 8273 // The tracking is already in progress for another function. We can only |
8274 // track one initial_map at a time, so we force the completion before the | 8274 // track one initial_map at a time, so we force the completion before the |
8275 // function is called as a constructor for the first time. | 8275 // function is called as a constructor for the first time. |
8276 shared->CompleteInobjectSlackTracking(); | 8276 shared->CompleteInobjectSlackTracking(); |
8277 } | 8277 } |
8278 | 8278 |
(...skipping 11 matching lines...) Expand all Loading... | |
8290 HandleScope scope(isolate); | 8290 HandleScope scope(isolate); |
8291 ASSERT(args.length() == 1); | 8291 ASSERT(args.length() == 1); |
8292 | 8292 |
8293 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8293 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8294 function->shared()->CompleteInobjectSlackTracking(); | 8294 function->shared()->CompleteInobjectSlackTracking(); |
8295 | 8295 |
8296 return isolate->heap()->undefined_value(); | 8296 return isolate->heap()->undefined_value(); |
8297 } | 8297 } |
8298 | 8298 |
8299 | 8299 |
8300 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyCompile) { | 8300 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileUnoptimized) { |
8301 HandleScope scope(isolate); | 8301 HandleScope scope(isolate); |
8302 ASSERT(args.length() == 1); | 8302 ASSERT(args.length() == 1); |
8303 | 8303 |
8304 Handle<JSFunction> function = args.at<JSFunction>(0); | 8304 Handle<JSFunction> function = args.at<JSFunction>(0); |
8305 #ifdef DEBUG | 8305 #ifdef DEBUG |
8306 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { | 8306 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { |
8307 PrintF("[lazy: "); | 8307 PrintF("[lazy: "); |
titzer
2013/12/09 14:49:28
s/lazy/unoptimized/
Yang
2013/12/10 11:22:04
Done.
| |
8308 function->PrintName(); | 8308 function->PrintName(); |
8309 PrintF("]\n"); | 8309 PrintF("]\n"); |
8310 } | 8310 } |
8311 #endif | 8311 #endif |
8312 | 8312 |
8313 // Compile the target function. | 8313 // Compile the target function. |
8314 ASSERT(!function->is_compiled()); | 8314 ASSERT(!function->is_compiled()); |
titzer
2013/12/09 14:49:28
Why?
Yang
2013/12/10 11:22:04
I guess we would guard that this is only called fr
titzer
2013/12/17 15:27:55
In general, I think neither CompileOptimized nor C
Yang
2013/12/17 16:31:33
Added asserts at the end guarding those exit invar
| |
8315 if (!JSFunction::CompileLazy(function, KEEP_EXCEPTION)) { | 8315 ASSERT(function->shared()->allows_lazy_compilation()); |
8316 return Failure::Exception(); | 8316 |
8317 } | 8317 Handle<Code> code = Compiler::GetUnoptimizedCode(function); |
8318 RETURN_IF_EMPTY_HANDLE(isolate, code); | |
8319 function->ReplaceCode(*code); | |
8318 | 8320 |
8319 // All done. Return the compiled code. | 8321 // All done. Return the compiled code. |
8320 ASSERT(function->is_compiled()); | 8322 ASSERT(function->is_compiled()); |
8321 return function->code(); | 8323 return *code; |
8322 } | 8324 } |
8323 | 8325 |
8324 | 8326 |
8325 bool AllowOptimization(Isolate* isolate, Handle<JSFunction> function) { | 8327 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileOptimized) { |
8326 // If the function is not compiled ignore the lazy | 8328 HandleScope scope(isolate); |
8327 // recompilation. This can happen if the debugger is activated and | 8329 ASSERT(args.length() == 2); |
8328 // the function is returned to the not compiled state. | 8330 Handle<JSFunction> function = args.at<JSFunction>(0); |
8329 if (!function->shared()->is_compiled()) return false; | 8331 CONVERT_BOOLEAN_ARG_CHECKED(concurrent, 1); |
8330 | 8332 |
8331 // If the function is not optimizable or debugger is active continue using the | 8333 Handle<Code> unoptimized(function->shared()->code()); |
8332 // code from the full compiler. | 8334 if (!function->shared()->is_compiled()) { |
titzer
2013/12/09 14:49:28
I don't think we want this check. IIRC that forces
Yang
2013/12/10 11:22:04
I think that is intentional. I merely inlined Allo
titzer
2013/12/17 15:27:55
Add a TODO. I still think it's an unnecessary rest
Yang
2013/12/17 16:31:33
Done.
| |
8333 if (!isolate->use_crankshaft() || | 8335 // If the function is not compiled ignore the lazy |
8334 function->shared()->optimization_disabled() || | 8336 // recompilation. This can happen if the debugger is activated and |
8335 isolate->DebuggerHasBreakPoints()) { | 8337 // the function is returned to the not compiled state. |
8338 function->ReplaceCode(function->shared()->code()); | |
8339 } else if (!isolate->use_crankshaft() || | |
8340 function->shared()->optimization_disabled() || | |
8341 isolate->DebuggerHasBreakPoints()) { | |
8342 // If the function is not optimizable or debugger is active continue | |
8343 // using the code from the full compiler. | |
8336 if (FLAG_trace_opt) { | 8344 if (FLAG_trace_opt) { |
8337 PrintF("[failed to optimize "); | 8345 PrintF("[failed to optimize "); |
8338 function->PrintName(); | 8346 function->PrintName(); |
8339 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", | 8347 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
8340 function->shared()->optimization_disabled() ? "F" : "T", | 8348 function->shared()->optimization_disabled() ? "F" : "T", |
8341 isolate->DebuggerHasBreakPoints() ? "T" : "F"); | 8349 isolate->DebuggerHasBreakPoints() ? "T" : "F"); |
8342 } | 8350 } |
8343 return false; | 8351 function->ReplaceCode(*unoptimized); |
8352 } else { | |
8353 Compiler::ConcurrencyMode mode = concurrent ? Compiler::CONCURRENT | |
8354 : Compiler::NOT_CONCURRENT; | |
8355 Handle<Code> code = Compiler::GetOptimizedCode(function, unoptimized, mode); | |
8356 if (code.is_null()) code = isolate->builtins()->InOptimizationQueue(); | |
titzer
2013/12/09 14:49:28
I totally don't understand this. What if the optim
Yang
2013/12/10 11:22:04
You are right. Currently GetOptimizedCode would re
| |
8357 function->ReplaceCode(*code); | |
8344 } | 8358 } |
8345 return true; | |
8346 } | |
8347 | 8359 |
8348 | |
8349 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { | |
8350 HandleScope scope(isolate); | |
8351 ASSERT(args.length() == 1); | |
8352 Handle<JSFunction> function = args.at<JSFunction>(0); | |
8353 | |
8354 if (!AllowOptimization(isolate, function)) { | |
8355 function->ReplaceCode(function->shared()->code()); | |
8356 return function->code(); | |
8357 } | |
8358 function->shared()->code()->set_profiler_ticks(0); | |
8359 if (JSFunction::CompileOptimized(function, CLEAR_EXCEPTION)) { | |
8360 return function->code(); | |
8361 } | |
8362 if (FLAG_trace_opt) { | |
8363 PrintF("[failed to optimize "); | |
8364 function->PrintName(); | |
8365 PrintF(": optimized compilation failed]\n"); | |
8366 } | |
8367 function->ReplaceCode(function->shared()->code()); | |
8368 return function->code(); | 8360 return function->code(); |
8369 } | 8361 } |
8370 | 8362 |
8371 | 8363 |
8372 RUNTIME_FUNCTION(MaybeObject*, Runtime_ConcurrentRecompile) { | |
8373 HandleScope handle_scope(isolate); | |
8374 ASSERT(args.length() == 1); | |
8375 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | |
8376 if (!AllowOptimization(isolate, function)) { | |
8377 function->ReplaceCode(function->shared()->code()); | |
8378 return isolate->heap()->undefined_value(); | |
8379 } | |
8380 Handle<Code> shared_code(function->shared()->code()); | |
8381 shared_code->set_profiler_ticks(0); | |
8382 ASSERT(isolate->concurrent_recompilation_enabled()); | |
8383 if (!Compiler::RecompileConcurrent(function, shared_code)) { | |
8384 function->ReplaceCode(*shared_code); | |
8385 } | |
8386 return isolate->heap()->undefined_value(); | |
8387 } | |
8388 | |
8389 | |
8390 class ActivationsFinder : public ThreadVisitor { | 8364 class ActivationsFinder : public ThreadVisitor { |
8391 public: | 8365 public: |
8392 Code* code_; | 8366 Code* code_; |
8393 bool has_code_activations_; | 8367 bool has_code_activations_; |
8394 | 8368 |
8395 explicit ActivationsFinder(Code* code) | 8369 explicit ActivationsFinder(Code* code) |
8396 : code_(code), | 8370 : code_(code), |
8397 has_code_activations_(false) { } | 8371 has_code_activations_(false) { } |
8398 | 8372 |
8399 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { | 8373 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8520 ? isolate->heap()->true_value() : isolate->heap()->false_value(); | 8494 ? isolate->heap()->true_value() : isolate->heap()->false_value(); |
8521 } | 8495 } |
8522 | 8496 |
8523 | 8497 |
8524 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { | 8498 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { |
8525 HandleScope scope(isolate); | 8499 HandleScope scope(isolate); |
8526 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 8500 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
8527 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8501 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8528 | 8502 |
8529 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); | 8503 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); |
8530 function->MarkForLazyRecompilation(); | 8504 function->MarkForCompileOptimized(); |
8531 | 8505 |
8532 Code* unoptimized = function->shared()->code(); | 8506 Code* unoptimized = function->shared()->code(); |
8533 if (args.length() == 2 && | 8507 if (args.length() == 2 && |
8534 unoptimized->kind() == Code::FUNCTION) { | 8508 unoptimized->kind() == Code::FUNCTION) { |
8535 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 8509 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
8536 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { | 8510 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { |
8537 // Start patching from the currently patched loop nesting level. | 8511 // Start patching from the currently patched loop nesting level. |
8538 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); | 8512 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); |
8539 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); | 8513 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); |
8540 for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) { | 8514 for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) { |
8541 unoptimized->set_allow_osr_at_loop_nesting_level(i); | 8515 unoptimized->set_allow_osr_at_loop_nesting_level(i); |
8542 isolate->runtime_profiler()->AttemptOnStackReplacement(*function); | 8516 isolate->runtime_profiler()->AttemptOnStackReplacement(*function); |
8543 } | 8517 } |
8544 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent"))) { | 8518 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent"))) { |
8545 function->MarkForConcurrentRecompilation(); | 8519 function->MarkForCompileOptimizedConcurrent(); |
8546 } | 8520 } |
8547 } | 8521 } |
8548 | 8522 |
8549 return isolate->heap()->undefined_value(); | 8523 return isolate->heap()->undefined_value(); |
8550 } | 8524 } |
8551 | 8525 |
8552 | 8526 |
8553 RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) { | 8527 RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) { |
8554 HandleScope scope(isolate); | 8528 HandleScope scope(isolate); |
8555 ASSERT(args.length() == 1); | 8529 ASSERT(args.length() == 1); |
(...skipping 13 matching lines...) Expand all Loading... | |
8569 bool sync_with_compiler_thread = true; | 8543 bool sync_with_compiler_thread = true; |
8570 if (args.length() == 2) { | 8544 if (args.length() == 2) { |
8571 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); | 8545 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); |
8572 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { | 8546 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { |
8573 sync_with_compiler_thread = false; | 8547 sync_with_compiler_thread = false; |
8574 } | 8548 } |
8575 } | 8549 } |
8576 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8550 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8577 if (isolate->concurrent_recompilation_enabled() && | 8551 if (isolate->concurrent_recompilation_enabled() && |
8578 sync_with_compiler_thread) { | 8552 sync_with_compiler_thread) { |
8579 while (function->IsInRecompileQueue()) { | 8553 while (function->IsInOptimizationQueue()) { |
8580 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 8554 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
8581 OS::Sleep(50); | 8555 OS::Sleep(50); |
8582 } | 8556 } |
8583 } | 8557 } |
8584 if (FLAG_always_opt) { | 8558 if (FLAG_always_opt) { |
8585 // We may have always opt, but that is more best-effort than a real | 8559 // We may have always opt, but that is more best-effort than a real |
8586 // promise, so we still say "no" if it is not optimized. | 8560 // promise, so we still say "no" if it is not optimized. |
8587 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". | 8561 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". |
8588 : Smi::FromInt(2); // 2 == "no". | 8562 : Smi::FromInt(2); // 2 == "no". |
8589 } | 8563 } |
(...skipping 15 matching lines...) Expand all Loading... | |
8605 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { | 8579 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { |
8606 HandleScope scope(isolate); | 8580 HandleScope scope(isolate); |
8607 ASSERT(args.length() == 1); | 8581 ASSERT(args.length() == 1); |
8608 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8582 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8609 return Smi::FromInt(function->shared()->opt_count()); | 8583 return Smi::FromInt(function->shared()->opt_count()); |
8610 } | 8584 } |
8611 | 8585 |
8612 | 8586 |
8613 static bool IsSuitableForOnStackReplacement(Isolate* isolate, | 8587 static bool IsSuitableForOnStackReplacement(Isolate* isolate, |
8614 Handle<JSFunction> function, | 8588 Handle<JSFunction> function, |
8615 Handle<Code> unoptimized) { | 8589 Handle<Code> current_code) { |
8616 // Keep track of whether we've succeeded in optimizing. | 8590 // Keep track of whether we've succeeded in optimizing. |
8617 if (!isolate->use_crankshaft() || !unoptimized->optimizable()) return false; | 8591 if (!isolate->use_crankshaft() || !current_code->optimizable()) return false; |
8618 // If we are trying to do OSR when there are already optimized | 8592 // If we are trying to do OSR when there are already optimized |
8619 // activations of the function, it means (a) the function is directly or | 8593 // activations of the function, it means (a) the function is directly or |
8620 // indirectly recursive and (b) an optimized invocation has been | 8594 // indirectly recursive and (b) an optimized invocation has been |
8621 // deoptimized so that we are currently in an unoptimized activation. | 8595 // deoptimized so that we are currently in an unoptimized activation. |
8622 // Check for optimized activations of this function. | 8596 // Check for optimized activations of this function. |
8623 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) { | 8597 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) { |
8624 JavaScriptFrame* frame = it.frame(); | 8598 JavaScriptFrame* frame = it.frame(); |
8625 if (frame->is_optimized() && frame->function() == *function) return false; | 8599 if (frame->is_optimized() && frame->function() == *function) return false; |
8626 } | 8600 } |
8627 | 8601 |
8628 return true; | 8602 return true; |
8629 } | 8603 } |
8630 | 8604 |
8631 | 8605 |
8632 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { | 8606 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { |
8633 HandleScope scope(isolate); | 8607 HandleScope scope(isolate); |
8634 ASSERT(args.length() == 1); | 8608 ASSERT(args.length() == 1); |
8635 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8609 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8636 Handle<Code> unoptimized(function->shared()->code(), isolate); | 8610 Handle<Code> current_code(function->shared()->code()); |
titzer
2013/12/09 14:49:28
Let's call this caller_code?
Yang
2013/12/10 11:22:04
Done.
| |
8611 | |
8612 // We're not prepared to handle a function with arguments object. | |
8613 ASSERT(!function->shared()->uses_arguments()); | |
8637 | 8614 |
8638 // Passing the PC in the javascript frame from the caller directly is | 8615 // Passing the PC in the javascript frame from the caller directly is |
8639 // not GC safe, so we walk the stack to get it. | 8616 // not GC safe, so we walk the stack to get it. |
8640 JavaScriptFrameIterator it(isolate); | 8617 JavaScriptFrameIterator it(isolate); |
8641 JavaScriptFrame* frame = it.frame(); | 8618 JavaScriptFrame* frame = it.frame(); |
8642 if (!unoptimized->contains(frame->pc())) { | 8619 if (!current_code->contains(frame->pc())) { |
8643 // Code on the stack may not be the code object referenced by the shared | 8620 // Code on the stack may not be the code object referenced by the shared |
8644 // function info. It may have been replaced to include deoptimization data. | 8621 // function info. It may have been replaced to include deoptimization data. |
8645 unoptimized = Handle<Code>(frame->LookupCode()); | 8622 current_code = Handle<Code>(frame->LookupCode()); |
8646 } | 8623 } |
8647 | 8624 |
8648 uint32_t pc_offset = static_cast<uint32_t>(frame->pc() - | 8625 uint32_t pc_offset = static_cast<uint32_t>( |
8649 unoptimized->instruction_start()); | 8626 frame->pc() - current_code->instruction_start()); |
8650 | 8627 |
8651 #ifdef DEBUG | 8628 #ifdef DEBUG |
8652 ASSERT_EQ(frame->function(), *function); | 8629 ASSERT_EQ(frame->function(), *function); |
8653 ASSERT_EQ(frame->LookupCode(), *unoptimized); | 8630 ASSERT_EQ(frame->LookupCode(), *current_code); |
8654 ASSERT(unoptimized->contains(frame->pc())); | 8631 ASSERT(current_code->contains(frame->pc())); |
8655 #endif // DEBUG | 8632 #endif // DEBUG |
8656 | 8633 |
8657 // We're not prepared to handle a function with arguments object. | |
8658 ASSERT(!function->shared()->uses_arguments()); | |
8659 | 8634 |
8635 BailoutId ast_id = current_code->TranslatePcOffsetToAstId(pc_offset); | |
8636 ASSERT(!ast_id.IsNone()); | |
8637 | |
8638 Compiler::ConcurrencyMode mode = isolate->concurrent_osr_enabled() | |
8639 ? Compiler::CONCURRENT : Compiler::NOT_CONCURRENT; | |
8660 Handle<Code> result = Handle<Code>::null(); | 8640 Handle<Code> result = Handle<Code>::null(); |
8661 BailoutId ast_id = BailoutId::None(); | |
8662 | 8641 |
8663 if (isolate->concurrent_osr_enabled()) { | 8642 if (mode == Compiler::CONCURRENT) { |
8664 if (isolate->optimizing_compiler_thread()-> | 8643 // Gate the OSR entry with a stack check. |
8665 IsQueuedForOSR(function, pc_offset)) { | 8644 BackEdgeTable::AddStackCheck(*current_code, pc_offset); |
8666 // Still waiting for the optimizing compiler thread to finish. Carry on. | 8645 // Poll already queued compilation jobs. |
8646 OptimizingCompilerThread* thread = isolate->optimizing_compiler_thread(); | |
8647 if (thread->IsQueuedForOSR(function, ast_id)) { | |
8667 if (FLAG_trace_osr) { | 8648 if (FLAG_trace_osr) { |
8668 PrintF("[COSR - polling recompile tasks for "); | 8649 PrintF("[OSR - Still waiting for queued: "); |
8669 function->PrintName(); | 8650 function->PrintName(); |
8670 PrintF("]\n"); | 8651 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
8671 } | 8652 } |
8672 return NULL; | 8653 return NULL; |
8673 } | 8654 } |
8674 | 8655 |
8675 RecompileJob* job = isolate->optimizing_compiler_thread()-> | 8656 RecompileJob* job = thread->FindReadyOSRCandidate(function, ast_id); |
8676 FindReadyOSRCandidate(function, pc_offset); | 8657 if (job != NULL) { |
8658 if (FLAG_trace_osr) { | |
8659 PrintF("[OSR - Found ready: "); | |
8660 function->PrintName(); | |
8661 PrintF(" at AST id %d]\n", ast_id.ToInt()); | |
8662 } | |
8663 result = Compiler::GetConcurrentlyOptimizedCode(job); | |
8664 } | |
8665 } | |
8677 | 8666 |
8678 if (job == NULL) { | 8667 if (result.is_null() && |
8679 if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) && | 8668 IsSuitableForOnStackReplacement(isolate, function, current_code)) { |
8680 Compiler::RecompileConcurrent(function, unoptimized, pc_offset)) { | 8669 if (FLAG_trace_osr) { |
8681 if (function->IsMarkedForLazyRecompilation() || | 8670 PrintF("[OSR - Compiling: "); |
8682 function->IsMarkedForConcurrentRecompilation()) { | 8671 function->PrintName(); |
8683 // Prevent regular recompilation if we queue this for OSR. | 8672 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
8684 // TODO(yangguo): remove this as soon as OSR becomes one-shot. | |
8685 function->ReplaceCode(function->shared()->code()); | |
8686 } | |
8687 return NULL; | |
8688 } | |
8689 // Fall through to the end in case of failure. | |
8690 } else { | |
8691 // TODO(titzer): don't install the OSR code into the function. | |
8692 ast_id = job->info()->osr_ast_id(); | |
8693 result = Compiler::InstallOptimizedCode(job); | |
8694 } | 8673 } |
8695 } else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { | 8674 result = Compiler::GetOptimizedCode(function, current_code, mode, ast_id); |
8696 ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset); | |
8697 ASSERT(!ast_id.IsNone()); | |
8698 if (FLAG_trace_osr) { | |
8699 PrintF("[OSR - replacing at AST id %d in ", ast_id.ToInt()); | |
8700 function->PrintName(); | |
8701 PrintF("]\n"); | |
8702 } | |
8703 // Attempt OSR compilation. | |
8704 result = JSFunction::CompileOsr(function, ast_id, CLEAR_EXCEPTION); | |
8705 } | 8675 } |
8706 | 8676 |
8707 // Revert the patched back edge table, regardless of whether OSR succeeds. | 8677 // Revert the patched back edge table, regardless of whether OSR succeeds. |
8708 BackEdgeTable::Revert(isolate, *unoptimized); | 8678 BackEdgeTable::Revert(isolate, *current_code); |
8709 | 8679 |
8710 // Check whether we ended up with usable optimized code. | 8680 // Check whether we ended up with usable optimized code. |
8711 if (!result.is_null() && result->kind() == Code::OPTIMIZED_FUNCTION) { | 8681 if (!result.is_null() && result->kind() == Code::OPTIMIZED_FUNCTION) { |
8712 DeoptimizationInputData* data = | 8682 DeoptimizationInputData* data = |
8713 DeoptimizationInputData::cast(result->deoptimization_data()); | 8683 DeoptimizationInputData::cast(result->deoptimization_data()); |
8714 | 8684 |
8715 if (data->OsrPcOffset()->value() >= 0) { | 8685 if (data->OsrPcOffset()->value() >= 0) { |
8716 ASSERT(BailoutId(data->OsrAstId()->value()) == ast_id); | 8686 ASSERT(BailoutId(data->OsrAstId()->value()) == ast_id); |
8717 if (FLAG_trace_osr) { | 8687 if (FLAG_trace_osr) { |
8718 PrintF("[OSR - entry at AST id %d, offset %d in optimized code]\n", | 8688 PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n", |
8719 ast_id.ToInt(), data->OsrPcOffset()->value()); | 8689 ast_id.ToInt(), data->OsrPcOffset()->value()); |
8720 } | 8690 } |
8721 // TODO(titzer): this is a massive hack to make the deopt counts | 8691 // TODO(titzer): this is a massive hack to make the deopt counts |
8722 // match. Fix heuristics for reenabling optimizations! | 8692 // match. Fix heuristics for reenabling optimizations! |
8723 function->shared()->increment_deopt_count(); | 8693 function->shared()->increment_deopt_count(); |
8694 | |
8695 // TODO(titzer): Do not install code into the function. | |
8696 function->ReplaceCode(*result); | |
8724 return *result; | 8697 return *result; |
8725 } | 8698 } |
8726 } | 8699 } |
8727 | 8700 |
8701 // Failed. | |
8728 if (FLAG_trace_osr) { | 8702 if (FLAG_trace_osr) { |
8729 PrintF("[OSR - optimization failed for "); | 8703 PrintF("[OSR - Failed: "); |
8730 function->PrintName(); | 8704 function->PrintName(); |
8731 PrintF("]\n"); | 8705 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
8732 } | 8706 } |
8733 | 8707 |
8734 if (function->IsMarkedForLazyRecompilation() || | 8708 function->ReplaceCode(function->shared()->code()); |
8735 function->IsMarkedForConcurrentRecompilation()) { | |
8736 function->ReplaceCode(function->shared()->code()); | |
8737 } | |
8738 return NULL; | 8709 return NULL; |
8739 } | 8710 } |
8740 | 8711 |
8741 | 8712 |
8742 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAllocationTimeout) { | 8713 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAllocationTimeout) { |
8743 SealHandleScope shs(isolate); | 8714 SealHandleScope shs(isolate); |
8744 ASSERT(args.length() == 2); | 8715 ASSERT(args.length() == 2); |
8745 #ifdef DEBUG | 8716 #ifdef DEBUG |
8746 CONVERT_SMI_ARG_CHECKED(interval, 0); | 8717 CONVERT_SMI_ARG_CHECKED(interval, 0); |
8747 CONVERT_SMI_ARG_CHECKED(timeout, 1); | 8718 CONVERT_SMI_ARG_CHECKED(timeout, 1); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9429 | 9400 |
9430 // First check if this is a real stack overflow. | 9401 // First check if this is a real stack overflow. |
9431 if (isolate->stack_guard()->IsStackOverflow()) { | 9402 if (isolate->stack_guard()->IsStackOverflow()) { |
9432 return isolate->StackOverflow(); | 9403 return isolate->StackOverflow(); |
9433 } | 9404 } |
9434 | 9405 |
9435 return Execution::HandleStackGuardInterrupt(isolate); | 9406 return Execution::HandleStackGuardInterrupt(isolate); |
9436 } | 9407 } |
9437 | 9408 |
9438 | 9409 |
9439 RUNTIME_FUNCTION(MaybeObject*, Runtime_TryInstallRecompiledCode) { | 9410 RUNTIME_FUNCTION(MaybeObject*, Runtime_TryInstallOptimizedCode) { |
9440 HandleScope scope(isolate); | 9411 HandleScope scope(isolate); |
9441 ASSERT(args.length() == 1); | 9412 ASSERT(args.length() == 1); |
9442 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 9413 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
9443 | 9414 |
9444 // First check if this is a real stack overflow. | 9415 // First check if this is a real stack overflow. |
9445 if (isolate->stack_guard()->IsStackOverflow()) { | 9416 if (isolate->stack_guard()->IsStackOverflow()) { |
9446 SealHandleScope shs(isolate); | 9417 SealHandleScope shs(isolate); |
9447 return isolate->StackOverflow(); | 9418 return isolate->StackOverflow(); |
9448 } | 9419 } |
9449 | 9420 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9678 !CodeGenerationFromStringsAllowed(isolate, context)) { | 9649 !CodeGenerationFromStringsAllowed(isolate, context)) { |
9679 Handle<Object> error_message = | 9650 Handle<Object> error_message = |
9680 context->ErrorMessageForCodeGenerationFromStrings(); | 9651 context->ErrorMessageForCodeGenerationFromStrings(); |
9681 return isolate->Throw(*isolate->factory()->NewEvalError( | 9652 return isolate->Throw(*isolate->factory()->NewEvalError( |
9682 "code_gen_from_strings", HandleVector<Object>(&error_message, 1))); | 9653 "code_gen_from_strings", HandleVector<Object>(&error_message, 1))); |
9683 } | 9654 } |
9684 | 9655 |
9685 // Compile source string in the native context. | 9656 // Compile source string in the native context. |
9686 ParseRestriction restriction = function_literal_only | 9657 ParseRestriction restriction = function_literal_only |
9687 ? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION; | 9658 ? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION; |
9688 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( | 9659 Handle<JSFunction> fun = Compiler::GetFunctionFromEval( |
9689 source, context, true, CLASSIC_MODE, restriction, RelocInfo::kNoPosition); | 9660 source, context, CLASSIC_MODE, restriction, RelocInfo::kNoPosition); |
9690 RETURN_IF_EMPTY_HANDLE(isolate, shared); | 9661 RETURN_IF_EMPTY_HANDLE(isolate, fun); |
9691 Handle<JSFunction> fun = | |
9692 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | |
9693 context, | |
9694 NOT_TENURED); | |
9695 return *fun; | 9662 return *fun; |
9696 } | 9663 } |
9697 | 9664 |
9698 | 9665 |
9699 static ObjectPair CompileGlobalEval(Isolate* isolate, | 9666 static ObjectPair CompileGlobalEval(Isolate* isolate, |
9700 Handle<String> source, | 9667 Handle<String> source, |
9701 Handle<Object> receiver, | 9668 Handle<Object> receiver, |
9702 LanguageMode language_mode, | 9669 LanguageMode language_mode, |
9703 int scope_position) { | 9670 int scope_position) { |
9704 Handle<Context> context = Handle<Context>(isolate->context()); | 9671 Handle<Context> context = Handle<Context>(isolate->context()); |
9705 Handle<Context> native_context = Handle<Context>(context->native_context()); | 9672 Handle<Context> native_context = Handle<Context>(context->native_context()); |
9706 | 9673 |
9707 // Check if native context allows code generation from | 9674 // Check if native context allows code generation from |
9708 // strings. Throw an exception if it doesn't. | 9675 // strings. Throw an exception if it doesn't. |
9709 if (native_context->allow_code_gen_from_strings()->IsFalse() && | 9676 if (native_context->allow_code_gen_from_strings()->IsFalse() && |
9710 !CodeGenerationFromStringsAllowed(isolate, native_context)) { | 9677 !CodeGenerationFromStringsAllowed(isolate, native_context)) { |
9711 Handle<Object> error_message = | 9678 Handle<Object> error_message = |
9712 native_context->ErrorMessageForCodeGenerationFromStrings(); | 9679 native_context->ErrorMessageForCodeGenerationFromStrings(); |
9713 isolate->Throw(*isolate->factory()->NewEvalError( | 9680 isolate->Throw(*isolate->factory()->NewEvalError( |
9714 "code_gen_from_strings", HandleVector<Object>(&error_message, 1))); | 9681 "code_gen_from_strings", HandleVector<Object>(&error_message, 1))); |
9715 return MakePair(Failure::Exception(), NULL); | 9682 return MakePair(Failure::Exception(), NULL); |
9716 } | 9683 } |
9717 | 9684 |
9718 // Deal with a normal eval call with a string argument. Compile it | 9685 // Deal with a normal eval call with a string argument. Compile it |
9719 // and return the compiled function bound in the local context. | 9686 // and return the compiled function bound in the local context. |
9720 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( | 9687 static const ParseRestriction restriction = NO_PARSE_RESTRICTION; |
9721 source, | 9688 Handle<JSFunction> compiled = Compiler::GetFunctionFromEval( |
9722 context, | 9689 source, context, language_mode, restriction, scope_position); |
9723 context->IsNativeContext(), | 9690 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, compiled, |
9724 language_mode, | |
9725 NO_PARSE_RESTRICTION, | |
9726 scope_position); | |
9727 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, shared, | |
9728 MakePair(Failure::Exception(), NULL)); | 9691 MakePair(Failure::Exception(), NULL)); |
9729 Handle<JSFunction> compiled = | |
9730 isolate->factory()->NewFunctionFromSharedFunctionInfo( | |
9731 shared, context, NOT_TENURED); | |
9732 return MakePair(*compiled, *receiver); | 9692 return MakePair(*compiled, *receiver); |
9733 } | 9693 } |
9734 | 9694 |
9735 | 9695 |
9736 RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) { | 9696 RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) { |
9737 HandleScope scope(isolate); | 9697 HandleScope scope(isolate); |
9738 ASSERT(args.length() == 5); | 9698 ASSERT(args.length() == 5); |
9739 | 9699 |
9740 Handle<Object> callee = args.at<Object>(0); | 9700 Handle<Object> callee = args.at<Object>(0); |
9741 | 9701 |
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12556 static_cast<BreakPositionAlignment>(statement_aligned_code); | 12516 static_cast<BreakPositionAlignment>(statement_aligned_code); |
12557 | 12517 |
12558 // Get the script from the script wrapper. | 12518 // Get the script from the script wrapper. |
12559 RUNTIME_ASSERT(wrapper->value()->IsScript()); | 12519 RUNTIME_ASSERT(wrapper->value()->IsScript()); |
12560 Handle<Script> script(Script::cast(wrapper->value())); | 12520 Handle<Script> script(Script::cast(wrapper->value())); |
12561 | 12521 |
12562 // Set break point. | 12522 // Set break point. |
12563 if (!isolate->debug()->SetBreakPointForScript(script, break_point_object_arg, | 12523 if (!isolate->debug()->SetBreakPointForScript(script, break_point_object_arg, |
12564 &source_position, | 12524 &source_position, |
12565 alignment)) { | 12525 alignment)) { |
12566 return isolate->heap()->undefined_value(); | 12526 return isolate->heap()->undefined_value(); |
12567 } | 12527 } |
12568 | 12528 |
12569 return Smi::FromInt(source_position); | 12529 return Smi::FromInt(source_position); |
12570 } | 12530 } |
12571 | 12531 |
12572 | 12532 |
12573 // Clear a break point | 12533 // Clear a break point |
12574 // args[0]: number: break point object | 12534 // args[0]: number: break point object |
12575 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearBreakPoint) { | 12535 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearBreakPoint) { |
12576 HandleScope scope(isolate); | 12536 HandleScope scope(isolate); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12716 Handle<Context> context, | 12676 Handle<Context> context, |
12717 Handle<Object> context_extension, | 12677 Handle<Object> context_extension, |
12718 Handle<Object> receiver, | 12678 Handle<Object> receiver, |
12719 Handle<String> source) { | 12679 Handle<String> source) { |
12720 if (context_extension->IsJSObject()) { | 12680 if (context_extension->IsJSObject()) { |
12721 Handle<JSObject> extension = Handle<JSObject>::cast(context_extension); | 12681 Handle<JSObject> extension = Handle<JSObject>::cast(context_extension); |
12722 Handle<JSFunction> closure(context->closure(), isolate); | 12682 Handle<JSFunction> closure(context->closure(), isolate); |
12723 context = isolate->factory()->NewWithContext(closure, context, extension); | 12683 context = isolate->factory()->NewWithContext(closure, context, extension); |
12724 } | 12684 } |
12725 | 12685 |
12726 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( | 12686 static const ParseRestriction restriction = NO_PARSE_RESTRICTION; |
titzer
2013/12/09 14:49:28
Why the extra local here?
Yang
2013/12/10 11:22:04
Removed.
| |
12727 source, | 12687 Handle<JSFunction> eval_fun = Compiler::GetFunctionFromEval( |
12728 context, | 12688 source, context, CLASSIC_MODE, restriction, RelocInfo::kNoPosition); |
12729 context->IsNativeContext(), | 12689 RETURN_IF_EMPTY_HANDLE(isolate, eval_fun); |
12730 CLASSIC_MODE, | |
12731 NO_PARSE_RESTRICTION, | |
12732 RelocInfo::kNoPosition); | |
12733 RETURN_IF_EMPTY_HANDLE(isolate, shared); | |
12734 | 12690 |
12735 Handle<JSFunction> eval_fun = | |
12736 isolate->factory()->NewFunctionFromSharedFunctionInfo( | |
12737 shared, context, NOT_TENURED); | |
12738 bool pending_exception; | 12691 bool pending_exception; |
12739 Handle<Object> result = Execution::Call( | 12692 Handle<Object> result = Execution::Call( |
12740 isolate, eval_fun, receiver, 0, NULL, &pending_exception); | 12693 isolate, eval_fun, receiver, 0, NULL, &pending_exception); |
12741 | 12694 |
12742 if (pending_exception) return Failure::Exception(); | 12695 if (pending_exception) return Failure::Exception(); |
12743 | 12696 |
12744 // Skip the global proxy as it has no properties and always delegates to the | 12697 // Skip the global proxy as it has no properties and always delegates to the |
12745 // real global object. | 12698 // real global object. |
12746 if (result->IsJSGlobalProxy()) { | 12699 if (result->IsJSGlobalProxy()) { |
12747 result = Handle<JSObject>(JSObject::cast(result->GetPrototype(isolate))); | 12700 result = Handle<JSObject>(JSObject::cast(result->GetPrototype(isolate))); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13143 return isolate->heap()->undefined_value(); | 13096 return isolate->heap()->undefined_value(); |
13144 } | 13097 } |
13145 | 13098 |
13146 | 13099 |
13147 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { | 13100 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { |
13148 HandleScope scope(isolate); | 13101 HandleScope scope(isolate); |
13149 #ifdef DEBUG | 13102 #ifdef DEBUG |
13150 ASSERT(args.length() == 1); | 13103 ASSERT(args.length() == 1); |
13151 // Get the function and make sure it is compiled. | 13104 // Get the function and make sure it is compiled. |
13152 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); | 13105 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); |
13153 if (!JSFunction::EnsureCompiled(func, KEEP_EXCEPTION)) { | 13106 if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) { |
13154 return Failure::Exception(); | 13107 return Failure::Exception(); |
13155 } | 13108 } |
13156 func->code()->PrintLn(); | 13109 func->code()->PrintLn(); |
13157 #endif // DEBUG | 13110 #endif // DEBUG |
13158 return isolate->heap()->undefined_value(); | 13111 return isolate->heap()->undefined_value(); |
13159 } | 13112 } |
13160 | 13113 |
13161 | 13114 |
13162 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { | 13115 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { |
13163 HandleScope scope(isolate); | 13116 HandleScope scope(isolate); |
13164 #ifdef DEBUG | 13117 #ifdef DEBUG |
13165 ASSERT(args.length() == 1); | 13118 ASSERT(args.length() == 1); |
13166 // Get the function and make sure it is compiled. | 13119 // Get the function and make sure it is compiled. |
13167 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); | 13120 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); |
13168 if (!JSFunction::EnsureCompiled(func, KEEP_EXCEPTION)) { | 13121 if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) { |
13169 return Failure::Exception(); | 13122 return Failure::Exception(); |
13170 } | 13123 } |
13171 func->shared()->construct_stub()->PrintLn(); | 13124 func->shared()->construct_stub()->PrintLn(); |
13172 #endif // DEBUG | 13125 #endif // DEBUG |
13173 return isolate->heap()->undefined_value(); | 13126 return isolate->heap()->undefined_value(); |
13174 } | 13127 } |
13175 | 13128 |
13176 | 13129 |
13177 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { | 13130 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { |
13178 SealHandleScope shs(isolate); | 13131 SealHandleScope shs(isolate); |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14893 // Handle last resort GC and make sure to allow future allocations | 14846 // Handle last resort GC and make sure to allow future allocations |
14894 // to grow the heap without causing GCs (if possible). | 14847 // to grow the heap without causing GCs (if possible). |
14895 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14848 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14896 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14849 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14897 "Runtime::PerformGC"); | 14850 "Runtime::PerformGC"); |
14898 } | 14851 } |
14899 } | 14852 } |
14900 | 14853 |
14901 | 14854 |
14902 } } // namespace v8::internal | 14855 } } // namespace v8::internal |
OLD | NEW |