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

Side by Side Diff: src/compiler.cc

Issue 2481163002: Assign unique IDs to FunctionLiterals (Closed)
Patch Set: updates Created 4 years, 1 month 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 : info->isolate()->counters()->compile(); 988 : info->isolate()->counters()->compile();
989 HistogramTimerScope timer(rate); 989 HistogramTimerScope timer(rate);
990 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), 990 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
991 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); 991 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile");
992 992
993 // Allocate a shared function info object. 993 // Allocate a shared function info object.
994 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); 994 DCHECK_EQ(kNoSourcePosition, lit->function_token_position());
995 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); 995 result = NewSharedFunctionInfoForLiteral(isolate, lit, script);
996 result->set_is_toplevel(true); 996 result->set_is_toplevel(true);
997 parse_info->set_shared_info(result); 997 parse_info->set_shared_info(result);
998 parse_info->set_function_literal_num(result->function_literal_num());
998 999
999 // Compile the code. 1000 // Compile the code.
1000 if (!CompileUnoptimizedCode(info)) { 1001 if (!CompileUnoptimizedCode(info)) {
1001 return Handle<SharedFunctionInfo>::null(); 1002 return Handle<SharedFunctionInfo>::null();
1002 } 1003 }
1003 1004
1004 Handle<String> script_name = 1005 Handle<String> script_name =
1005 script->name()->IsString() 1006 script->name()->IsString()
1006 ? Handle<String>(String::cast(script->name())) 1007 ? Handle<String>(String::cast(script->name()))
1007 : isolate->factory()->empty_string(); 1008 : isolate->factory()->empty_string();
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 // shared function info for this function literal has been created for the 1578 // shared function info for this function literal has been created for the
1578 // first time. It may have already been compiled previously. 1579 // first time. It may have already been compiled previously.
1579 result->set_never_compiled(outer_info->shared_info()->never_compiled()); 1580 result->set_never_compiled(outer_info->shared_info()->never_compiled());
1580 } 1581 }
1581 1582
1582 Zone zone(isolate->allocator(), ZONE_NAME); 1583 Zone zone(isolate->allocator(), ZONE_NAME);
1583 ParseInfo parse_info(&zone, script); 1584 ParseInfo parse_info(&zone, script);
1584 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1585 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1585 parse_info.set_literal(literal); 1586 parse_info.set_literal(literal);
1586 parse_info.set_shared_info(result); 1587 parse_info.set_shared_info(result);
1588 parse_info.set_function_literal_num(result->function_literal_num());
1587 parse_info.set_language_mode(literal->scope()->language_mode()); 1589 parse_info.set_language_mode(literal->scope()->language_mode());
1588 parse_info.set_ast_value_factory( 1590 parse_info.set_ast_value_factory(
1589 outer_info->parse_info()->ast_value_factory()); 1591 outer_info->parse_info()->ast_value_factory());
1590 parse_info.set_ast_value_factory_owned(false); 1592 parse_info.set_ast_value_factory_owned(false);
1591 1593
1592 if (outer_info->will_serialize()) info.PrepareForSerializing(); 1594 if (outer_info->will_serialize()) info.PrepareForSerializing();
1593 if (outer_info->is_debug()) info.MarkAsDebug(); 1595 if (outer_info->is_debug()) info.MarkAsDebug();
1594 1596
1595 // If this inner function is already compiled, we don't need to compile 1597 // If this inner function is already compiled, we don't need to compile
1596 // again. When compiling for debug, we are not interested in having debug 1598 // again. When compiling for debug, we are not interested in having debug
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 DCHECK(shared->is_compiled()); 1723 DCHECK(shared->is_compiled());
1722 function->set_literals(cached.literals); 1724 function->set_literals(cached.literals);
1723 } else if (shared->is_compiled()) { 1725 } else if (shared->is_compiled()) {
1724 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1726 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1725 JSFunction::EnsureLiterals(function); 1727 JSFunction::EnsureLiterals(function);
1726 } 1728 }
1727 } 1729 }
1728 1730
1729 } // namespace internal 1731 } // namespace internal
1730 } // namespace v8 1732 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698