OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 | 1957 |
1958 // Instantiate the function and create a boilerplate function from it. | 1958 // Instantiate the function and create a boilerplate function from it. |
1959 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); | 1959 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); |
1960 const int literals = fun->NumberOfLiterals(); | 1960 const int literals = fun->NumberOfLiterals(); |
1961 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1961 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
1962 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1962 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
1963 Handle<JSFunction> boilerplate = | 1963 Handle<JSFunction> boilerplate = |
1964 Factory::NewFunctionBoilerplate(name, literals, code); | 1964 Factory::NewFunctionBoilerplate(name, literals, code); |
1965 boilerplate->shared()->set_construct_stub(*construct_stub); | 1965 boilerplate->shared()->set_construct_stub(*construct_stub); |
1966 | 1966 |
1967 // Copy the function data to the boilerplate. Used by | 1967 // Copy the function data to the boilerplate. |
1968 // builtins.cc:HandleApiCall to perform argument type checks and to | |
1969 // find the right native code to call. | |
1970 boilerplate->shared()->set_function_data(fun->shared()->function_data()); | 1968 boilerplate->shared()->set_function_data(fun->shared()->function_data()); |
1971 int parameters = fun->shared()->formal_parameter_count(); | 1969 int parameters = fun->shared()->formal_parameter_count(); |
1972 boilerplate->shared()->set_formal_parameter_count(parameters); | 1970 boilerplate->shared()->set_formal_parameter_count(parameters); |
1973 | 1971 |
1974 // TODO(1240846): It's weird that native function declarations are | 1972 // TODO(1240846): It's weird that native function declarations are |
1975 // introduced dynamically when we meet their declarations, whereas | 1973 // introduced dynamically when we meet their declarations, whereas |
1976 // other functions are setup when entering the surrounding scope. | 1974 // other functions are setup when entering the surrounding scope. |
1977 FunctionBoilerplateLiteral* lit = | 1975 FunctionBoilerplateLiteral* lit = |
1978 NEW(FunctionBoilerplateLiteral(boilerplate)); | 1976 NEW(FunctionBoilerplateLiteral(boilerplate)); |
1979 VariableProxy* var = Declare(name, Variable::VAR, NULL, true, CHECK_OK); | 1977 VariableProxy* var = Declare(name, Variable::VAR, NULL, true, CHECK_OK); |
(...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5144 parser.ParseLazy(script_source, name, | 5142 parser.ParseLazy(script_source, name, |
5145 start_position, end_position, is_expression); | 5143 start_position, end_position, is_expression); |
5146 return result; | 5144 return result; |
5147 } | 5145 } |
5148 | 5146 |
5149 | 5147 |
5150 #undef NEW | 5148 #undef NEW |
5151 | 5149 |
5152 | 5150 |
5153 } } // namespace v8::internal | 5151 } } // namespace v8::internal |
OLD | NEW |