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

Side by Side Diff: src/runtime.cc

Issue 18214005: Added %NeverOptimize runtime call that can disable optimizations for a method for tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/compiler/inline-arguments.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8328 matching lines...) Expand 10 before | Expand all | Expand 10 after
8339 } 8339 }
8340 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("parallel"))) { 8340 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("parallel"))) {
8341 function->MarkForParallelRecompilation(); 8341 function->MarkForParallelRecompilation();
8342 } 8342 }
8343 } 8343 }
8344 8344
8345 return isolate->heap()->undefined_value(); 8345 return isolate->heap()->undefined_value();
8346 } 8346 }
8347 8347
8348 8348
8349 static void MarkNeverOptimize(JSFunction *function) {
8350 Code *code = function->code();
8351 if (code != NULL && code->kind() == Code::FUNCTION) {
8352 code->set_optimizable(false);
8353 }
8354 Code *shared_code = function->shared()->code();
8355 if (shared_code != NULL && shared_code->kind() == Code::FUNCTION) {
8356 shared_code->set_optimizable(false);
8357 }
8358 }
8359
8360
8361 RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimize) {
8362 HandleScope scope(isolate);
8363
8364 if (args.length() == 0) {
8365 // mark the top frame as do not optimize
Jakob Kummerow 2013/07/11 15:23:33 nit: Begin with capitalization, end with punctuati
titzer 2013/07/11 15:29:02 Done. (fixed this before submitting).
8366 JavaScriptFrameIterator it(isolate);
8367 if (!it.done()) MarkNeverOptimize(JSFunction::cast(it.frame()->function()));
Jakob Kummerow 2013/07/11 15:23:33 Instead of rolling your own MarkNeverOptimize, I t
titzer 2013/07/11 15:29:02 I also did something similar prior to submit...as
8368 return isolate->heap()->undefined_value();
8369 }
8370
8371 // mark the passed functions as do not optimize
8372 for (int i = 0; i < args.length(); i++) {
8373 CONVERT_ARG_CHECKED(JSFunction, function, i);
8374 MarkNeverOptimize(function);
8375 }
8376 return isolate->heap()->undefined_value();
8377 }
8378
8379
8349 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) { 8380 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) {
8350 HandleScope scope(isolate); 8381 HandleScope scope(isolate);
8351 ASSERT(args.length() == 1); 8382 ASSERT(args.length() == 1);
8352 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8383 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8353 if (FLAG_parallel_recompilation && V8::UseCrankshaft()) { 8384 if (FLAG_parallel_recompilation && V8::UseCrankshaft()) {
8354 // While function is in optimization pipeline, it is marked accordingly. 8385 // While function is in optimization pipeline, it is marked accordingly.
8355 // Note that if the debugger is activated during parallel recompilation, 8386 // Note that if the debugger is activated during parallel recompilation,
8356 // the function will be marked with the lazy-recompile builtin, which is 8387 // the function will be marked with the lazy-recompile builtin, which is
8357 // not related to parallel recompilation. 8388 // not related to parallel recompilation.
8358 while (function->IsMarkedForParallelRecompilation() || 8389 while (function->IsMarkedForParallelRecompilation() ||
(...skipping 5637 matching lines...) Expand 10 before | Expand all | Expand 10 after
13996 // Handle last resort GC and make sure to allow future allocations 14027 // Handle last resort GC and make sure to allow future allocations
13997 // to grow the heap without causing GCs (if possible). 14028 // to grow the heap without causing GCs (if possible).
13998 isolate->counters()->gc_last_resort_from_js()->Increment(); 14029 isolate->counters()->gc_last_resort_from_js()->Increment();
13999 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14030 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14000 "Runtime::PerformGC"); 14031 "Runtime::PerformGC");
14001 } 14032 }
14002 } 14033 }
14003 14034
14004 14035
14005 } } // namespace v8::internal 14036 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/compiler/inline-arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698