OLD | NEW |
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 Loading... |
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 if (!data->do_not_cache()) { | 708 // Fast case: see if the function has already been instantiated |
709 // Fast case: see if the function has already been instantiated | 709 int serial_number = Smi::cast(data->serial_number())->value(); |
710 int serial_number = Smi::cast(data->serial_number())->value(); | 710 Object* elm = |
711 Object* elm = | 711 isolate->native_context()->function_cache()-> |
712 isolate->native_context()->function_cache()-> | 712 GetElementNoExceptionThrown(isolate, serial_number); |
713 GetElementNoExceptionThrown(isolate, serial_number); | 713 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); |
714 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); | |
715 } | |
716 // The function has not yet been instantiated in this context; do it. | 714 // The function has not yet been instantiated in this context; do it. |
717 Handle<Object> args[] = { data }; | 715 Handle<Object> args[] = { data }; |
718 Handle<Object> result = Call(isolate, | 716 Handle<Object> result = Call(isolate, |
719 isolate->instantiate_fun(), | 717 isolate->instantiate_fun(), |
720 isolate->js_builtins_object(), | 718 isolate->js_builtins_object(), |
721 ARRAY_SIZE(args), | 719 ARRAY_SIZE(args), |
722 args, | 720 args, |
723 exc); | 721 exc); |
724 if (*exc) return Handle<JSFunction>::null(); | 722 if (*exc) return Handle<JSFunction>::null(); |
725 return Handle<JSFunction>::cast(result); | 723 return Handle<JSFunction>::cast(result); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 } | 931 } |
934 if (stack_guard->IsFullDeopt()) { | 932 if (stack_guard->IsFullDeopt()) { |
935 stack_guard->Continue(FULL_DEOPT); | 933 stack_guard->Continue(FULL_DEOPT); |
936 Deoptimizer::DeoptimizeAll(isolate); | 934 Deoptimizer::DeoptimizeAll(isolate); |
937 } | 935 } |
938 return isolate->heap()->undefined_value(); | 936 return isolate->heap()->undefined_value(); |
939 } | 937 } |
940 | 938 |
941 | 939 |
942 } } // namespace v8::internal | 940 } } // namespace v8::internal |
OLD | NEW |