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

Side by Side Diff: src/compiler.cc

Issue 2007943002: [runtime] Fix number of literals for builtin functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix unittest. Created 4 years, 7 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 | src/objects.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/ast/ast-numbering.h" 9 #include "src/ast/ast-numbering.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 // Compute the function template for the native function. 1679 // Compute the function template for the native function.
1680 v8::Local<v8::FunctionTemplate> fun_template = 1680 v8::Local<v8::FunctionTemplate> fun_template =
1681 extension->GetNativeFunctionTemplate(v8_isolate, 1681 extension->GetNativeFunctionTemplate(v8_isolate,
1682 v8::Utils::ToLocal(name)); 1682 v8::Utils::ToLocal(name));
1683 DCHECK(!fun_template.IsEmpty()); 1683 DCHECK(!fun_template.IsEmpty());
1684 1684
1685 // Instantiate the function and create a shared function info from it. 1685 // Instantiate the function and create a shared function info from it.
1686 Handle<JSFunction> fun = Handle<JSFunction>::cast(Utils::OpenHandle( 1686 Handle<JSFunction> fun = Handle<JSFunction>::cast(Utils::OpenHandle(
1687 *fun_template->GetFunction(v8_isolate->GetCurrentContext()) 1687 *fun_template->GetFunction(v8_isolate->GetCurrentContext())
1688 .ToLocalChecked())); 1688 .ToLocalChecked()));
1689 const int literals = fun->NumberOfLiterals();
1690 Handle<Code> code = Handle<Code>(fun->shared()->code()); 1689 Handle<Code> code = Handle<Code>(fun->shared()->code());
1691 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); 1690 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1692 Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo( 1691 Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo(
1693 name, literals, FunctionKind::kNormalFunction, code, 1692 name, fun->shared()->num_literals(), FunctionKind::kNormalFunction, code,
1694 Handle<ScopeInfo>(fun->shared()->scope_info())); 1693 Handle<ScopeInfo>(fun->shared()->scope_info()));
1695 shared->set_construct_stub(*construct_stub); 1694 shared->set_construct_stub(*construct_stub);
1696 shared->set_feedback_vector(fun->shared()->feedback_vector()); 1695 shared->set_feedback_vector(fun->shared()->feedback_vector());
1697 1696
1698 // Copy the function data to the shared function info. 1697 // Copy the function data to the shared function info.
1699 shared->set_function_data(fun->shared()->function_data()); 1698 shared->set_function_data(fun->shared()->function_data());
1700 int parameters = fun->shared()->internal_formal_parameter_count(); 1699 int parameters = fun->shared()->internal_formal_parameter_count();
1701 shared->set_internal_formal_parameter_count(parameters); 1700 shared->set_internal_formal_parameter_count(parameters);
1702 1701
1703 return shared; 1702 return shared;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 MaybeHandle<Code> code; 1792 MaybeHandle<Code> code;
1794 if (cached.code != nullptr) code = handle(cached.code); 1793 if (cached.code != nullptr) code = handle(cached.code);
1795 Handle<Context> native_context(function->context()->native_context()); 1794 Handle<Context> native_context(function->context()->native_context());
1796 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 1795 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
1797 literals, BailoutId::None()); 1796 literals, BailoutId::None());
1798 } 1797 }
1799 } 1798 }
1800 1799
1801 } // namespace internal 1800 } // namespace internal
1802 } // namespace v8 1801 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698