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/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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 } | 1403 } |
1404 | 1404 |
1405 context()->Plug(result_register()); | 1405 context()->Plug(result_register()); |
1406 } | 1406 } |
1407 | 1407 |
1408 | 1408 |
1409 void FullCodeGenerator::VisitNativeFunctionLiteral( | 1409 void FullCodeGenerator::VisitNativeFunctionLiteral( |
1410 NativeFunctionLiteral* expr) { | 1410 NativeFunctionLiteral* expr) { |
1411 Comment cmnt(masm_, "[ NativeFunctionLiteral"); | 1411 Comment cmnt(masm_, "[ NativeFunctionLiteral"); |
1412 | 1412 |
| 1413 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate()); |
| 1414 |
1413 // Compute the function template for the native function. | 1415 // Compute the function template for the native function. |
1414 Handle<String> name = expr->name(); | 1416 Handle<String> name = expr->name(); |
1415 v8::Handle<v8::FunctionTemplate> fun_template = | 1417 v8::Handle<v8::FunctionTemplate> fun_template = |
1416 expr->extension()->GetNativeFunctionTemplate( | 1418 expr->extension()->GetNativeFunctionTemplate(v8_isolate, |
1417 reinterpret_cast<v8::Isolate*>(isolate()), v8::Utils::ToLocal(name)); | 1419 v8::Utils::ToLocal(name)); |
1418 DCHECK(!fun_template.IsEmpty()); | 1420 DCHECK(!fun_template.IsEmpty()); |
1419 | 1421 |
1420 // Instantiate the function and create a shared function info from it. | 1422 // Instantiate the function and create a shared function info from it. |
1421 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); | 1423 Handle<JSFunction> fun = Utils::OpenHandle( |
| 1424 *fun_template->GetFunction(v8_isolate->GetCurrentContext()) |
| 1425 .ToLocalChecked()); |
1422 const int literals = fun->NumberOfLiterals(); | 1426 const int literals = fun->NumberOfLiterals(); |
1423 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1427 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
1424 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1428 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
1425 Handle<SharedFunctionInfo> shared = | 1429 Handle<SharedFunctionInfo> shared = |
1426 isolate()->factory()->NewSharedFunctionInfo( | 1430 isolate()->factory()->NewSharedFunctionInfo( |
1427 name, literals, FunctionKind::kNormalFunction, code, | 1431 name, literals, FunctionKind::kNormalFunction, code, |
1428 Handle<ScopeInfo>(fun->shared()->scope_info()), | 1432 Handle<ScopeInfo>(fun->shared()->scope_info()), |
1429 Handle<TypeFeedbackVector>(fun->shared()->feedback_vector())); | 1433 Handle<TypeFeedbackVector>(fun->shared()->feedback_vector())); |
1430 shared->set_construct_stub(*construct_stub); | 1434 shared->set_construct_stub(*construct_stub); |
1431 | 1435 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1665 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
1662 codegen_->scope_ = saved_scope_; | 1666 codegen_->scope_ = saved_scope_; |
1663 } | 1667 } |
1664 | 1668 |
1665 | 1669 |
1666 #undef __ | 1670 #undef __ |
1667 | 1671 |
1668 | 1672 |
1669 } // namespace internal | 1673 } // namespace internal |
1670 } // namespace v8 | 1674 } // namespace v8 |
OLD | NEW |