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

Side by Side Diff: src/full-codegen.cc

Issue 25315002: Revert "Defer allocation of native function literals." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/ast.cc ('k') | src/hydrogen.cc » ('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 // 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 DebuggerStatement* stmt) { 190 DebuggerStatement* stmt) {
191 // The debugger statement is breakable. 191 // The debugger statement is breakable.
192 is_breakable_ = true; 192 is_breakable_ = true;
193 } 193 }
194 194
195 195
196 void BreakableStatementChecker::VisitFunctionLiteral(FunctionLiteral* expr) { 196 void BreakableStatementChecker::VisitFunctionLiteral(FunctionLiteral* expr) {
197 } 197 }
198 198
199 199
200 void BreakableStatementChecker::VisitNativeFunctionLiteral( 200 void BreakableStatementChecker::VisitSharedFunctionInfoLiteral(
201 NativeFunctionLiteral* expr) { 201 SharedFunctionInfoLiteral* expr) {
202 } 202 }
203 203
204 204
205 void BreakableStatementChecker::VisitConditional(Conditional* expr) { 205 void BreakableStatementChecker::VisitConditional(Conditional* expr) {
206 } 206 }
207 207
208 208
209 void BreakableStatementChecker::VisitVariableProxy(VariableProxy* expr) { 209 void BreakableStatementChecker::VisitVariableProxy(VariableProxy* expr) {
210 } 210 }
211 211
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 Handle<SharedFunctionInfo> function_info = 1560 Handle<SharedFunctionInfo> function_info =
1561 Compiler::BuildFunctionInfo(expr, script()); 1561 Compiler::BuildFunctionInfo(expr, script());
1562 if (function_info.is_null()) { 1562 if (function_info.is_null()) {
1563 SetStackOverflow(); 1563 SetStackOverflow();
1564 return; 1564 return;
1565 } 1565 }
1566 EmitNewClosure(function_info, expr->pretenure()); 1566 EmitNewClosure(function_info, expr->pretenure());
1567 } 1567 }
1568 1568
1569 1569
1570 void FullCodeGenerator::VisitNativeFunctionLiteral( 1570 void FullCodeGenerator::VisitSharedFunctionInfoLiteral(
1571 NativeFunctionLiteral* expr) { 1571 SharedFunctionInfoLiteral* expr) {
1572 Comment cmnt(masm_, "[ NativeFunctionLiteral"); 1572 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral");
1573 1573 EmitNewClosure(expr->shared_function_info(), false);
1574 // Compute the function template for the native function.
1575 Handle<String> name = expr->name();
1576 v8::Handle<v8::FunctionTemplate> fun_template =
1577 info_->extension()->GetNativeFunction(v8::Utils::ToLocal(name));
1578 ASSERT(!fun_template.IsEmpty());
1579
1580 // Instantiate the function and create a shared function info from it.
1581 Handle<JSFunction> fun = Utils::OpenHandle(*fun_template->GetFunction());
1582 const int literals = fun->NumberOfLiterals();
1583 Handle<Code> code = Handle<Code>(fun->shared()->code());
1584 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1585 bool is_generator = false;
1586 Handle<SharedFunctionInfo> shared =
1587 isolate()->factory()->NewSharedFunctionInfo(name, literals, is_generator,
1588 code, Handle<ScopeInfo>(fun->shared()->scope_info()));
1589 shared->set_construct_stub(*construct_stub);
1590
1591 // Copy the function data to the shared function info.
1592 shared->set_function_data(fun->shared()->function_data());
1593 int parameters = fun->shared()->formal_parameter_count();
1594 shared->set_formal_parameter_count(parameters);
1595
1596 EmitNewClosure(shared, false);
1597 } 1574 }
1598 1575
1599 1576
1600 void FullCodeGenerator::VisitThrow(Throw* expr) { 1577 void FullCodeGenerator::VisitThrow(Throw* expr) {
1601 Comment cmnt(masm_, "[ Throw"); 1578 Comment cmnt(masm_, "[ Throw");
1602 VisitForStackValue(expr->exception()); 1579 VisitForStackValue(expr->exception());
1603 __ CallRuntime(Runtime::kThrow, 1); 1580 __ CallRuntime(Runtime::kThrow, 1);
1604 // Never returns here. 1581 // Never returns here.
1605 } 1582 }
1606 1583
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 } 1706 }
1730 return true; 1707 return true;
1731 } 1708 }
1732 #endif // DEBUG 1709 #endif // DEBUG
1733 1710
1734 1711
1735 #undef __ 1712 #undef __
1736 1713
1737 1714
1738 } } // namespace v8::internal 1715 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698