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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 // Compute the function template for the native function. | 1865 // Compute the function template for the native function. |
1866 v8::Handle<v8::FunctionTemplate> fun_template = | 1866 v8::Handle<v8::FunctionTemplate> fun_template = |
1867 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); | 1867 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); |
1868 ASSERT(!fun_template.IsEmpty()); | 1868 ASSERT(!fun_template.IsEmpty()); |
1869 | 1869 |
1870 // Instantiate the function and create a shared function info from it. | 1870 // Instantiate the function and create a shared function info from it. |
1871 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); | 1871 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); |
1872 const int literals = fun->NumberOfLiterals(); | 1872 const int literals = fun->NumberOfLiterals(); |
1873 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1873 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
1874 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1874 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
| 1875 bool is_generator = false; |
1875 Handle<SharedFunctionInfo> shared = | 1876 Handle<SharedFunctionInfo> shared = |
1876 isolate()->factory()->NewSharedFunctionInfo(name, literals, code, | 1877 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator, |
1877 Handle<ScopeInfo>(fun->shared()->scope_info())); | 1878 code, Handle<ScopeInfo>(fun->shared()->scope_info())); |
1878 shared->set_construct_stub(*construct_stub); | 1879 shared->set_construct_stub(*construct_stub); |
1879 | 1880 |
1880 // Copy the function data to the shared function info. | 1881 // Copy the function data to the shared function info. |
1881 shared->set_function_data(fun->shared()->function_data()); | 1882 shared->set_function_data(fun->shared()->function_data()); |
1882 int parameters = fun->shared()->formal_parameter_count(); | 1883 int parameters = fun->shared()->formal_parameter_count(); |
1883 shared->set_formal_parameter_count(parameters); | 1884 shared->set_formal_parameter_count(parameters); |
1884 | 1885 |
1885 // TODO(1240846): It's weird that native function declarations are | 1886 // TODO(1240846): It's weird that native function declarations are |
1886 // introduced dynamically when we meet their declarations, whereas | 1887 // introduced dynamically when we meet their declarations, whereas |
1887 // other functions are set up when entering the surrounding scope. | 1888 // other functions are set up when entering the surrounding scope. |
(...skipping 4119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6007 ASSERT(info()->isolate()->has_pending_exception()); | 6008 ASSERT(info()->isolate()->has_pending_exception()); |
6008 } else { | 6009 } else { |
6009 result = ParseProgram(); | 6010 result = ParseProgram(); |
6010 } | 6011 } |
6011 } | 6012 } |
6012 info()->SetFunction(result); | 6013 info()->SetFunction(result); |
6013 return (result != NULL); | 6014 return (result != NULL); |
6014 } | 6015 } |
6015 | 6016 |
6016 } } // namespace v8::internal | 6017 } } // namespace v8::internal |
OLD | NEW |