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

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

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . 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
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/globals.h" // NOLINT 5 #include "vm/globals.h" // NOLINT
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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 10 matching lines...) Expand all
21 DECLARE_FLAG(bool, inline_alloc); 21 DECLARE_FLAG(bool, inline_alloc);
22 22
23 23
24 Assembler::Assembler(bool use_far_branches) 24 Assembler::Assembler(bool use_far_branches)
25 : buffer_(), 25 : buffer_(),
26 prologue_offset_(-1), 26 prologue_offset_(-1),
27 comments_(), 27 comments_(),
28 constant_pool_allowed_(false) { 28 constant_pool_allowed_(false) {
29 // Far branching mode is only needed and implemented for MIPS and ARM. 29 // Far branching mode is only needed and implemented for MIPS and ARM.
30 ASSERT(!use_far_branches); 30 ASSERT(!use_far_branches);
31 MonomorphicCheckedEntry();
31 } 32 }
32 33
33 34
34 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { 35 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) {
35 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length); 36 memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length);
36 } 37 }
37 38
38 39
39 void Assembler::call(Register reg) { 40 void Assembler::call(Register reg) {
40 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 41 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
(...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 void Assembler::EnterStubFrame() { 3315 void Assembler::EnterStubFrame() {
3315 EnterDartFrame(0, kNoRegister); 3316 EnterDartFrame(0, kNoRegister);
3316 } 3317 }
3317 3318
3318 3319
3319 void Assembler::LeaveStubFrame() { 3320 void Assembler::LeaveStubFrame() {
3320 LeaveDartFrame(); 3321 LeaveDartFrame();
3321 } 3322 }
3322 3323
3323 3324
3325 void Assembler::NoMonomorphicCheckedEntry() {
3326 buffer_.Reset();
3327 for (intptr_t i = 0; i < Instructions::kCheckedEntryOffset; i++) {
3328 int3();
3329 }
3330 ASSERT(CodeSize() == Instructions::kCheckedEntryOffset);
3331 }
3332
3333
3334 // RDI receiver, RBX guarded cid as Smi
3335 void Assembler::MonomorphicCheckedEntry() {
3336 Label miss;
3337 Bind(&miss);
3338 movq(CODE_REG, Address(THR, Thread::monomorphic_miss_stub_offset()));
3339 movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset()));
3340 jmp(RCX);
3341 int3();
3342
3343 Comment("MonomorphicCheckedEntry");
3344 ASSERT(CodeSize() == Instructions::kCheckedEntryOffset);
3345 LoadClassIdMayBeSmi(RAX, RDI);
3346 SmiUntag(RBX);
3347 cmpq(RAX, RBX);
3348 j(NOT_EQUAL, &miss, Assembler::kNearJump);
3349
3350 // Fall through to unchecked entry.
3351 ASSERT(CodeSize() == Instructions::kUncheckedEntryOffset);
3352 ASSERT((CodeSize() & kSmiTagMask) == kSmiTag);
3353 }
3354
3355
3324 #ifndef PRODUCT 3356 #ifndef PRODUCT
3325 void Assembler::MaybeTraceAllocation(intptr_t cid, 3357 void Assembler::MaybeTraceAllocation(intptr_t cid,
3326 Label* trace, 3358 Label* trace,
3327 bool near_jump) { 3359 bool near_jump) {
3328 ASSERT(cid > 0); 3360 ASSERT(cid > 0);
3329 intptr_t state_offset = ClassTable::StateOffsetFor(cid); 3361 intptr_t state_offset = ClassTable::StateOffsetFor(cid);
3330 Register temp_reg = TMP; 3362 Register temp_reg = TMP;
3331 LoadIsolate(temp_reg); 3363 LoadIsolate(temp_reg);
3332 intptr_t table_offset = 3364 intptr_t table_offset =
3333 Isolate::class_table_offset() + ClassTable::TableOffsetFor(cid); 3365 Isolate::class_table_offset() + ClassTable::TableOffsetFor(cid);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
3744 3776
3745 3777
3746 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3778 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3747 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3779 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3748 return xmm_reg_names[reg]; 3780 return xmm_reg_names[reg];
3749 } 3781 }
3750 3782
3751 } // namespace dart 3783 } // namespace dart
3752 3784
3753 #endif // defined TARGET_ARCH_X64 3785 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698