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

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

Issue 26682003: Cache number of type arguments in class object instead of recalculating it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 1244
1245 // Called for inline allocation of objects. 1245 // Called for inline allocation of objects.
1246 // Input parameters: 1246 // Input parameters:
1247 // RA : return address. 1247 // RA : return address.
1248 // SP + 4 : type arguments object (only if class is parameterized). 1248 // SP + 4 : type arguments object (only if class is parameterized).
1249 // SP + 0 : type arguments of instantiator (only if class is parameterized). 1249 // SP + 0 : type arguments of instantiator (only if class is parameterized).
1250 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, 1250 void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
1251 const Class& cls) { 1251 const Class& cls) {
1252 __ TraceSimMsg("AllocationStubForClass"); 1252 __ TraceSimMsg("AllocationStubForClass");
1253 // The generated code is different if the class is parameterized. 1253 // The generated code is different if the class is parameterized.
1254 const bool is_cls_parameterized = cls.HasTypeArguments(); 1254 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1255 ASSERT(!cls.HasTypeArguments() || 1255 ASSERT(!is_cls_parameterized ||
1256 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1256 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1257 // kInlineInstanceSize is a constant used as a threshold for determining 1257 // kInlineInstanceSize is a constant used as a threshold for determining
1258 // when the object initialization should be done as a loop or as 1258 // when the object initialization should be done as a loop or as
1259 // straight line code. 1259 // straight line code.
1260 const int kInlineInstanceSize = 12; 1260 const int kInlineInstanceSize = 12;
1261 const intptr_t instance_size = cls.instance_size(); 1261 const intptr_t instance_size = cls.instance_size();
1262 ASSERT(instance_size > 0); 1262 ASSERT(instance_size > 0);
1263 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); 1263 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize();
1264 if (FLAG_inline_alloc && 1264 if (FLAG_inline_alloc &&
1265 Heap::IsAllocatableInNewSpace(instance_size + type_args_size)) { 1265 Heap::IsAllocatableInNewSpace(instance_size + type_args_size)) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 // RA: return address. 1423 // RA: return address.
1424 // SP + 4 : receiver (null if not an implicit instance closure). 1424 // SP + 4 : receiver (null if not an implicit instance closure).
1425 // SP + 0 : type arguments object (null if class is no parameterized). 1425 // SP + 0 : type arguments object (null if class is no parameterized).
1426 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, 1426 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
1427 const Function& func) { 1427 const Function& func) {
1428 ASSERT(func.IsClosureFunction()); 1428 ASSERT(func.IsClosureFunction());
1429 ASSERT(!func.IsImplicitStaticClosureFunction()); 1429 ASSERT(!func.IsImplicitStaticClosureFunction());
1430 const bool is_implicit_instance_closure = 1430 const bool is_implicit_instance_closure =
1431 func.IsImplicitInstanceClosureFunction(); 1431 func.IsImplicitInstanceClosureFunction();
1432 const Class& cls = Class::ZoneHandle(func.signature_class()); 1432 const Class& cls = Class::ZoneHandle(func.signature_class());
1433 const bool has_type_arguments = cls.HasTypeArguments(); 1433 const bool has_type_arguments = cls.NumTypeArguments() > 0;
1434 1434
1435 __ TraceSimMsg("AllocationStubForClosure"); 1435 __ TraceSimMsg("AllocationStubForClosure");
1436 __ EnterStubFrame(true); // Uses pool pointer to refer to function. 1436 __ EnterStubFrame(true); // Uses pool pointer to refer to function.
1437 const intptr_t kTypeArgumentsFPOffset = 3 * kWordSize; 1437 const intptr_t kTypeArgumentsFPOffset = 3 * kWordSize;
1438 const intptr_t kReceiverFPOffset = 4 * kWordSize; 1438 const intptr_t kReceiverFPOffset = 4 * kWordSize;
1439 const intptr_t closure_size = Closure::InstanceSize(); 1439 const intptr_t closure_size = Closure::InstanceSize();
1440 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. 1440 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver.
1441 if (FLAG_inline_alloc && 1441 if (FLAG_inline_alloc &&
1442 Heap::IsAllocatableInNewSpace(closure_size + context_size)) { 1442 Heap::IsAllocatableInNewSpace(closure_size + context_size)) {
1443 Label slow_case; 1443 Label slow_case;
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 __ lw(left, Address(SP, 1 * kWordSize)); 2402 __ lw(left, Address(SP, 1 * kWordSize));
2403 __ lw(temp2, Address(SP, 2 * kWordSize)); 2403 __ lw(temp2, Address(SP, 2 * kWordSize));
2404 __ lw(temp1, Address(SP, 3 * kWordSize)); 2404 __ lw(temp1, Address(SP, 3 * kWordSize));
2405 __ Ret(); 2405 __ Ret();
2406 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); 2406 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize));
2407 } 2407 }
2408 2408
2409 } // namespace dart 2409 } // namespace dart
2410 2410
2411 #endif // defined TARGET_ARCH_MIPS 2411 #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