| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 // Compute the function template for the native function. | 1961 // Compute the function template for the native function. |
| 1962 v8::Handle<v8::FunctionTemplate> fun_template = | 1962 v8::Handle<v8::FunctionTemplate> fun_template = |
| 1963 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); | 1963 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); |
| 1964 ASSERT(!fun_template.IsEmpty()); | 1964 ASSERT(!fun_template.IsEmpty()); |
| 1965 | 1965 |
| 1966 // Instantiate the function and create a shared function info from it. | 1966 // Instantiate the function and create a shared function info from it. |
| 1967 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); | 1967 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); |
| 1968 const int literals = fun->NumberOfLiterals(); | 1968 const int literals = fun->NumberOfLiterals(); |
| 1969 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1969 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
| 1970 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1970 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
| 1971 Handle<SharedFunctionInfo> shared = | 1971 Handle<SharedFunctionInfo> shared = Factory::NewSharedFunctionInfo( |
| 1972 Factory::NewSharedFunctionInfo(name, literals, code); | 1972 name, literals, code, Handle<Object>(fun->shared()->scope_info())); |
| 1973 shared->set_construct_stub(*construct_stub); | 1973 shared->set_construct_stub(*construct_stub); |
| 1974 | 1974 |
| 1975 // Copy the function data to the shared function info. | 1975 // Copy the function data to the shared function info. |
| 1976 shared->set_function_data(fun->shared()->function_data()); | 1976 shared->set_function_data(fun->shared()->function_data()); |
| 1977 int parameters = fun->shared()->formal_parameter_count(); | 1977 int parameters = fun->shared()->formal_parameter_count(); |
| 1978 shared->set_formal_parameter_count(parameters); | 1978 shared->set_formal_parameter_count(parameters); |
| 1979 | 1979 |
| 1980 // TODO(1240846): It's weird that native function declarations are | 1980 // TODO(1240846): It's weird that native function declarations are |
| 1981 // introduced dynamically when we meet their declarations, whereas | 1981 // introduced dynamically when we meet their declarations, whereas |
| 1982 // other functions are setup when entering the surrounding scope. | 1982 // other functions are setup when entering the surrounding scope. |
| (...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5196 parser.ParseLazy(script_source, name, | 5196 parser.ParseLazy(script_source, name, |
| 5197 start_position, end_position, is_expression); | 5197 start_position, end_position, is_expression); |
| 5198 return result; | 5198 return result; |
| 5199 } | 5199 } |
| 5200 | 5200 |
| 5201 | 5201 |
| 5202 #undef NEW | 5202 #undef NEW |
| 5203 | 5203 |
| 5204 | 5204 |
| 5205 } } // namespace v8::internal | 5205 } } // namespace v8::internal |
| OLD | NEW |