Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: src/parser.cc

Issue 551063: Fixed issue 582: set the right construct stub for native functions. (Closed)
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 1861
1862 // Compute the function template for the native function. 1862 // Compute the function template for the native function.
1863 v8::Handle<v8::FunctionTemplate> fun_template = 1863 v8::Handle<v8::FunctionTemplate> fun_template =
1864 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); 1864 extension_->GetNativeFunction(v8::Utils::ToLocal(name));
1865 ASSERT(!fun_template.IsEmpty()); 1865 ASSERT(!fun_template.IsEmpty());
1866 1866
1867 // Instantiate the function and create a boilerplate function from it. 1867 // Instantiate the function and create a boilerplate function from it.
1868 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); 1868 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction());
1869 const int literals = fun->NumberOfLiterals(); 1869 const int literals = fun->NumberOfLiterals();
1870 Handle<Code> code = Handle<Code>(fun->shared()->code()); 1870 Handle<Code> code = Handle<Code>(fun->shared()->code());
1871 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1871 Handle<JSFunction> boilerplate = 1872 Handle<JSFunction> boilerplate =
1872 Factory::NewFunctionBoilerplate(name, literals, code); 1873 Factory::NewFunctionBoilerplate(name, literals, code);
1874 boilerplate->shared()->set_construct_stub(*construct_stub);
1873 1875
1874 // Copy the function data to the boilerplate. Used by 1876 // Copy the function data to the boilerplate. Used by
1875 // builtins.cc:HandleApiCall to perform argument type checks and to 1877 // builtins.cc:HandleApiCall to perform argument type checks and to
1876 // find the right native code to call. 1878 // find the right native code to call.
1877 boilerplate->shared()->set_function_data(fun->shared()->function_data()); 1879 boilerplate->shared()->set_function_data(fun->shared()->function_data());
1878 int parameters = fun->shared()->formal_parameter_count(); 1880 int parameters = fun->shared()->formal_parameter_count();
1879 boilerplate->shared()->set_formal_parameter_count(parameters); 1881 boilerplate->shared()->set_formal_parameter_count(parameters);
1880 1882
1881 // TODO(1240846): It's weird that native function declarations are 1883 // TODO(1240846): It's weird that native function declarations are
1882 // introduced dynamically when we meet their declarations, whereas 1884 // introduced dynamically when we meet their declarations, whereas
(...skipping 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after
4801 start_position, 4803 start_position,
4802 is_expression); 4804 is_expression);
4803 return result; 4805 return result;
4804 } 4806 }
4805 4807
4806 4808
4807 #undef NEW 4809 #undef NEW
4808 4810
4809 4811
4810 } } // namespace v8::internal 4812 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698