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

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2335363002: DBC: Another allocation fast path (Closed)
Patch Set: Remove extra whitespace Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index d619f098cadda4e25d41458915fcdc60fe88d503..3566b6c4aeea2d93e78152b22c0c0335b9af7c4e 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -916,14 +916,37 @@ EMIT_NATIVE_CODE(AllocateObject,
LocationSummary::kCall) {
if (ArgumentCount() == 1) {
// Allocate with type arguments.
- __ PushConstant(cls());
- __ AllocateT();
- compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
- Thread::kNoDeoptId,
- token_pos());
- compiler->RecordSafepoint(locs());
if (compiler->is_optimizing()) {
+ // If we're optimizing, try a streamlined fastpath.
+ const intptr_t instance_size = cls().instance_size();
+ Isolate* isolate = Isolate::Current();
+ if (Heap::IsAllocatableInNewSpace(instance_size) &&
+ !cls().TraceAllocation(isolate)) {
+ uword tags = 0;
+ tags = RawObject::SizeTag::update(instance_size, tags);
+ ASSERT(cls().id() != kIllegalCid);
+ tags = RawObject::ClassIdTag::update(cls().id(), tags);
+ if (Smi::IsValid(tags)) {
+ const intptr_t tags_kidx = __ AddConstant(
+ Smi::Handle(Smi::New(tags)));
+ __ AllocateTOpt(locs()->out(0).reg(), tags_kidx);
+ __ Nop(cls().type_arguments_field_offset());
+ }
+ }
+ __ PushConstant(cls());
+ __ AllocateT();
+ compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
+ Thread::kNoDeoptId,
+ token_pos());
+ compiler->RecordSafepoint(locs());
__ PopLocal(locs()->out(0).reg());
+ } else {
+ __ PushConstant(cls());
+ __ AllocateT();
+ compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
+ Thread::kNoDeoptId,
+ token_pos());
+ compiler->RecordSafepoint(locs());
}
} else if (compiler->is_optimizing()) {
// If we're optimizing, try a streamlined fastpath.
@@ -1020,6 +1043,8 @@ EMIT_NATIVE_CODE(AllocateUninitializedContext,
0, Location::RequiresRegister(),
LocationSummary::kCall) {
ASSERT(compiler->is_optimizing());
+ __ AllocateUninitializedContext(locs()->out(0).reg(),
+ num_context_variables());
__ AllocateContext(num_context_variables());
compiler->RecordSafepoint(locs());
compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698