| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); | 1515 extension_->GetNativeFunction(v8::Utils::ToLocal(name)); |
| 1516 ASSERT(!fun_template.IsEmpty()); | 1516 ASSERT(!fun_template.IsEmpty()); |
| 1517 | 1517 |
| 1518 // Instantiate the function and create a shared function info from it. | 1518 // Instantiate the function and create a shared function info from it. |
| 1519 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); | 1519 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction()); |
| 1520 const int literals = fun->NumberOfLiterals(); | 1520 const int literals = fun->NumberOfLiterals(); |
| 1521 Handle<Code> code = Handle<Code>(fun->shared()->code()); | 1521 Handle<Code> code = Handle<Code>(fun->shared()->code()); |
| 1522 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); | 1522 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub()); |
| 1523 Handle<SharedFunctionInfo> shared = | 1523 Handle<SharedFunctionInfo> shared = |
| 1524 isolate()->factory()->NewSharedFunctionInfo(name, literals, code, | 1524 isolate()->factory()->NewSharedFunctionInfo(name, literals, code, |
| 1525 Handle<SerializedScopeInfo>(fun->shared()->scope_info())); | 1525 Handle<ScopeInfo>(fun->shared()->scope_info())); |
| 1526 shared->set_construct_stub(*construct_stub); | 1526 shared->set_construct_stub(*construct_stub); |
| 1527 | 1527 |
| 1528 // Copy the function data to the shared function info. | 1528 // Copy the function data to the shared function info. |
| 1529 shared->set_function_data(fun->shared()->function_data()); | 1529 shared->set_function_data(fun->shared()->function_data()); |
| 1530 int parameters = fun->shared()->formal_parameter_count(); | 1530 int parameters = fun->shared()->formal_parameter_count(); |
| 1531 shared->set_formal_parameter_count(parameters); | 1531 shared->set_formal_parameter_count(parameters); |
| 1532 | 1532 |
| 1533 // TODO(1240846): It's weird that native function declarations are | 1533 // TODO(1240846): It's weird that native function declarations are |
| 1534 // introduced dynamically when we meet their declarations, whereas | 1534 // introduced dynamically when we meet their declarations, whereas |
| 1535 // other functions are setup when entering the surrounding scope. | 1535 // other functions are setup when entering the surrounding scope. |
| (...skipping 3874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5410 result = parser.ParseProgram(source, | 5410 result = parser.ParseProgram(source, |
| 5411 info->is_global(), | 5411 info->is_global(), |
| 5412 info->strict_mode_flag()); | 5412 info->strict_mode_flag()); |
| 5413 } | 5413 } |
| 5414 } | 5414 } |
| 5415 info->SetFunction(result); | 5415 info->SetFunction(result); |
| 5416 return (result != NULL); | 5416 return (result != NULL); |
| 5417 } | 5417 } |
| 5418 | 5418 |
| 5419 } } // namespace v8::internal | 5419 } } // namespace v8::internal |
| OLD | NEW |