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

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

Issue 22580005: Implement IsNullCheck for CheckClassInstr. If input is nullable expected type, then check for null … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.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" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 4035 matching lines...) Expand 10 before | Expand all | Expand 10 after
4046 comparison()->EmitBranchCode(compiler, this); 4046 comparison()->EmitBranchCode(compiler, this);
4047 } 4047 }
4048 4048
4049 4049
4050 LocationSummary* CheckClassInstr::MakeLocationSummary() const { 4050 LocationSummary* CheckClassInstr::MakeLocationSummary() const {
4051 const intptr_t kNumInputs = 1; 4051 const intptr_t kNumInputs = 1;
4052 const intptr_t kNumTemps = 0; 4052 const intptr_t kNumTemps = 0;
4053 LocationSummary* summary = 4053 LocationSummary* summary =
4054 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4054 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
4055 summary->set_in(0, Location::RequiresRegister()); 4055 summary->set_in(0, Location::RequiresRegister());
4056 if (!null_check()) { 4056 if (!IsNullCheck()) {
4057 summary->AddTemp(Location::RequiresRegister()); 4057 summary->AddTemp(Location::RequiresRegister());
4058 } 4058 }
4059 return summary; 4059 return summary;
4060 } 4060 }
4061 4061
4062 4062
4063 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4063 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4064 if (null_check()) { 4064 if (IsNullCheck()) {
4065 Label* deopt = compiler->AddDeoptStub(deopt_id(), 4065 Label* deopt = compiler->AddDeoptStub(deopt_id(),
4066 kDeoptCheckClass); 4066 kDeoptCheckClass);
4067 const Immediate& raw_null = 4067 const Immediate& raw_null =
4068 Immediate(reinterpret_cast<intptr_t>(Object::null())); 4068 Immediate(reinterpret_cast<intptr_t>(Object::null()));
4069 __ cmpl(locs()->in(0).reg(), raw_null); 4069 __ cmpl(locs()->in(0).reg(), raw_null);
Vyacheslav Egorov (Google) 2013/08/08 13:01:06 Did you try to emit a testl() for nullable smis in
srdjan 2013/08/08 14:15:40 We never emit CheckClassInstr for nullable Smi-s (
4070 __ j(EQUAL, deopt); 4070 __ j(EQUAL, deopt);
4071 return; 4071 return;
4072 } 4072 }
4073 4073
4074 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || 4074 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) ||
4075 (unary_checks().NumberOfChecks() > 1)); 4075 (unary_checks().NumberOfChecks() > 1));
4076 Register value = locs()->in(0).reg(); 4076 Register value = locs()->in(0).reg();
4077 Register temp = locs()->temp(0).reg(); 4077 Register temp = locs()->temp(0).reg();
4078 Label* deopt = compiler->AddDeoptStub(deopt_id(), 4078 Label* deopt = compiler->AddDeoptStub(deopt_id(),
4079 kDeoptCheckClass); 4079 kDeoptCheckClass);
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
4951 PcDescriptors::kOther, 4951 PcDescriptors::kOther,
4952 locs()); 4952 locs());
4953 __ Drop(2); // Discard type arguments and receiver. 4953 __ Drop(2); // Discard type arguments and receiver.
4954 } 4954 }
4955 4955
4956 } // namespace dart 4956 } // namespace dart
4957 4957
4958 #undef __ 4958 #undef __
4959 4959
4960 #endif // defined TARGET_ARCH_IA32 4960 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698