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

Side by Side Diff: src/runtime.cc

Issue 10542002: Replace SharedFunctionInfo::EnsureCompiled with JSFunction::CompileLazy where possible. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 8 years, 6 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/bootstrapper.cc ('k') | no next file » | 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 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2175 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); 2175 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
2176 Handle<Object> code = args.at<Object>(1); 2176 Handle<Object> code = args.at<Object>(1);
2177 2177
2178 Handle<Context> context(target->context()); 2178 Handle<Context> context(target->context());
2179 2179
2180 if (!code->IsNull()) { 2180 if (!code->IsNull()) {
2181 RUNTIME_ASSERT(code->IsJSFunction()); 2181 RUNTIME_ASSERT(code->IsJSFunction());
2182 Handle<JSFunction> fun = Handle<JSFunction>::cast(code); 2182 Handle<JSFunction> fun = Handle<JSFunction>::cast(code);
2183 Handle<SharedFunctionInfo> shared(fun->shared()); 2183 Handle<SharedFunctionInfo> shared(fun->shared());
2184 2184
2185 if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { 2185 if (!JSFunction::CompileLazy(fun, KEEP_EXCEPTION)) {
2186 return Failure::Exception(); 2186 return Failure::Exception();
2187 } 2187 }
2188 // Since we don't store the source for this we should never 2188 // Since we don't store the source for this we should never
2189 // optimize this. 2189 // optimize this.
2190 shared->code()->set_optimizable(false); 2190 shared->code()->set_optimizable(false);
2191 // Set the code, scope info, formal parameter count, 2191 // Set the code, scope info, formal parameter count,
2192 // and the length of the target function. 2192 // and the length of the target function.
2193 target->shared()->set_code(shared->code()); 2193 target->shared()->set_code(shared->code());
2194 target->ReplaceCode(shared->code()); 2194 target->ReplaceCode(shared->code());
2195 target->shared()->set_scope_info(shared->scope_info()); 2195 target->shared()->set_scope_info(shared->scope_info());
(...skipping 10300 matching lines...) Expand 10 before | Expand all | Expand 10 after
12496 return isolate->heap()->undefined_value(); 12496 return isolate->heap()->undefined_value();
12497 } 12497 }
12498 12498
12499 12499
12500 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { 12500 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) {
12501 #ifdef DEBUG 12501 #ifdef DEBUG
12502 HandleScope scope(isolate); 12502 HandleScope scope(isolate);
12503 ASSERT(args.length() == 1); 12503 ASSERT(args.length() == 1);
12504 // Get the function and make sure it is compiled. 12504 // Get the function and make sure it is compiled.
12505 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); 12505 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
12506 Handle<SharedFunctionInfo> shared(func->shared()); 12506 if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) {
12507 if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) {
12508 return Failure::Exception(); 12507 return Failure::Exception();
12509 } 12508 }
12510 func->code()->PrintLn(); 12509 func->code()->PrintLn();
12511 #endif // DEBUG 12510 #endif // DEBUG
12512 return isolate->heap()->undefined_value(); 12511 return isolate->heap()->undefined_value();
12513 } 12512 }
12514 12513
12515 12514
12516 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { 12515 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) {
12517 #ifdef DEBUG 12516 #ifdef DEBUG
12518 HandleScope scope(isolate); 12517 HandleScope scope(isolate);
12519 ASSERT(args.length() == 1); 12518 ASSERT(args.length() == 1);
12520 // Get the function and make sure it is compiled. 12519 // Get the function and make sure it is compiled.
12521 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); 12520 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
12522 Handle<SharedFunctionInfo> shared(func->shared()); 12521 if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) {
12523 if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) {
12524 return Failure::Exception(); 12522 return Failure::Exception();
12525 } 12523 }
12526 shared->construct_stub()->PrintLn(); 12524 func->shared()->construct_stub()->PrintLn();
12527 #endif // DEBUG 12525 #endif // DEBUG
12528 return isolate->heap()->undefined_value(); 12526 return isolate->heap()->undefined_value();
12529 } 12527 }
12530 12528
12531 12529
12532 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { 12530 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) {
12533 NoHandleAllocation ha; 12531 NoHandleAllocation ha;
12534 ASSERT(args.length() == 1); 12532 ASSERT(args.length() == 1);
12535 12533
12536 CONVERT_ARG_CHECKED(JSFunction, f, 0); 12534 CONVERT_ARG_CHECKED(JSFunction, f, 0);
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
13557 // Handle last resort GC and make sure to allow future allocations 13555 // Handle last resort GC and make sure to allow future allocations
13558 // to grow the heap without causing GCs (if possible). 13556 // to grow the heap without causing GCs (if possible).
13559 isolate->counters()->gc_last_resort_from_js()->Increment(); 13557 isolate->counters()->gc_last_resort_from_js()->Increment();
13560 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13558 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13561 "Runtime::PerformGC"); 13559 "Runtime::PerformGC");
13562 } 13560 }
13563 } 13561 }
13564 13562
13565 13563
13566 } } // namespace v8::internal 13564 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698