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

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

Issue 574843002: Fix x64 patching of asllocation stub: the pool pointer must be set-up before patching jump is execu… (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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); 1060 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
1061 __ LeaveCallRuntimeFrame(); 1061 __ LeaveCallRuntimeFrame();
1062 __ ret(); 1062 __ ret();
1063 } 1063 }
1064 1064
1065 1065
1066 // Called for inline allocation of objects. 1066 // Called for inline allocation of objects.
1067 // Input parameters: 1067 // Input parameters:
1068 // RSP + 8 : type arguments object (only if class is parameterized). 1068 // RSP + 8 : type arguments object (only if class is parameterized).
1069 // RSP : points to return address. 1069 // RSP : points to return address.
1070 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler, 1070 void StubCode::GenerateAllocationStubForClass(
1071 const Class& cls) { 1071 Assembler* assembler, const Class& cls,
1072 uword* entry_patch_offset, uword* patch_code_pc_offset) {
1073 // Must set-up a PP before being able to patch.
1074 Register new_pp = R13;
1075 Register new_pc = R12;
1076
1077 __ SetupPP(new_pp, new_pc);
zra 2014/09/16 22:18:01 Looking at this more closely, I think this could a
srdjan 2014/09/16 22:42:43 Reverting the change in assembler (SetupPP), using
1078 *entry_patch_offset = assembler->CodeSize();
1079
1072 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; 1080 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize;
1073 // The generated code is different if the class is parameterized. 1081 // The generated code is different if the class is parameterized.
1074 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; 1082 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1075 ASSERT(!is_cls_parameterized || 1083 ASSERT(!is_cls_parameterized ||
1076 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1084 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1077 // kInlineInstanceSize is a constant used as a threshold for determining 1085 // kInlineInstanceSize is a constant used as a threshold for determining
1078 // when the object initialization should be done as a loop or as 1086 // when the object initialization should be done as a loop or as
1079 // straight line code. 1087 // straight line code.
1080 const int kInlineInstanceSize = 12; // In words. 1088 const int kInlineInstanceSize = 12; // In words.
1081 const intptr_t instance_size = cls.instance_size(); 1089 const intptr_t instance_size = cls.instance_size();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 __ pushq(R12); // Push null type arguments. 1181 __ pushq(R12); // Push null type arguments.
1174 } 1182 }
1175 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. 1183 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object.
1176 __ popq(RAX); // Pop argument (type arguments of object). 1184 __ popq(RAX); // Pop argument (type arguments of object).
1177 __ popq(RAX); // Pop argument (class of object). 1185 __ popq(RAX); // Pop argument (class of object).
1178 __ popq(RAX); // Pop result (newly allocated object). 1186 __ popq(RAX); // Pop result (newly allocated object).
1179 // RAX: new object 1187 // RAX: new object
1180 // Restore the frame pointer. 1188 // Restore the frame pointer.
1181 __ LeaveStubFrame(); 1189 __ LeaveStubFrame();
1182 __ ret(); 1190 __ ret();
1183 uword patch_code_pc_offset = assembler->CodeSize(); 1191 *patch_code_pc_offset = assembler->CodeSize();
1184 StubCode* stub_code = Isolate::Current()->stub_code(); 1192 StubCode* stub_code = Isolate::Current()->stub_code();
1185 __ JmpPatchable(&stub_code->FixAllocationStubTargetLabel(), R13); 1193 __ JmpPatchable(&stub_code->FixAllocationStubTargetLabel(), new_pp);
1186 return patch_code_pc_offset;
1187 } 1194 }
1188 1195
1189 1196
1190 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function 1197 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function
1191 // from the entry code of a dart function after an error in passed argument 1198 // from the entry code of a dart function after an error in passed argument
1192 // name or number is detected. 1199 // name or number is detected.
1193 // Input parameters: 1200 // Input parameters:
1194 // RSP : points to return address. 1201 // RSP : points to return address.
1195 // RSP + 8 : address of last argument. 1202 // RSP + 8 : address of last argument.
1196 // R10 : arguments descriptor array. 1203 // R10 : arguments descriptor array.
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 2029
2023 __ movq(left, Address(RSP, 2 * kWordSize)); 2030 __ movq(left, Address(RSP, 2 * kWordSize));
2024 __ movq(right, Address(RSP, 1 * kWordSize)); 2031 __ movq(right, Address(RSP, 1 * kWordSize));
2025 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 2032 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2026 __ ret(); 2033 __ ret();
2027 } 2034 }
2028 2035
2029 } // namespace dart 2036 } // namespace dart
2030 2037
2031 #endif // defined TARGET_ARCH_X64 2038 #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