| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 #include "api.h" | 30 #include "api.h" |
| 31 #include "ast.h" | 31 #include "ast.h" |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "codegen.h" | 33 #include "codegen.h" |
| 34 #include "compiler.h" | 34 #include "compiler.h" |
| 35 #include "messages.h" | 35 #include "messages.h" |
| 36 #include "parser.h" | 36 #include "parser.h" |
| 37 #include "platform.h" | 37 #include "platform.h" |
| 38 #include "runtime.h" | 38 #include "runtime.h" |
| 39 #include "scopeinfo.h" |
| 39 #include "scopes.h" | 40 #include "scopes.h" |
| 40 #include "string-stream.h" | 41 #include "string-stream.h" |
| 41 | 42 |
| 42 #include "ast-inl.h" | 43 #include "ast-inl.h" |
| 43 #include "jump-target-inl.h" | 44 #include "jump-target-inl.h" |
| 44 | 45 |
| 45 namespace v8 { | 46 namespace v8 { |
| 46 namespace internal { | 47 namespace internal { |
| 47 | 48 |
| 48 class ParserFactory; | 49 class ParserFactory; |
| (...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 // Compute the function template for the native function. | 1962 // Compute the function template for the native function. |
| 1962 v8::Handle<v8::FunctionTemplate> fun_template = | 1963 v8::Handle<v8::FunctionTemplate> fun_template = |
| 1963 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); | 1964 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); |
| 1964 ASSERT(!fun_template.IsEmpty()); | 1965 ASSERT(!fun_template.IsEmpty()); |
| 1965 | 1966 |
| 1966 // Instantiate the function and create a shared function info from it. | 1967 // Instantiate the function and create a shared function info from it. |
| 1967 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); | 1968 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); |
| 1968 const int literals = fun->NumberOfLiterals(); | 1969 const int literals = fun->NumberOfLiterals(); |
| 1969 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1970 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
| 1970 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1971 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
| 1971 Handle<SharedFunctionInfo> shared = Factory::NewSharedFunctionInfo( | 1972 Handle<SharedFunctionInfo> shared = |
| 1972 name, literals, code, Handle<Object>(fun->shared()->scope_info())); | 1973 Factory::NewSharedFunctionInfo(name, literals, code, |
| 1974 Handle<SerializedScopeInfo>(fun->shared()->scope_info())); |
| 1973 shared->set_construct_stub(*construct_stub); | 1975 shared->set_construct_stub(*construct_stub); |
| 1974 | 1976 |
| 1975 // Copy the function data to the shared function info. | 1977 // Copy the function data to the shared function info. |
| 1976 shared->set_function_data(fun->shared()->function_data()); | 1978 shared->set_function_data(fun->shared()->function_data()); |
| 1977 int parameters = fun->shared()->formal_parameter_count(); | 1979 int parameters = fun->shared()->formal_parameter_count(); |
| 1978 shared->set_formal_parameter_count(parameters); | 1980 shared->set_formal_parameter_count(parameters); |
| 1979 | 1981 |
| 1980 // TODO(1240846): It's weird that native function declarations are | 1982 // TODO(1240846): It's weird that native function declarations are |
| 1981 // introduced dynamically when we meet their declarations, whereas | 1983 // introduced dynamically when we meet their declarations, whereas |
| 1982 // other functions are setup when entering the surrounding scope. | 1984 // 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, | 5198 parser.ParseLazy(script_source, name, |
| 5197 start_position, end_position, is_expression); | 5199 start_position, end_position, is_expression); |
| 5198 return result; | 5200 return result; |
| 5199 } | 5201 } |
| 5200 | 5202 |
| 5201 | 5203 |
| 5202 #undef NEW | 5204 #undef NEW |
| 5203 | 5205 |
| 5204 | 5206 |
| 5205 } } // namespace v8::internal | 5207 } } // namespace v8::internal |
| OLD | NEW |