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

Side by Side Diff: src/execution.cc

Issue 24071002: add uncached Function::New (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/apinatives.js ('k') | src/macros.py » ('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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return factory->undefined_value(); 698 return factory->undefined_value();
699 } 699 }
700 return result; 700 return result;
701 } 701 }
702 702
703 703
704 Handle<JSFunction> Execution::InstantiateFunction( 704 Handle<JSFunction> Execution::InstantiateFunction(
705 Handle<FunctionTemplateInfo> data, 705 Handle<FunctionTemplateInfo> data,
706 bool* exc) { 706 bool* exc) {
707 Isolate* isolate = data->GetIsolate(); 707 Isolate* isolate = data->GetIsolate();
708 // Fast case: see if the function has already been instantiated 708 if (!data->do_not_cache()) {
709 int serial_number = Smi::cast(data->serial_number())->value(); 709 // Fast case: see if the function has already been instantiated
710 Object* elm = 710 int serial_number = Smi::cast(data->serial_number())->value();
711 isolate->native_context()->function_cache()-> 711 Object* elm =
712 GetElementNoExceptionThrown(isolate, serial_number); 712 isolate->native_context()->function_cache()->
713 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); 713 GetElementNoExceptionThrown(isolate, serial_number);
714 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm));
715 }
714 // The function has not yet been instantiated in this context; do it. 716 // The function has not yet been instantiated in this context; do it.
715 Handle<Object> args[] = { data }; 717 Handle<Object> args[] = { data };
716 Handle<Object> result = Call(isolate, 718 Handle<Object> result = Call(isolate,
717 isolate->instantiate_fun(), 719 isolate->instantiate_fun(),
718 isolate->js_builtins_object(), 720 isolate->js_builtins_object(),
719 ARRAY_SIZE(args), 721 ARRAY_SIZE(args),
720 args, 722 args,
721 exc); 723 exc);
722 if (*exc) return Handle<JSFunction>::null(); 724 if (*exc) return Handle<JSFunction>::null();
723 return Handle<JSFunction>::cast(result); 725 return Handle<JSFunction>::cast(result);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 933 }
932 if (stack_guard->IsFullDeopt()) { 934 if (stack_guard->IsFullDeopt()) {
933 stack_guard->Continue(FULL_DEOPT); 935 stack_guard->Continue(FULL_DEOPT);
934 Deoptimizer::DeoptimizeAll(isolate); 936 Deoptimizer::DeoptimizeAll(isolate);
935 } 937 }
936 return isolate->heap()->undefined_value(); 938 return isolate->heap()->undefined_value();
937 } 939 }
938 940
939 941
940 } } // namespace v8::internal 942 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/apinatives.js ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698