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

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

Issue 557913002: Allow invalidation and recompilation of instance allocation stubs. Requested in order to implement… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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
« no previous file with comments | « runtime/vm/stub_code_mips.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) 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" 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/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 __ popq(RAX); // Get Code object. 344 __ popq(RAX); // Get Code object.
345 __ popq(R10); // Restore arguments descriptor array. 345 __ popq(R10); // Restore arguments descriptor array.
346 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); 346 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset()));
347 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 347 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
348 __ LeaveStubFrame(); 348 __ LeaveStubFrame();
349 __ jmp(RAX); 349 __ jmp(RAX);
350 __ int3(); 350 __ int3();
351 } 351 }
352 352
353 353
354 // Called from object allocate instruction when the allocation stub has been
355 // disabled.
356 void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) {
357 __ EnterStubFrame();
358 // Setup space on stack for return value.
359 __ PushObject(Object::null_object(), PP);
360 __ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0);
361 __ popq(RAX); // Get Code object.
362 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset()));
363 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
364 __ LeaveStubFrame();
365 __ jmp(RAX);
366 __ int3();
367 }
368
369
354 // Input parameters: 370 // Input parameters:
355 // R10: smi-tagged argument count, may be zero. 371 // R10: smi-tagged argument count, may be zero.
356 // RBP[kParamEndSlotFromFp + 1]: last argument. 372 // RBP[kParamEndSlotFromFp + 1]: last argument.
357 static void PushArgumentsArray(Assembler* assembler) { 373 static void PushArgumentsArray(Assembler* assembler) {
358 StubCode* stub_code = Isolate::Current()->stub_code(); 374 StubCode* stub_code = Isolate::Current()->stub_code();
359 375
360 __ LoadObject(R12, Object::null_object(), PP); 376 __ LoadObject(R12, Object::null_object(), PP);
361 // Allocate array to store arguments of caller. 377 // Allocate array to store arguments of caller.
362 __ movq(RBX, R12); // Null element type for raw Array. 378 __ movq(RBX, R12); // Null element type for raw Array.
363 __ call(&stub_code->AllocateArrayLabel()); 379 __ call(&stub_code->AllocateArrayLabel());
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); 1060 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
1045 __ LeaveCallRuntimeFrame(); 1061 __ LeaveCallRuntimeFrame();
1046 __ ret(); 1062 __ ret();
1047 } 1063 }
1048 1064
1049 1065
1050 // Called for inline allocation of objects. 1066 // Called for inline allocation of objects.
1051 // Input parameters: 1067 // Input parameters:
1052 // RSP + 8 : type arguments object (only if class is parameterized). 1068 // RSP + 8 : type arguments object (only if class is parameterized).
1053 // RSP : points to return address. 1069 // RSP : points to return address.
1054 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, 1070 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler,
1055 const Class& cls) { 1071 const Class& cls) {
1056 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; 1072 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize;
1057 // The generated code is different if the class is parameterized. 1073 // The generated code is different if the class is parameterized.
1058 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; 1074 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1059 ASSERT(!is_cls_parameterized || 1075 ASSERT(!is_cls_parameterized ||
1060 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1076 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1061 // kInlineInstanceSize is a constant used as a threshold for determining 1077 // kInlineInstanceSize is a constant used as a threshold for determining
1062 // when the object initialization should be done as a loop or as 1078 // when the object initialization should be done as a loop or as
1063 // straight line code. 1079 // straight line code.
1064 const int kInlineInstanceSize = 12; // In words. 1080 const int kInlineInstanceSize = 12; // In words.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 __ pushq(R12); // Push null type arguments. 1173 __ pushq(R12); // Push null type arguments.
1158 } 1174 }
1159 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. 1175 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object.
1160 __ popq(RAX); // Pop argument (type arguments of object). 1176 __ popq(RAX); // Pop argument (type arguments of object).
1161 __ popq(RAX); // Pop argument (class of object). 1177 __ popq(RAX); // Pop argument (class of object).
1162 __ popq(RAX); // Pop result (newly allocated object). 1178 __ popq(RAX); // Pop result (newly allocated object).
1163 // RAX: new object 1179 // RAX: new object
1164 // Restore the frame pointer. 1180 // Restore the frame pointer.
1165 __ LeaveStubFrame(); 1181 __ LeaveStubFrame();
1166 __ ret(); 1182 __ ret();
1183 uword patch_code_pc_offset = assembler->CodeSize();
1184 StubCode* stub_code = Isolate::Current()->stub_code();
1185 __ JmpPatchable(&stub_code->FixAllocationStubTargetLabel(), R13);
1186 return patch_code_pc_offset;
1167 } 1187 }
1168 1188
1169 1189
1170 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function 1190 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function
1171 // from the entry code of a dart function after an error in passed argument 1191 // from the entry code of a dart function after an error in passed argument
1172 // name or number is detected. 1192 // name or number is detected.
1173 // Input parameters: 1193 // Input parameters:
1174 // RSP : points to return address. 1194 // RSP : points to return address.
1175 // RSP + 8 : address of last argument. 1195 // RSP + 8 : address of last argument.
1176 // R10 : arguments descriptor array. 1196 // R10 : arguments descriptor array.
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 2022
2003 __ movq(left, Address(RSP, 2 * kWordSize)); 2023 __ movq(left, Address(RSP, 2 * kWordSize));
2004 __ movq(right, Address(RSP, 1 * kWordSize)); 2024 __ movq(right, Address(RSP, 1 * kWordSize));
2005 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 2025 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2006 __ ret(); 2026 __ ret();
2007 } 2027 }
2008 2028
2009 } // namespace dart 2029 } // namespace dart
2010 2030
2011 #endif // defined TARGET_ARCH_X64 2031 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698