Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: src/runtime.cc

Issue 34503003: Crankshaft builtins. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Self-review Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 } 2926 }
2927 2927
2928 // Mark both, the source and the target, as un-flushable because the 2928 // Mark both, the source and the target, as un-flushable because the
2929 // shared unoptimized code makes them impossible to enqueue in a list. 2929 // shared unoptimized code makes them impossible to enqueue in a list.
2930 ASSERT(target_shared->code()->gc_metadata() == NULL); 2930 ASSERT(target_shared->code()->gc_metadata() == NULL);
2931 ASSERT(source_shared->code()->gc_metadata() == NULL); 2931 ASSERT(source_shared->code()->gc_metadata() == NULL);
2932 target_shared->set_dont_flush(true); 2932 target_shared->set_dont_flush(true);
2933 source_shared->set_dont_flush(true); 2933 source_shared->set_dont_flush(true);
2934 2934
2935 // Set the code, scope info, formal parameter count, and the length 2935 // Set the code, scope info, formal parameter count, and the length
2936 // of the target shared function info. Set the source code of the 2936 // of the target shared function info.
2937 // target function to undefined. SetCode is only used for built-in
2938 // constructors like String, Array, and Object, and some web code
2939 // doesn't like seeing source code for constructors.
2940 target_shared->ReplaceCode(source_shared->code());
Michael Starzinger 2013/10/22 17:01:28 I have the feeling that removing the call to Share
Dmitry Lomov (no reviews) 2013/10/22 19:25:03 See below line 2951 where the call to ReplaceCode
Michael Starzinger 2013/10/23 08:05:20 Nope, SharedFunctionInfo::ReplaceCode and JSFuncti
Dmitry Lomov (no reviews) 2013/10/23 08:21:19 Rats, you are right.
2941 target_shared->set_scope_info(source_shared->scope_info()); 2937 target_shared->set_scope_info(source_shared->scope_info());
2942 target_shared->set_length(source_shared->length()); 2938 target_shared->set_length(source_shared->length());
2943 target_shared->set_formal_parameter_count( 2939 target_shared->set_formal_parameter_count(
2944 source_shared->formal_parameter_count()); 2940 source_shared->formal_parameter_count());
2945 target_shared->set_script(isolate->heap()->undefined_value()); 2941 target_shared->set_script(source_shared->script());
2946 2942 target_shared->set_start_position_and_type(
2947 // Since we don't store the source we should never optimize this. 2943 source_shared->start_position_and_type());
2948 target_shared->code()->set_optimizable(false); 2944 target_shared->set_end_position(source_shared->end_position());
2945 bool was_native = target_shared->native();
2946 target_shared->set_compiler_hints(source_shared->compiler_hints());
2947 target_shared->set_native(was_native);
2949 2948
2950 // Set the code of the target function. 2949 // Set the code of the target function.
2951 target->ReplaceCode(source_shared->code()); 2950 target->ReplaceCode(source_shared->code());
2952 ASSERT(target->next_function_link()->IsUndefined()); 2951 ASSERT(target->next_function_link()->IsUndefined());
2953 2952
2954 // Make sure we get a fresh copy of the literal vector to avoid cross 2953 // Make sure we get a fresh copy of the literal vector to avoid cross
2955 // context contamination. 2954 // context contamination.
2956 Handle<Context> context(source->context()); 2955 Handle<Context> context(source->context());
2957 int number_of_literals = source->NumberOfLiterals(); 2956 int number_of_literals = source->NumberOfLiterals();
2958 Handle<FixedArray> literals = 2957 Handle<FixedArray> literals =
(...skipping 5380 matching lines...) Expand 10 before | Expand all | Expand 10 after
8339 8338
8340 8339
8341 bool AllowOptimization(Isolate* isolate, Handle<JSFunction> function) { 8340 bool AllowOptimization(Isolate* isolate, Handle<JSFunction> function) {
8342 // If the function is not compiled ignore the lazy 8341 // If the function is not compiled ignore the lazy
8343 // recompilation. This can happen if the debugger is activated and 8342 // recompilation. This can happen if the debugger is activated and
8344 // the function is returned to the not compiled state. 8343 // the function is returned to the not compiled state.
8345 if (!function->shared()->is_compiled()) return false; 8344 if (!function->shared()->is_compiled()) return false;
8346 8345
8347 // If the function is not optimizable or debugger is active continue using the 8346 // If the function is not optimizable or debugger is active continue using the
8348 // code from the full compiler. 8347 // code from the full compiler.
8349 if (!FLAG_crankshaft || 8348 if (!isolate->use_crankshaft() ||
8350 function->shared()->optimization_disabled() || 8349 function->shared()->optimization_disabled() ||
8351 isolate->DebuggerHasBreakPoints()) { 8350 isolate->DebuggerHasBreakPoints()) {
8352 if (FLAG_trace_opt) { 8351 if (FLAG_trace_opt) {
8353 PrintF("[failed to optimize "); 8352 PrintF("[failed to optimize ");
8354 function->PrintName(); 8353 function->PrintName();
8355 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", 8354 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n",
8356 function->shared()->optimization_disabled() ? "F" : "T", 8355 function->shared()->optimization_disabled() ? "F" : "T",
8357 isolate->DebuggerHasBreakPoints() ? "T" : "F"); 8356 isolate->DebuggerHasBreakPoints() ? "T" : "F");
8358 } 8357 }
8359 return false; 8358 return false;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
8621 ASSERT(args.length() == 1); 8620 ASSERT(args.length() == 1);
8622 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8621 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8623 return Smi::FromInt(function->shared()->opt_count()); 8622 return Smi::FromInt(function->shared()->opt_count());
8624 } 8623 }
8625 8624
8626 8625
8627 static bool IsSuitableForOnStackReplacement(Isolate* isolate, 8626 static bool IsSuitableForOnStackReplacement(Isolate* isolate,
8628 Handle<JSFunction> function, 8627 Handle<JSFunction> function,
8629 Handle<Code> unoptimized) { 8628 Handle<Code> unoptimized) {
8630 // Keep track of whether we've succeeded in optimizing. 8629 // Keep track of whether we've succeeded in optimizing.
8631 if (!unoptimized->optimizable()) return false; 8630 if (!isolate->use_crankshaft() || !unoptimized->optimizable()) return false;
8632 // If we are trying to do OSR when there are already optimized 8631 // If we are trying to do OSR when there are already optimized
8633 // activations of the function, it means (a) the function is directly or 8632 // activations of the function, it means (a) the function is directly or
8634 // indirectly recursive and (b) an optimized invocation has been 8633 // indirectly recursive and (b) an optimized invocation has been
8635 // deoptimized so that we are currently in an unoptimized activation. 8634 // deoptimized so that we are currently in an unoptimized activation.
8636 // Check for optimized activations of this function. 8635 // Check for optimized activations of this function.
8637 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) { 8636 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
8638 JavaScriptFrame* frame = it.frame(); 8637 JavaScriptFrame* frame = it.frame();
8639 if (frame->is_optimized() && frame->function() == *function) return false; 8638 if (frame->is_optimized() && frame->function() == *function) return false;
8640 } 8639 }
8641 8640
(...skipping 6224 matching lines...) Expand 10 before | Expand all | Expand 10 after
14866 // Handle last resort GC and make sure to allow future allocations 14865 // Handle last resort GC and make sure to allow future allocations
14867 // to grow the heap without causing GCs (if possible). 14866 // to grow the heap without causing GCs (if possible).
14868 isolate->counters()->gc_last_resort_from_js()->Increment(); 14867 isolate->counters()->gc_last_resort_from_js()->Increment();
14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14868 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14870 "Runtime::PerformGC"); 14869 "Runtime::PerformGC");
14871 } 14870 }
14872 } 14871 }
14873 14872
14874 14873
14875 } } // namespace v8::internal 14874 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | src/x64/lithium-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698