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

Side by Side Diff: src/runtime.cc

Issue 3120006: Put direct code pointers into JSFunction objects. This is a first step... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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/objects-inl.h ('k') | src/serialize.h » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 RUNTIME_ASSERT(code->IsJSFunction()); 1620 RUNTIME_ASSERT(code->IsJSFunction());
1621 Handle<JSFunction> fun = Handle<JSFunction>::cast(code); 1621 Handle<JSFunction> fun = Handle<JSFunction>::cast(code);
1622 Handle<SharedFunctionInfo> shared(fun->shared()); 1622 Handle<SharedFunctionInfo> shared(fun->shared());
1623 SetExpectedNofProperties(target, shared->expected_nof_properties()); 1623 SetExpectedNofProperties(target, shared->expected_nof_properties());
1624 1624
1625 if (!EnsureCompiled(shared, KEEP_EXCEPTION)) { 1625 if (!EnsureCompiled(shared, KEEP_EXCEPTION)) {
1626 return Failure::Exception(); 1626 return Failure::Exception();
1627 } 1627 }
1628 // Set the code, scope info, formal parameter count, 1628 // Set the code, scope info, formal parameter count,
1629 // and the length of the target function. 1629 // and the length of the target function.
1630 target->set_code(fun->code()); 1630 target->shared()->set_code(shared->code());
1631 target->set_code(shared->code());
1631 target->shared()->set_scope_info(shared->scope_info()); 1632 target->shared()->set_scope_info(shared->scope_info());
1632 target->shared()->set_length(shared->length()); 1633 target->shared()->set_length(shared->length());
1633 target->shared()->set_formal_parameter_count( 1634 target->shared()->set_formal_parameter_count(
1634 shared->formal_parameter_count()); 1635 shared->formal_parameter_count());
1635 // Set the source code of the target function to undefined. 1636 // Set the source code of the target function to undefined.
1636 // SetCode is only used for built-in constructors like String, 1637 // SetCode is only used for built-in constructors like String,
1637 // Array, and Object, and some web code 1638 // Array, and Object, and some web code
1638 // doesn't like seeing source code for constructors. 1639 // doesn't like seeing source code for constructors.
1639 target->shared()->set_script(Heap::undefined_value()); 1640 target->shared()->set_script(Heap::undefined_value());
1640 // Clear the optimization hints related to the compiled code as these are no 1641 // Clear the optimization hints related to the compiled code as these are no
(...skipping 5222 matching lines...) Expand 10 before | Expand all | Expand 10 after
6863 return *result; 6864 return *result;
6864 } 6865 }
6865 6866
6866 6867
6867 static Object* Runtime_LazyCompile(Arguments args) { 6868 static Object* Runtime_LazyCompile(Arguments args) {
6868 HandleScope scope; 6869 HandleScope scope;
6869 ASSERT(args.length() == 1); 6870 ASSERT(args.length() == 1);
6870 6871
6871 Handle<JSFunction> function = args.at<JSFunction>(0); 6872 Handle<JSFunction> function = args.at<JSFunction>(0);
6872 #ifdef DEBUG 6873 #ifdef DEBUG
6873 if (FLAG_trace_lazy) { 6874 if (FLAG_trace_lazy && !function->shared()->is_compiled()) {
6874 PrintF("[lazy: "); 6875 PrintF("[lazy: ");
6875 function->shared()->name()->Print(); 6876 function->shared()->name()->Print();
6876 PrintF("]\n"); 6877 PrintF("]\n");
6877 } 6878 }
6878 #endif 6879 #endif
6879 6880
6880 // Compile the target function. Here we compile using CompileLazyInLoop in 6881 // Compile the target function. Here we compile using CompileLazyInLoop in
6881 // order to get the optimized version. This helps code like delta-blue 6882 // order to get the optimized version. This helps code like delta-blue
6882 // that calls performance-critical routines through constructors. A 6883 // that calls performance-critical routines through constructors. A
6883 // constructor call doesn't use a CallIC, it uses a LoadIC followed by a 6884 // constructor call doesn't use a CallIC, it uses a LoadIC followed by a
(...skipping 3736 matching lines...) Expand 10 before | Expand all | Expand 10 after
10620 } else { 10621 } else {
10621 // Handle last resort GC and make sure to allow future allocations 10622 // Handle last resort GC and make sure to allow future allocations
10622 // to grow the heap without causing GCs (if possible). 10623 // to grow the heap without causing GCs (if possible).
10623 Counters::gc_last_resort_from_js.Increment(); 10624 Counters::gc_last_resort_from_js.Increment();
10624 Heap::CollectAllGarbage(false); 10625 Heap::CollectAllGarbage(false);
10625 } 10626 }
10626 } 10627 }
10627 10628
10628 10629
10629 } } // namespace v8::internal 10630 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698