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

Side by Side Diff: runtime/vm/stub_code_arm64.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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 __ Pop(R4); 411 __ Pop(R4);
412 // Remove the stub frame. 412 // Remove the stub frame.
413 __ LeaveStubFrame(); 413 __ LeaveStubFrame();
414 // Jump to the dart function. 414 // Jump to the dart function.
415 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset(), kNoPP); 415 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset(), kNoPP);
416 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP); 416 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP);
417 __ br(R0); 417 __ br(R0);
418 } 418 }
419 419
420 420
421 // Called from object allocate instruction when the allocation stub has been
422 // disabled.
423 void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) {
424 __ EnterStubFrame();
425 // Setup space on stack for return value.
426 __ PushObject(Object::null_object(), PP);
427 __ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0);
428 // Get Code object result.
429 __ Pop(R0);
430 // Remove the stub frame.
431 __ LeaveStubFrame();
432 // Jump to the dart function.
433 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset(), kNoPP);
434 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP);
435 __ br(R0);
436 }
437
438
421 // Input parameters: 439 // Input parameters:
422 // R2: smi-tagged argument count, may be zero. 440 // R2: smi-tagged argument count, may be zero.
423 // FP[kParamEndSlotFromFp + 1]: last argument. 441 // FP[kParamEndSlotFromFp + 1]: last argument.
424 static void PushArgumentsArray(Assembler* assembler) { 442 static void PushArgumentsArray(Assembler* assembler) {
425 StubCode* stub_code = Isolate::Current()->stub_code(); 443 StubCode* stub_code = Isolate::Current()->stub_code();
426 // Allocate array to store arguments of caller. 444 // Allocate array to store arguments of caller.
427 __ LoadObject(R1, Object::null_object(), PP); 445 __ LoadObject(R1, Object::null_object(), PP);
428 // R1: null element type for raw Array. 446 // R1: null element type for raw Array.
429 // R2: smi-tagged argument count, may be zero. 447 // R2: smi-tagged argument count, may be zero.
430 __ BranchLink(&stub_code->AllocateArrayLabel(), PP); 448 __ BranchLink(&stub_code->AllocateArrayLabel(), PP);
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 // Restore callee-saved registers, tear down frame. 1124 // Restore callee-saved registers, tear down frame.
1107 __ LeaveCallRuntimeFrame(); 1125 __ LeaveCallRuntimeFrame();
1108 __ ret(); 1126 __ ret();
1109 } 1127 }
1110 1128
1111 1129
1112 // Called for inline allocation of objects. 1130 // Called for inline allocation of objects.
1113 // Input parameters: 1131 // Input parameters:
1114 // LR : return address. 1132 // LR : return address.
1115 // SP + 0 : type arguments object (only if class is parameterized). 1133 // SP + 0 : type arguments object (only if class is parameterized).
1116 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, 1134 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler,
1117 const Class& cls) { 1135 const Class& cls) {
1118 // The generated code is different if the class is parameterized. 1136 // The generated code is different if the class is parameterized.
1119 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; 1137 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1120 ASSERT(!is_cls_parameterized || 1138 ASSERT(!is_cls_parameterized ||
1121 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1139 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1122 // kInlineInstanceSize is a constant used as a threshold for determining 1140 // kInlineInstanceSize is a constant used as a threshold for determining
1123 // when the object initialization should be done as a loop or as 1141 // when the object initialization should be done as a loop or as
1124 // straight line code. 1142 // straight line code.
1125 const int kInlineInstanceSize = 12; 1143 const int kInlineInstanceSize = 12;
1126 const intptr_t instance_size = cls.instance_size(); 1144 const intptr_t instance_size = cls.instance_size();
1127 ASSERT(instance_size > 0); 1145 ASSERT(instance_size > 0);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 // Push null type arguments. 1243 // Push null type arguments.
1226 __ PushObject(Object::null_object(), PP); 1244 __ PushObject(Object::null_object(), PP);
1227 } 1245 }
1228 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. 1246 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object.
1229 __ Drop(2); // Pop arguments. 1247 __ Drop(2); // Pop arguments.
1230 __ Pop(R0); // Pop result (newly allocated object). 1248 __ Pop(R0); // Pop result (newly allocated object).
1231 // R0: new object 1249 // R0: new object
1232 // Restore the frame pointer. 1250 // Restore the frame pointer.
1233 __ LeaveStubFrame(); 1251 __ LeaveStubFrame();
1234 __ ret(); 1252 __ ret();
1253 uword patch_code_pc_offset = assembler->CodeSize();
1254 StubCode* stub_code = Isolate::Current()->stub_code();
1255 __ BranchPatchable(&stub_code->FixAllocationStubTargetLabel());
1256 return patch_code_pc_offset;
1235 } 1257 }
1236 1258
1237 1259
1238 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function 1260 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function
1239 // from the entry code of a dart function after an error in passed argument 1261 // from the entry code of a dart function after an error in passed argument
1240 // name or number is detected. 1262 // name or number is detected.
1241 // Input parameters: 1263 // Input parameters:
1242 // LR : return address. 1264 // LR : return address.
1243 // SP : address of last argument. 1265 // SP : address of last argument.
1244 // R4: arguments descriptor array. 1266 // R4: arguments descriptor array.
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 const Register right = R0; 2077 const Register right = R0;
2056 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); 2078 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP);
2057 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); 2079 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP);
2058 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2080 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2059 __ ret(); 2081 __ ret();
2060 } 2082 }
2061 2083
2062 } // namespace dart 2084 } // namespace dart
2063 2085
2064 #endif // defined TARGET_ARCH_ARM64 2086 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698