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

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

Issue 10704210: Fix problem of excessive attempts to optimize, fix excessive deoptimizations for load/store indexed… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« runtime/vm/code_generator.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 // - Check if 'num_args' (including receiver) match any IC data group. 1529 // - Check if 'num_args' (including receiver) match any IC data group.
1530 // - Match found -> jump to target. 1530 // - Match found -> jump to target.
1531 // - Match not found -> jump to IC miss. 1531 // - Match not found -> jump to IC miss.
1532 void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler, 1532 void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
1533 intptr_t num_args) { 1533 intptr_t num_args) {
1534 __ movq(RCX, FieldAddress(RBX, ICData::function_offset())); 1534 __ movq(RCX, FieldAddress(RBX, ICData::function_offset()));
1535 __ incq(FieldAddress(RCX, Function::usage_counter_offset())); 1535 __ incq(FieldAddress(RCX, Function::usage_counter_offset()));
1536 if (FlowGraphCompiler::CanOptimize()) { 1536 if (FlowGraphCompiler::CanOptimize()) {
1537 __ cmpq(FieldAddress(RCX, Function::usage_counter_offset()), 1537 __ cmpq(FieldAddress(RCX, Function::usage_counter_offset()),
1538 Immediate(FLAG_optimization_counter_threshold)); 1538 Immediate(FLAG_optimization_counter_threshold));
1539 Label not_yet_hot; 1539 Label not_yet_hot, already_optimized;
1540 __ j(LESS_EQUAL, &not_yet_hot, Assembler::kNearJump); 1540 __ j(LESS, &not_yet_hot, Assembler::kNearJump);
1541 __ j(GREATER, &already_optimized, Assembler::kNearJump);
1541 AssemblerMacros::EnterStubFrame(assembler); 1542 AssemblerMacros::EnterStubFrame(assembler);
1542 __ pushq(RBX); // Preserve inline cache data object. 1543 __ pushq(RBX); // Preserve inline cache data object.
1543 __ pushq(R10); // Preserve arguments array. 1544 __ pushq(R10); // Preserve arguments array.
1544 __ pushq(RCX); // Argument for runtime: function object. 1545 __ pushq(RCX); // Argument for runtime: function object.
1545 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); 1546 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
1546 __ popq(RCX); // Remove argument. 1547 __ popq(RCX); // Remove argument.
1547 __ popq(R10); // Restore arguments array. 1548 __ popq(R10); // Restore arguments array.
1548 __ popq(RBX); // Restore inline cache data object. 1549 __ popq(RBX); // Restore inline cache data object.
1549 __ LeaveFrame(); 1550 __ LeaveFrame();
1550 __ Bind(&not_yet_hot); 1551 __ Bind(&not_yet_hot);
1552 __ Bind(&already_optimized);
1551 } 1553 }
1552 ASSERT(num_args > 0); 1554 ASSERT(num_args > 0);
1553 // Get receiver (first read number of arguments from argument descriptor array 1555 // Get receiver (first read number of arguments from argument descriptor array
1554 // and then access the receiver from the stack). 1556 // and then access the receiver from the stack).
1555 __ movq(RAX, FieldAddress(R10, Array::data_offset())); 1557 __ movq(RAX, FieldAddress(R10, Array::data_offset()));
1556 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi. 1558 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi.
1557 1559
1558 Label get_class_id_as_smi, ic_miss; 1560 Label get_class_id_as_smi, ic_miss;
1559 // RBX: IC data array. 1561 // RBX: IC data array.
1560 1562
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { 1903 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) {
1902 __ movq(RAX, RCX); // error object. 1904 __ movq(RAX, RCX); // error object.
1903 __ movq(RBP, RDX); // target frame_pointer. 1905 __ movq(RBP, RDX); // target frame_pointer.
1904 __ movq(RSP, RSI); // target stack_pointer. 1906 __ movq(RSP, RSI); // target stack_pointer.
1905 __ jmp(RDI); // Jump to the exception handler code. 1907 __ jmp(RDI); // Jump to the exception handler code.
1906 } 1908 }
1907 1909
1908 } // namespace dart 1910 } // namespace dart
1909 1911
1910 #endif // defined TARGET_ARCH_X64 1912 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/code_generator.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698