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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate()); | 1356 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate()); |
1357 | 1357 |
1358 // Compute the function template for the native function. | 1358 // Compute the function template for the native function. |
1359 Handle<String> name = expr->name(); | 1359 Handle<String> name = expr->name(); |
1360 v8::Local<v8::FunctionTemplate> fun_template = | 1360 v8::Local<v8::FunctionTemplate> fun_template = |
1361 expr->extension()->GetNativeFunctionTemplate(v8_isolate, | 1361 expr->extension()->GetNativeFunctionTemplate(v8_isolate, |
1362 v8::Utils::ToLocal(name)); | 1362 v8::Utils::ToLocal(name)); |
1363 DCHECK(!fun_template.IsEmpty()); | 1363 DCHECK(!fun_template.IsEmpty()); |
1364 | 1364 |
1365 // Instantiate the function and create a shared function info from it. | 1365 // Instantiate the function and create a shared function info from it. |
1366 Handle<JSFunction> fun = Utils::OpenHandle( | 1366 Handle<JSFunction> fun = Handle<JSFunction>::cast(Utils::OpenHandle( |
1367 *fun_template->GetFunction(v8_isolate->GetCurrentContext()) | 1367 *fun_template->GetFunction(v8_isolate->GetCurrentContext()) |
1368 .ToLocalChecked()); | 1368 .ToLocalChecked())); |
1369 const int literals = fun->NumberOfLiterals(); | 1369 const int literals = fun->NumberOfLiterals(); |
1370 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1370 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
1371 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1371 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
1372 Handle<SharedFunctionInfo> shared = | 1372 Handle<SharedFunctionInfo> shared = |
1373 isolate()->factory()->NewSharedFunctionInfo( | 1373 isolate()->factory()->NewSharedFunctionInfo( |
1374 name, literals, FunctionKind::kNormalFunction, code, | 1374 name, literals, FunctionKind::kNormalFunction, code, |
1375 Handle<ScopeInfo>(fun->shared()->scope_info()), | 1375 Handle<ScopeInfo>(fun->shared()->scope_info()), |
1376 Handle<TypeFeedbackVector>(fun->shared()->feedback_vector())); | 1376 Handle<TypeFeedbackVector>(fun->shared()->feedback_vector())); |
1377 shared->set_construct_stub(*construct_stub); | 1377 shared->set_construct_stub(*construct_stub); |
1378 | 1378 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1673 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1674 var->initializer_position() >= proxy->position(); | 1674 var->initializer_position() >= proxy->position(); |
1675 } | 1675 } |
1676 | 1676 |
1677 | 1677 |
1678 #undef __ | 1678 #undef __ |
1679 | 1679 |
1680 | 1680 |
1681 } // namespace internal | 1681 } // namespace internal |
1682 } // namespace v8 | 1682 } // namespace v8 |
OLD | NEW |