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

Side by Side Diff: src/compiler.cc

Issue 2633803002: [inspector] implemented blackboxing inside v8 (Closed)
Patch Set: rebased Created 3 years, 11 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
« no previous file with comments | « src/api.cc ('k') | src/debug/debug.h » ('j') | src/debug/debug.cc » ('J')
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 // 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 script->FindSharedFunctionInfo(isolate, literal); 498 script->FindSharedFunctionInfo(isolate, literal);
499 if (maybe_existing.ToHandle(&shared)) { 499 if (maybe_existing.ToHandle(&shared)) {
500 DCHECK(!shared->is_toplevel()); 500 DCHECK(!shared->is_toplevel());
501 // If we found an existing shared function info with compiled code, 501 // If we found an existing shared function info with compiled code,
502 // we are done. 502 // we are done.
503 if (shared->is_compiled()) continue; 503 if (shared->is_compiled()) continue;
504 } else { 504 } else {
505 shared = 505 shared =
506 isolate->factory()->NewSharedFunctionInfoForLiteral(literal, script); 506 isolate->factory()->NewSharedFunctionInfoForLiteral(literal, script);
507 shared->set_is_toplevel(false); 507 shared->set_is_toplevel(false);
508 isolate->debug()->OnNewSharedFunctionInfo(shared);
508 } 509 }
509 510
510 Zone zone(isolate->allocator(), ZONE_NAME); 511 Zone zone(isolate->allocator(), ZONE_NAME);
511 ParseInfo parse_info(&zone, script); 512 ParseInfo parse_info(&zone, script);
512 parse_info.set_literal(literal); 513 parse_info.set_literal(literal);
513 parse_info.set_shared_info(shared); 514 parse_info.set_shared_info(shared);
514 parse_info.set_function_literal_id(shared->function_literal_id()); 515 parse_info.set_function_literal_id(shared->function_literal_id());
515 parse_info.set_language_mode(literal->scope()->language_mode()); 516 parse_info.set_language_mode(literal->scope()->language_mode());
516 parse_info.set_ast_value_factory( 517 parse_info.set_ast_value_factory(
517 outer_info->parse_info()->ast_value_factory()); 518 outer_info->parse_info()->ast_value_factory());
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 : info->isolate()->counters()->compile(); 1081 : info->isolate()->counters()->compile();
1081 HistogramTimerScope timer(rate); 1082 HistogramTimerScope timer(rate);
1082 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), 1083 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
1083 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); 1084 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile");
1084 1085
1085 // Allocate a shared function info object. 1086 // Allocate a shared function info object.
1086 FunctionLiteral* lit = parse_info->literal(); 1087 FunctionLiteral* lit = parse_info->literal();
1087 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); 1088 DCHECK_EQ(kNoSourcePosition, lit->function_token_position());
1088 result = isolate->factory()->NewSharedFunctionInfoForLiteral(lit, script); 1089 result = isolate->factory()->NewSharedFunctionInfoForLiteral(lit, script);
1089 result->set_is_toplevel(true); 1090 result->set_is_toplevel(true);
1091 isolate->debug()->OnNewSharedFunctionInfo(result);
Yang 2017/01/19 13:55:35 I wonder whether it is easier to keep track of all
kozy 2017/01/19 16:08:38 Done.
1090 parse_info->set_shared_info(result); 1092 parse_info->set_shared_info(result);
1091 parse_info->set_function_literal_id(result->function_literal_id()); 1093 parse_info->set_function_literal_id(result->function_literal_id());
1092 1094
1093 // Compile the code. 1095 // Compile the code.
1094 if (!CompileUnoptimizedCode(info)) { 1096 if (!CompileUnoptimizedCode(info)) {
1095 return Handle<SharedFunctionInfo>::null(); 1097 return Handle<SharedFunctionInfo>::null();
1096 } 1098 }
1097 1099
1098 Handle<String> script_name = 1100 Handle<String> script_name =
1099 script->name()->IsString() 1101 script->name()->IsString()
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 Handle<SharedFunctionInfo> existing; 1662 Handle<SharedFunctionInfo> existing;
1661 if (maybe_existing.ToHandle(&existing)) { 1663 if (maybe_existing.ToHandle(&existing)) {
1662 DCHECK(!existing->is_toplevel()); 1664 DCHECK(!existing->is_toplevel());
1663 return existing; 1665 return existing;
1664 } 1666 }
1665 1667
1666 // Allocate a shared function info object which will be compiled lazily. 1668 // Allocate a shared function info object which will be compiled lazily.
1667 Handle<SharedFunctionInfo> result = 1669 Handle<SharedFunctionInfo> result =
1668 isolate->factory()->NewSharedFunctionInfoForLiteral(literal, script); 1670 isolate->factory()->NewSharedFunctionInfoForLiteral(literal, script);
1669 result->set_is_toplevel(false); 1671 result->set_is_toplevel(false);
1672 isolate->debug()->OnNewSharedFunctionInfo(result);
1670 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext(); 1673 Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
1671 if (outer_scope) { 1674 if (outer_scope) {
1672 result->set_outer_scope_info(*outer_scope->scope_info()); 1675 result->set_outer_scope_info(*outer_scope->scope_info());
1673 } 1676 }
1674 return result; 1677 return result;
1675 } 1678 }
1676 1679
1677 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForNative( 1680 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForNative(
1678 v8::Extension* extension, Handle<String> name) { 1681 v8::Extension* extension, Handle<String> name) {
1679 Isolate* isolate = name->GetIsolate(); 1682 Isolate* isolate = name->GetIsolate();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 } 1766 }
1764 1767
1765 if (shared->is_compiled()) { 1768 if (shared->is_compiled()) {
1766 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1769 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1767 JSFunction::EnsureLiterals(function); 1770 JSFunction::EnsureLiterals(function);
1768 } 1771 }
1769 } 1772 }
1770 1773
1771 } // namespace internal 1774 } // namespace internal
1772 } // namespace v8 1775 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/debug/debug.h » ('j') | src/debug/debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698