OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/debug.h" | 9 #include "src/debug.h" |
10 #include "src/full-codegen.h" | 10 #include "src/full-codegen.h" |
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 v8::Handle<v8::FunctionTemplate> fun_template = | 1540 v8::Handle<v8::FunctionTemplate> fun_template = |
1541 expr->extension()->GetNativeFunctionTemplate( | 1541 expr->extension()->GetNativeFunctionTemplate( |
1542 reinterpret_cast<v8::Isolate*>(isolate()), v8::Utils::ToLocal(name)); | 1542 reinterpret_cast<v8::Isolate*>(isolate()), v8::Utils::ToLocal(name)); |
1543 DCHECK(!fun_template.IsEmpty()); | 1543 DCHECK(!fun_template.IsEmpty()); |
1544 | 1544 |
1545 // Instantiate the function and create a shared function info from it. | 1545 // Instantiate the function and create a shared function info from it. |
1546 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); | 1546 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); |
1547 const int literals = fun->NumberOfLiterals(); | 1547 const int literals = fun->NumberOfLiterals(); |
1548 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1548 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
1549 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1549 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
1550 bool is_generator = false; | |
1551 bool is_arrow = false; | |
1552 Handle<SharedFunctionInfo> shared = | 1550 Handle<SharedFunctionInfo> shared = |
1553 isolate()->factory()->NewSharedFunctionInfo( | 1551 isolate()->factory()->NewSharedFunctionInfo( |
1554 name, literals, is_generator, is_arrow, code, | 1552 name, literals, FunctionKind::kNormalFunction, code, |
1555 Handle<ScopeInfo>(fun->shared()->scope_info()), | 1553 Handle<ScopeInfo>(fun->shared()->scope_info()), |
1556 Handle<FixedArray>(fun->shared()->feedback_vector())); | 1554 Handle<FixedArray>(fun->shared()->feedback_vector())); |
1557 shared->set_construct_stub(*construct_stub); | 1555 shared->set_construct_stub(*construct_stub); |
1558 | 1556 |
1559 // Copy the function data to the shared function info. | 1557 // Copy the function data to the shared function info. |
1560 shared->set_function_data(fun->shared()->function_data()); | 1558 shared->set_function_data(fun->shared()->function_data()); |
1561 int parameters = fun->shared()->formal_parameter_count(); | 1559 int parameters = fun->shared()->formal_parameter_count(); |
1562 shared->set_formal_parameter_count(parameters); | 1560 shared->set_formal_parameter_count(parameters); |
1563 | 1561 |
1564 EmitNewClosure(shared, false); | 1562 EmitNewClosure(shared, false); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 } | 1690 } |
1693 return true; | 1691 return true; |
1694 } | 1692 } |
1695 #endif // DEBUG | 1693 #endif // DEBUG |
1696 | 1694 |
1697 | 1695 |
1698 #undef __ | 1696 #undef __ |
1699 | 1697 |
1700 | 1698 |
1701 } } // namespace v8::internal | 1699 } } // namespace v8::internal |
OLD | NEW |