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

Side by Side Diff: runtime/vm/code_generator.cc

Issue 1713853003: VM: Share object pool entries for optimized static calls. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler.h » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 if (frame->IsEntryFrame()) { 1551 if (frame->IsEntryFrame()) {
1552 // Since function's current code is always unpatched, the entry frame always 1552 // Since function's current code is always unpatched, the entry frame always
1553 // calls to unpatched code. 1553 // calls to unpatched code.
1554 UNREACHABLE(); 1554 UNREACHABLE();
1555 } 1555 }
1556 ASSERT(frame->IsDartFrame()); 1556 ASSERT(frame->IsDartFrame());
1557 const Code& caller_code = Code::Handle(zone, frame->LookupDartCode()); 1557 const Code& caller_code = Code::Handle(zone, frame->LookupDartCode());
1558 ASSERT(caller_code.is_optimized()); 1558 ASSERT(caller_code.is_optimized());
1559 const Function& target_function = Function::Handle( 1559 const Function& target_function = Function::Handle(
1560 zone, caller_code.GetStaticCallTargetFunctionAt(frame->pc())); 1560 zone, caller_code.GetStaticCallTargetFunctionAt(frame->pc()));
1561 const Code& target_code = Code::Handle(
1562 zone, caller_code.GetStaticCallTargetCodeAt(frame->pc()));
1563 ASSERT(!target_code.IsNull());
1564 if (!target_function.HasCode()) { 1561 if (!target_function.HasCode()) {
1565 const Error& error = Error::Handle( 1562 const Error& error = Error::Handle(
1566 zone, Compiler::CompileFunction(thread, target_function)); 1563 zone, Compiler::CompileFunction(thread, target_function));
1567 if (!error.IsNull()) { 1564 if (!error.IsNull()) {
1568 Exceptions::PropagateError(error); 1565 Exceptions::PropagateError(error);
1569 } 1566 }
1570 } 1567 }
1571 ASSERT(target_function.HasCode()); 1568 ASSERT(target_function.HasCode());
1572 ASSERT(target_function.raw() == target_code.function());
1573 1569
1574 const Code& current_target_code = Code::Handle( 1570 const Code& current_target_code = Code::Handle(
1575 zone, target_function.CurrentCode()); 1571 zone, target_function.CurrentCode());
1576 CodePatcher::PatchStaticCallAt(frame->pc(), 1572 CodePatcher::PatchStaticCallAt(frame->pc(),
1577 caller_code, 1573 caller_code,
1578 current_target_code); 1574 current_target_code);
1579 caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code); 1575 caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code);
1580 if (FLAG_trace_patching) { 1576 if (FLAG_trace_patching) {
1581 OS::PrintErr("FixCallersTarget: caller %#" Px " " 1577 OS::PrintErr("FixCallersTarget: caller %#" Px " "
1582 "target '%s' %#" Px " -> %#" Px "\n", 1578 "target '%s' -> %#" Px "\n",
1583 frame->pc(), 1579 frame->pc(),
1584 target_function.ToFullyQualifiedCString(), 1580 target_function.ToFullyQualifiedCString(),
1585 target_code.EntryPoint(), 1581 current_target_code.EntryPoint());
1586 current_target_code.EntryPoint());
1587 } 1582 }
1588 arguments.SetReturn(current_target_code); 1583 arguments.SetReturn(current_target_code);
1589 } 1584 }
1590 1585
1591 1586
1592 // The caller tried to allocate an instance via an invalidated allocation 1587 // The caller tried to allocate an instance via an invalidated allocation
1593 // stub. 1588 // stub.
1594 DEFINE_RUNTIME_ENTRY(FixAllocationStubTarget, 0) { 1589 DEFINE_RUNTIME_ENTRY(FixAllocationStubTarget, 0) {
1595 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 1590 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames);
1596 StackFrame* frame = iterator.NextFrame(); 1591 StackFrame* frame = iterator.NextFrame();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 const intptr_t elm_size = old_data.ElementSizeInBytes(); 1905 const intptr_t elm_size = old_data.ElementSizeInBytes();
1911 const TypedData& new_data = 1906 const TypedData& new_data =
1912 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); 1907 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld));
1913 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); 1908 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size);
1914 typed_data_cell.SetAt(0, new_data); 1909 typed_data_cell.SetAt(0, new_data);
1915 arguments.SetReturn(new_data); 1910 arguments.SetReturn(new_data);
1916 } 1911 }
1917 1912
1918 1913
1919 } // namespace dart 1914 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698