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

Side by Side Diff: src/compiler.cc

Issue 2223523002: [Interpreter] Avoid dereferencing handles on BytecodeGenerator for AST operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_const_array
Patch Set: Rebase Created 4 years, 4 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/ast/variables.h ('k') | src/compiler-dispatcher/compiler-dispatcher-job.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 // 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 if (info->has_bytecode_array()) { 533 if (info->has_bytecode_array()) {
534 DCHECK(!shared->HasBytecodeArray()); // Only compiled once. 534 DCHECK(!shared->HasBytecodeArray()); // Only compiled once.
535 shared->set_bytecode_array(*info->bytecode_array()); 535 shared->set_bytecode_array(*info->bytecode_array());
536 } 536 }
537 } 537 }
538 538
539 MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) { 539 MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) {
540 VMState<COMPILER> state(info->isolate()); 540 VMState<COMPILER> state(info->isolate());
541 PostponeInterruptsScope postpone(info->isolate()); 541 PostponeInterruptsScope postpone(info->isolate());
542 542
543 // Create a canonical handle scope if compiling ignition bytecode. This is 543 // Create a canonical handle scope before internalizing parsed values if
544 // required by the constant array builder to de-duplicate common objects 544 // compiling bytecode. This is required for off-thread bytecode generation.
545 // without dereferencing handles.
546 std::unique_ptr<CanonicalHandleScope> canonical; 545 std::unique_ptr<CanonicalHandleScope> canonical;
547 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info->isolate())); 546 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info->isolate()));
548 547
549 // Parse and update CompilationInfo with the results. 548 // Parse and update CompilationInfo with the results.
550 if (!Parser::ParseStatic(info->parse_info())) return MaybeHandle<Code>(); 549 if (!Parser::ParseStatic(info->parse_info())) return MaybeHandle<Code>();
551 Handle<SharedFunctionInfo> shared = info->shared_info(); 550 Handle<SharedFunctionInfo> shared = info->shared_info();
552 DCHECK_EQ(shared->language_mode(), info->literal()->language_mode()); 551 DCHECK_EQ(shared->language_mode(), info->literal()->language_mode());
553 552
554 // Compile either unoptimized code or bytecode for the interpreter. 553 // Compile either unoptimized code or bytecode for the interpreter.
555 if (!CompileUnoptimizedCode(info)) return MaybeHandle<Code>(); 554 if (!CompileUnoptimizedCode(info)) return MaybeHandle<Code>();
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { 1066 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
1068 Isolate* isolate = info->isolate(); 1067 Isolate* isolate = info->isolate();
1069 TimerEventScope<TimerEventCompileCode> timer(isolate); 1068 TimerEventScope<TimerEventCompileCode> timer(isolate);
1070 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); 1069 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
1071 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); 1070 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
1072 PostponeInterruptsScope postpone(isolate); 1071 PostponeInterruptsScope postpone(isolate);
1073 DCHECK(!isolate->native_context().is_null()); 1072 DCHECK(!isolate->native_context().is_null());
1074 ParseInfo* parse_info = info->parse_info(); 1073 ParseInfo* parse_info = info->parse_info();
1075 Handle<Script> script = parse_info->script(); 1074 Handle<Script> script = parse_info->script();
1076 1075
1077 // Create a canonical handle scope if compiling ignition bytecode. This is 1076 // Create a canonical handle scope before internalizing parsed values if
1078 // required by the constant array builder to de-duplicate common objects 1077 // compiling bytecode. This is required for off-thread bytecode generation.
1079 // without dereferencing handles.
1080 std::unique_ptr<CanonicalHandleScope> canonical; 1078 std::unique_ptr<CanonicalHandleScope> canonical;
1081 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate)); 1079 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate));
1082 1080
1083 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? 1081 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile?
1084 FixedArray* array = isolate->native_context()->embedder_data(); 1082 FixedArray* array = isolate->native_context()->embedder_data();
1085 script->set_context_data(array->get(v8::Context::kDebugIdIndex)); 1083 script->set_context_data(array->get(v8::Context::kDebugIdIndex));
1086 1084
1087 isolate->debug()->OnBeforeCompile(script); 1085 isolate->debug()->OnBeforeCompile(script);
1088 1086
1089 DCHECK(parse_info->is_eval() || parse_info->is_global() || 1087 DCHECK(parse_info->is_eval() || parse_info->is_global() ||
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 DCHECK(shared->is_compiled()); 1942 DCHECK(shared->is_compiled());
1945 function->set_literals(cached.literals); 1943 function->set_literals(cached.literals);
1946 } else if (shared->is_compiled()) { 1944 } else if (shared->is_compiled()) {
1947 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1945 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1948 JSFunction::EnsureLiterals(function); 1946 JSFunction::EnsureLiterals(function);
1949 } 1947 }
1950 } 1948 }
1951 1949
1952 } // namespace internal 1950 } // namespace internal
1953 } // namespace v8 1951 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/variables.h ('k') | src/compiler-dispatcher/compiler-dispatcher-job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698