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

Side by Side Diff: src/compiler.cc

Issue 2481163002: Assign unique IDs to FunctionLiterals (Closed)
Patch Set: updates Created 4 years 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
OLDNEW
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/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 : info->isolate()->counters()->compile(); 994 : info->isolate()->counters()->compile();
995 HistogramTimerScope timer(rate); 995 HistogramTimerScope timer(rate);
996 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), 996 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
997 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); 997 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile");
998 998
999 // Allocate a shared function info object. 999 // Allocate a shared function info object.
1000 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); 1000 DCHECK_EQ(kNoSourcePosition, lit->function_token_position());
1001 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); 1001 result = NewSharedFunctionInfoForLiteral(isolate, lit, script);
1002 result->set_is_toplevel(true); 1002 result->set_is_toplevel(true);
1003 parse_info->set_shared_info(result); 1003 parse_info->set_shared_info(result);
1004 parse_info->set_function_literal_id(result->function_literal_id());
1004 1005
1005 // Compile the code. 1006 // Compile the code.
1006 if (!CompileUnoptimizedCode(info)) { 1007 if (!CompileUnoptimizedCode(info)) {
1007 return Handle<SharedFunctionInfo>::null(); 1008 return Handle<SharedFunctionInfo>::null();
1008 } 1009 }
1009 1010
1010 Handle<String> script_name = 1011 Handle<String> script_name =
1011 script->name()->IsString() 1012 script->name()->IsString()
1012 ? Handle<String>(String::cast(script->name())) 1013 ? Handle<String>(String::cast(script->name()))
1013 : isolate->factory()->empty_string(); 1014 : isolate->factory()->empty_string();
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 // shared function info for this function literal has been created for the 1582 // shared function info for this function literal has been created for the
1582 // first time. It may have already been compiled previously. 1583 // first time. It may have already been compiled previously.
1583 result->set_never_compiled(outer_info->shared_info()->never_compiled()); 1584 result->set_never_compiled(outer_info->shared_info()->never_compiled());
1584 } 1585 }
1585 1586
1586 Zone zone(isolate->allocator(), ZONE_NAME); 1587 Zone zone(isolate->allocator(), ZONE_NAME);
1587 ParseInfo parse_info(&zone, script); 1588 ParseInfo parse_info(&zone, script);
1588 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1589 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1589 parse_info.set_literal(literal); 1590 parse_info.set_literal(literal);
1590 parse_info.set_shared_info(result); 1591 parse_info.set_shared_info(result);
1592 parse_info.set_function_literal_id(result->function_literal_id());
1591 parse_info.set_language_mode(literal->scope()->language_mode()); 1593 parse_info.set_language_mode(literal->scope()->language_mode());
1592 parse_info.set_ast_value_factory( 1594 parse_info.set_ast_value_factory(
1593 outer_info->parse_info()->ast_value_factory()); 1595 outer_info->parse_info()->ast_value_factory());
1594 parse_info.set_ast_value_factory_owned(false); 1596 parse_info.set_ast_value_factory_owned(false);
1595 1597
1596 if (outer_info->will_serialize()) info.PrepareForSerializing(); 1598 if (outer_info->will_serialize()) info.PrepareForSerializing();
1597 if (outer_info->is_debug()) info.MarkAsDebug(); 1599 if (outer_info->is_debug()) info.MarkAsDebug();
1598 1600
1599 // If this inner function is already compiled, we don't need to compile 1601 // If this inner function is already compiled, we don't need to compile
1600 // again. When compiling for debug, we are not interested in having debug 1602 // again. When compiling for debug, we are not interested in having debug
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 DCHECK(shared->is_compiled()); 1728 DCHECK(shared->is_compiled());
1727 function->set_literals(cached.literals); 1729 function->set_literals(cached.literals);
1728 } else if (shared->is_compiled()) { 1730 } else if (shared->is_compiled()) {
1729 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1731 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1730 JSFunction::EnsureLiterals(function); 1732 JSFunction::EnsureLiterals(function);
1731 } 1733 }
1732 } 1734 }
1733 1735
1734 } // namespace internal 1736 } // namespace internal
1735 } // namespace v8 1737 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698