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

Side by Side Diff: runtime/lib/object.cc

Issue 1533383003: Remove instantiator argument in generated code for type tests. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix typo Created 4 years, 12 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
« no previous file with comments | « no previous file | runtime/lib/object_patch.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ASSERT(instance_is_int); 148 ASSERT(instance_is_int);
149 if (instantiated_type.IsDoubleType()) { 149 if (instantiated_type.IsDoubleType()) {
150 Report::JSWarningFromNative( 150 Report::JSWarningFromNative(
151 false, // Object_instanceOf and Object_as are not static calls. 151 false, // Object_instanceOf and Object_as are not static calls.
152 "integer value is also considered to be of type 'double'"); 152 "integer value is also considered to be of type 'double'");
153 } 153 }
154 } 154 }
155 } 155 }
156 156
157 157
158 DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) { 158 DEFINE_NATIVE_ENTRY(Object_instanceOf, 4) {
159 const Instance& instance = 159 const Instance& instance =
160 Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); 160 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
161 // Instantiator at position 1 is not used. It is passed along so that the call
162 // can be easily converted to an optimized implementation. Instantiator is
163 // used to populate the subtype cache.
164 const TypeArguments& instantiator_type_arguments = 161 const TypeArguments& instantiator_type_arguments =
165 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(2)); 162 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
166 const AbstractType& type = 163 const AbstractType& type =
167 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(3)); 164 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(2));
168 const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(4)); 165 const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(3));
169 ASSERT(type.IsFinalized()); 166 ASSERT(type.IsFinalized());
170 ASSERT(!type.IsMalformed()); 167 ASSERT(!type.IsMalformed());
171 ASSERT(!type.IsMalbounded()); 168 ASSERT(!type.IsMalbounded());
172 169
173 // Check for javascript compatibility. 170 // Check for javascript compatibility.
174 if (FLAG_warn_on_javascript_compatibility) { 171 if (FLAG_warn_on_javascript_compatibility) {
175 WarnOnJSIntegralNumTypeTest(instance, instantiator_type_arguments, type); 172 WarnOnJSIntegralNumTypeTest(instance, instantiator_type_arguments, type);
176 } 173 }
177 174
178 Error& bound_error = Error::Handle(zone, Error::null()); 175 Error& bound_error = Error::Handle(zone, Error::null());
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); 257 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
261 const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(1)); 258 const Bool& negate = Bool::CheckedHandle(zone, arguments->NativeArgAt(1));
262 bool is_instance_of = instance.IsString(); 259 bool is_instance_of = instance.IsString();
263 if (negate.value()) { 260 if (negate.value()) {
264 is_instance_of = !is_instance_of; 261 is_instance_of = !is_instance_of;
265 } 262 }
266 return Bool::Get(is_instance_of).raw(); 263 return Bool::Get(is_instance_of).raw();
267 } 264 }
268 265
269 266
270 DEFINE_NATIVE_ENTRY(Object_as, 4) { 267 DEFINE_NATIVE_ENTRY(Object_as, 3) {
271 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); 268 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
272 // Instantiator at position 1 is not used. It is passed along so that the call
273 // can be easily converted to an optimized implementation. Instantiator is
274 // used to populate the subtype cache.
275 const TypeArguments& instantiator_type_arguments = 269 const TypeArguments& instantiator_type_arguments =
276 TypeArguments::CheckedHandle(arguments->NativeArgAt(2)); 270 TypeArguments::CheckedHandle(arguments->NativeArgAt(1));
277 const AbstractType& type = 271 const AbstractType& type =
278 AbstractType::CheckedHandle(arguments->NativeArgAt(3)); 272 AbstractType::CheckedHandle(arguments->NativeArgAt(2));
279 ASSERT(type.IsFinalized()); 273 ASSERT(type.IsFinalized());
280 ASSERT(!type.IsMalformed()); 274 ASSERT(!type.IsMalformed());
281 ASSERT(!type.IsMalbounded()); 275 ASSERT(!type.IsMalbounded());
282 Error& bound_error = Error::Handle(); 276 Error& bound_error = Error::Handle();
283 if (instance.IsNull()) { 277 if (instance.IsNull()) {
284 return instance.raw(); 278 return instance.raw();
285 } 279 }
286 280
287 // Check for javascript compatibility. 281 // Check for javascript compatibility.
288 if (FLAG_warn_on_javascript_compatibility) { 282 if (FLAG_warn_on_javascript_compatibility) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 381
388 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { 382 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) {
389 #if defined(ARCH_IS_64_BIT) 383 #if defined(ARCH_IS_64_BIT)
390 return Bool::True().raw(); 384 return Bool::True().raw();
391 #else 385 #else
392 return Bool::False().raw(); 386 return Bool::False().raw();
393 #endif // defined(ARCH_IS_64_BIT) 387 #endif // defined(ARCH_IS_64_BIT)
394 } 388 }
395 389
396 } // namespace dart 390 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698