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

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

Issue 169223005: Simplify type argument instantiation cache lookup by introducing an array (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | 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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 // The generated code is different if the class is parameterized. 1294 // The generated code is different if the class is parameterized.
1295 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; 1295 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1296 ASSERT(!is_cls_parameterized || 1296 ASSERT(!is_cls_parameterized ||
1297 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1297 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1298 // kInlineInstanceSize is a constant used as a threshold for determining 1298 // kInlineInstanceSize is a constant used as a threshold for determining
1299 // when the object initialization should be done as a loop or as 1299 // when the object initialization should be done as a loop or as
1300 // straight line code. 1300 // straight line code.
1301 const int kInlineInstanceSize = 12; 1301 const int kInlineInstanceSize = 12;
1302 const intptr_t instance_size = cls.instance_size(); 1302 const intptr_t instance_size = cls.instance_size();
1303 ASSERT(instance_size > 0); 1303 ASSERT(instance_size > 0);
1304 Label slow_case_with_type_arguments; 1304 if (is_cls_parameterized) {
1305 __ lw(T1, Address(SP, 0 * kWordSize));
1306 // T1: type arguments.
1307 }
1305 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size)) { 1308 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size)) {
1306 Label slow_case_reload_type_arguments; 1309 Label slow_case;
1307 if (is_cls_parameterized) {
1308 __ lw(T1, Address(SP, 0 * kWordSize));
1309 // T1: type arguments.
1310 }
1311 // Allocate the object and update top to point to 1310 // Allocate the object and update top to point to
1312 // next object start and initialize the allocated object. 1311 // next object start and initialize the allocated object.
1313 // T1: instantiated type arguments (if is_cls_parameterized). 1312 // T1: instantiated type arguments (if is_cls_parameterized).
1314 Heap* heap = Isolate::Current()->heap(); 1313 Heap* heap = Isolate::Current()->heap();
1315 __ LoadImmediate(T5, heap->TopAddress()); 1314 __ LoadImmediate(T5, heap->TopAddress());
1316 __ lw(T2, Address(T5)); 1315 __ lw(T2, Address(T5));
1317 __ LoadImmediate(T4, instance_size); 1316 __ LoadImmediate(T4, instance_size);
1318 __ addu(T3, T2, T4); 1317 __ addu(T3, T2, T4);
1319 // Check if the allocation fits into the remaining space. 1318 // Check if the allocation fits into the remaining space.
1320 // T2: potential new object start. 1319 // T2: potential new object start.
1321 // T3: potential next object start. 1320 // T3: potential next object start.
1322 __ LoadImmediate(TMP, heap->EndAddress()); 1321 __ LoadImmediate(TMP, heap->EndAddress());
1323 __ lw(CMPRES1, Address(TMP)); 1322 __ lw(CMPRES1, Address(TMP));
1324 if (FLAG_use_slow_path) { 1323 if (FLAG_use_slow_path) {
1325 __ b(&slow_case_with_type_arguments); 1324 __ b(&slow_case);
1326 } else { 1325 } else {
1327 __ BranchUnsignedGreaterEqual(T3, CMPRES1, 1326 __ BranchUnsignedGreaterEqual(T3, CMPRES1, &slow_case);
1328 &slow_case_with_type_arguments);
1329 } 1327 }
1330 // Successfully allocated the object(s), now update top to point to 1328 // Successfully allocated the object(s), now update top to point to
1331 // next object start and initialize the object. 1329 // next object start and initialize the object.
1332 __ sw(T3, Address(T5)); 1330 __ sw(T3, Address(T5));
1333 __ UpdateAllocationStats(cls.id(), T5); 1331 __ UpdateAllocationStats(cls.id(), T5);
1334 1332
1335 // T2: new object start. 1333 // T2: new object start.
1336 // T3: next object start. 1334 // T3: next object start.
1337 // T1: new object type arguments (if is_cls_parameterized). 1335 // T1: new object type arguments (if is_cls_parameterized).
1338 // Set the tags. 1336 // Set the tags.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 if (is_cls_parameterized) { 1374 if (is_cls_parameterized) {
1377 // T1: new object type arguments. 1375 // T1: new object type arguments.
1378 // Set the type arguments in the new object. 1376 // Set the type arguments in the new object.
1379 __ sw(T1, Address(T2, cls.type_arguments_field_offset())); 1377 __ sw(T1, Address(T2, cls.type_arguments_field_offset()));
1380 } 1378 }
1381 // Done allocating and initializing the instance. 1379 // Done allocating and initializing the instance.
1382 // T2: new object still missing its heap tag. 1380 // T2: new object still missing its heap tag.
1383 __ Ret(); 1381 __ Ret();
1384 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag)); 1382 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag));
1385 1383
1386 __ Bind(&slow_case_reload_type_arguments); 1384 __ Bind(&slow_case);
1387 } 1385 }
1388 if (is_cls_parameterized) {
1389 __ lw(T1, Address(SP, 0 * kWordSize));
1390 }
1391 __ Bind(&slow_case_with_type_arguments);
1392 // If is_cls_parameterized: 1386 // If is_cls_parameterized:
1393 // T1: new object type arguments (instantiated or not). 1387 // T1: new object type arguments (instantiated or not).
1394 // Create a stub frame as we are pushing some objects on the stack before 1388 // Create a stub frame as we are pushing some objects on the stack before
1395 // calling into the runtime. 1389 // calling into the runtime.
1396 __ EnterStubFrame(true); // Uses pool pointer to pass cls to runtime. 1390 __ EnterStubFrame(true); // Uses pool pointer to pass cls to runtime.
1397 __ LoadObject(TMP, cls); 1391 __ LoadObject(TMP, cls);
1398 1392
1399 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 1393 __ addiu(SP, SP, Immediate(-3 * kWordSize));
1400 // Space on stack for return value. 1394 // Space on stack for return value.
1401 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null())); 1395 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null()));
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 const Register right = T0; 2382 const Register right = T0;
2389 __ lw(left, Address(SP, 1 * kWordSize)); 2383 __ lw(left, Address(SP, 1 * kWordSize));
2390 __ lw(right, Address(SP, 0 * kWordSize)); 2384 __ lw(right, Address(SP, 0 * kWordSize));
2391 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); 2385 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2);
2392 __ Ret(); 2386 __ Ret();
2393 } 2387 }
2394 2388
2395 } // namespace dart 2389 } // namespace dart
2396 2390
2397 #endif // defined TARGET_ARCH_MIPS 2391 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698