Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
| 370 | |
|
zra
2014/09/10 16:07:39
Extra newline
srdjan
2014/09/11 16:22:36
Done.
| |
| 354 // Input parameters: | 371 // Input parameters: |
| 355 // R10: smi-tagged argument count, may be zero. | 372 // R10: smi-tagged argument count, may be zero. |
| 356 // RBP[kParamEndSlotFromFp + 1]: last argument. | 373 // RBP[kParamEndSlotFromFp + 1]: last argument. |
| 357 static void PushArgumentsArray(Assembler* assembler) { | 374 static void PushArgumentsArray(Assembler* assembler) { |
| 358 StubCode* stub_code = Isolate::Current()->stub_code(); | 375 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 359 | 376 |
| 360 __ LoadObject(R12, Object::null_object(), PP); | 377 __ LoadObject(R12, Object::null_object(), PP); |
| 361 // Allocate array to store arguments of caller. | 378 // Allocate array to store arguments of caller. |
| 362 __ movq(RBX, R12); // Null element type for raw Array. | 379 __ movq(RBX, R12); // Null element type for raw Array. |
| 363 __ call(&stub_code->AllocateArrayLabel()); | 380 __ call(&stub_code->AllocateArrayLabel()); |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); | 1061 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); |
| 1045 __ LeaveCallRuntimeFrame(); | 1062 __ LeaveCallRuntimeFrame(); |
| 1046 __ ret(); | 1063 __ ret(); |
| 1047 } | 1064 } |
| 1048 | 1065 |
| 1049 | 1066 |
| 1050 // Called for inline allocation of objects. | 1067 // Called for inline allocation of objects. |
| 1051 // Input parameters: | 1068 // Input parameters: |
| 1052 // RSP + 8 : type arguments object (only if class is parameterized). | 1069 // RSP + 8 : type arguments object (only if class is parameterized). |
| 1053 // RSP : points to return address. | 1070 // RSP : points to return address. |
| 1054 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1071 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
| 1055 const Class& cls) { | 1072 const Class& cls) { |
| 1056 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; | 1073 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; |
| 1057 // The generated code is different if the class is parameterized. | 1074 // The generated code is different if the class is parameterized. |
| 1058 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; | 1075 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1059 ASSERT(!is_cls_parameterized || | 1076 ASSERT(!is_cls_parameterized || |
| 1060 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1077 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1061 // kInlineInstanceSize is a constant used as a threshold for determining | 1078 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1062 // when the object initialization should be done as a loop or as | 1079 // when the object initialization should be done as a loop or as |
| 1063 // straight line code. | 1080 // straight line code. |
| 1064 const int kInlineInstanceSize = 12; // In words. | 1081 const int kInlineInstanceSize = 12; // In words. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1157 __ pushq(R12); // Push null type arguments. | 1174 __ pushq(R12); // Push null type arguments. |
| 1158 } | 1175 } |
| 1159 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. | 1176 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. |
| 1160 __ popq(RAX); // Pop argument (type arguments of object). | 1177 __ popq(RAX); // Pop argument (type arguments of object). |
| 1161 __ popq(RAX); // Pop argument (class of object). | 1178 __ popq(RAX); // Pop argument (class of object). |
| 1162 __ popq(RAX); // Pop result (newly allocated object). | 1179 __ popq(RAX); // Pop result (newly allocated object). |
| 1163 // RAX: new object | 1180 // RAX: new object |
| 1164 // Restore the frame pointer. | 1181 // Restore the frame pointer. |
| 1165 __ LeaveStubFrame(); | 1182 __ LeaveStubFrame(); |
| 1166 __ ret(); | 1183 __ ret(); |
| 1184 uword patch_code_pc_offset = assembler->CodeSize(); | |
| 1185 StubCode* stub_code = Isolate::Current()->stub_code(); | |
| 1186 __ JmpPatchable(&stub_code->FixAllocationStubTargetLabel(), R13); | |
| 1187 return patch_code_pc_offset; | |
| 1167 } | 1188 } |
| 1168 | 1189 |
| 1169 | 1190 |
| 1170 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function | 1191 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1171 // from the entry code of a dart function after an error in passed argument | 1192 // from the entry code of a dart function after an error in passed argument |
| 1172 // name or number is detected. | 1193 // name or number is detected. |
| 1173 // Input parameters: | 1194 // Input parameters: |
| 1174 // RSP : points to return address. | 1195 // RSP : points to return address. |
| 1175 // RSP + 8 : address of last argument. | 1196 // RSP + 8 : address of last argument. |
| 1176 // R10 : arguments descriptor array. | 1197 // R10 : arguments descriptor array. |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2002 | 2023 |
| 2003 __ movq(left, Address(RSP, 2 * kWordSize)); | 2024 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 2004 __ movq(right, Address(RSP, 1 * kWordSize)); | 2025 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 2005 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2026 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2006 __ ret(); | 2027 __ ret(); |
| 2007 } | 2028 } |
| 2008 | 2029 |
| 2009 } // namespace dart | 2030 } // namespace dart |
| 2010 | 2031 |
| 2011 #endif // defined TARGET_ARCH_X64 | 2032 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |